[ https://issues.apache.org/jira/browse/HIVE-1683?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16138203#comment-16138203 ]
Alfonso Nishikawa edited comment on HIVE-1683 at 8/23/17 10:26 AM: ------------------------------------------------------------------- For anyone reaching this comments, it is possible to set the group by position (not by alias, but in much cases will be enough) configuring {{set hive.groupby.orderby.position.alias=true;}}. >From [https://cwiki.apache.org/confluence/display/Hive/LanguageManual+GroupBy] >: bq. In groupByExpression columns are specified by name, not by position number. However in Hive 0.11.0 and later, columns can be specified by position when configured as follows: bq. For Hive 0.11.0 through 2.1.x, set hive.groupby.orderby.position.alias to true (the default is false). bq. For Hive 2.2.0 and later, set hive.groupby.position.alias to true (the default is false). was (Author: alfonso.nishikawa): For anyone reaching this comments, it is possible to set the group by position (not by alias, but in much cases will be enough) configuring {{set hive.groupby.orderby.position.alias=true;}}. >From [https://cwiki.apache.org/confluence/display/Hive/LanguageManual+GroupBy] >: bq. In groupByExpression columns are specified by name, not by position number. However in Hive 0.11.0 and later, columns can be specified by position when configured as follows: For Hive 0.11.0 through 2.1.x, set hive.groupby.orderby.position.alias to true (the default is false). For Hive 2.2.0 and later, set hive.groupby.position.alias to true (the default is false). > Column aliases cannot be used in a group by clause > -------------------------------------------------- > > Key: HIVE-1683 > URL: https://issues.apache.org/jira/browse/HIVE-1683 > Project: Hive > Issue Type: Bug > Components: Metastore > Reporter: Shrikrishna Lawande > Labels: SQL > > Column aliases cannot be used in a group by clause > Following query would fail : > select col1 as t, count(col2) from test group by t; > FAILED: Error in semantic analysis: line 1:49 Invalid Table Alias or Column > Reference t -- This message was sent by Atlassian JIRA (v6.4.14#64029)