GitHub user ravipesala opened a pull request: https://github.com/apache/spark/pull/2511
[SPARK-3371][SQL] Renaming a function expression with group by gives error The following code gives error. ``` sqlContext.registerFunction("len", (s: String) => s.length) sqlContext.sql("select len(foo) as a, count(1) from t1 group by len(foo)").collect() ``` Because SQl parser creates the aliases to the functions in grouping expressions with generated alias names. So if user gives the alias names to the functions inside projection then it does not match the generated alias name of grouping expression. So the fix I have given that if user provides alias to the function in projection then don't generate alias in grouping expression,use the same alias. You can merge this pull request into a Git repository by running: $ git pull https://github.com/ravipesala/spark SPARK-3371 Alternatively you can review and apply these changes as the patch at: https://github.com/apache/spark/pull/2511.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 #2511 ---- commit bad2fd00be2f5b79c08dace5cc107408bd5ca019 Author: ravipesala <ravindra.pes...@huawei.com> Date: 2014-09-23T09:31:14Z SPARK-3371 : Fixed Renaming a function expression with group by gives error Signed-off-by: ravipesala <ravindra.pes...@huawei.com> commit f8ace79e4015da06ea2821dfc8b9dfbc06fadd1c Author: ravipesala <ravindra.pes...@huawei.com> Date: 2014-09-23T18:43:27Z Fixed the testcase issue ---- --- 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