Apache Spark: Group by condition : <p>I have a table which is like:</p>

<pre><code>+-----+-----+
| name|value|
+-----+-----+
|Alice|  1.2|
| Lisa|  3.4|
| Nick|  0.8|
| Jack| 10.1|
| Cici|  4.4|
+-----+-----+
</code></pre>

<p>I want to group the data by condition such as [value &lt; 1, 1 &lt;= value &lt; 5, value >= 5] and know the percentile of each group, so my expect group will be like this:</p>

<pre><code>group         percentile
value &lt; 1     0.20
1&lt;=value&lt;5    0.60
value &gt;= 5    0.20
</code></pre>

<p>Is there a simple and clear way to do this?</p>
