Assign alias to group field in Spark SQL
<p>In Spark SQL, is it possible to assign an alias to the grouped field?</p>

<p>So for example, I want to do something like this:</p>

<pre><code>SELECT field_b
FROM table
GROUP BY some_func(field_a) AS field_b
</code></pre>

<p>which is not supported, instead I have to do:</p>

<pre><code>SELECT some_func(field_a) AS field_b
FROM table
GROUP BY some_func(field_a)
</code></pre>

<p>As you can see I need to call <code>some_func</code> twice which is kind of annoying.</p>