GitHub user dongjoon-hyun opened a pull request: https://github.com/apache/spark/pull/12794
[SPARK-15020][SQL] GROUP-BY should support Aliases ## What changes were proposed in this pull request? `GROUP-BY` clauses raise **AnalysisException** for aliases while `ORDER-BY` clauses support them correctly. This PR aims to support aliases in `GROUP-BY` clause. This is one of frequently-used syntax to avoid unnecessary repetition. ``` scala> sql("select 1 a group by a").head org.apache.spark.sql.AnalysisException: cannot resolve '`a`' given input columns: []; line 1 pos 20 scala> sql("select 1 a order by a").head res1: org.apache.spark.sql.Row = [1] ``` ## How was this patch tested? Pass the Jenkins tests (including a new testcase) You can merge this pull request into a Git repository by running: $ git pull https://github.com/dongjoon-hyun/spark SPARK-15020 Alternatively you can review and apply these changes as the patch at: https://github.com/apache/spark/pull/12794.patch To close this pull request, make a commit to your master/trunk branch with (at least) the following in the commit message: This closes #12794 ---- commit 71249cfeb9e798e41d8ef0f7423b48685a1774e7 Author: Dongjoon Hyun <dongj...@apache.org> Date: 2016-04-29T23:17:05Z [SPARK-15020][SQL] GROUP-BY should support Aliases ``` sql("select a x from values 1 T(a) group by x").explain org.apache.spark.sql.AnalysisException: cannot resolve '`x`' given input columns: [a]; line 1 pos 39 ``` ---- --- If your project is set up for it, you can reply to this email and have your reply appear on GitHub as well. If your project does not have this feature enabled and wishes so, or if the feature is enabled but not working, please contact infrastructure at infrastruct...@apache.org or file a JIRA ticket with INFRA. --- --------------------------------------------------------------------- To unsubscribe, e-mail: reviews-unsubscr...@spark.apache.org For additional commands, e-mail: reviews-h...@spark.apache.org