[ 
https://issues.apache.org/jira/browse/HIVE-18345?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

kai updated HIVE-18345:
-----------------------
    Description: 
Hive gives the error message  - _Expression not in GROUP BY key_ if a column 
which is not present in GBY clause is projected without aggregation.

Example:
{code:sql}
Select x,y from A group by y;
FAILED: SemanticException Error 10025: Line 1:7 Expression not in GROUP BY key 
'x'
{code}

But, in case of a subquery, the error message is misleading.
{code:sql}
CREATE TABLE A(x int, y int);
Select a.x, a.y from (select x, y from A) as a group by a.y;
FAILED: SemanticException Error 10002: Line 1:9 Invalid column reference 'x'
{code}


  was:
Hive gives the error message  - _Expression not in GROUP BY key_ if a column 
which is not present in GBY clause is projected without aggregation.
{code:java}
// Some comments here
public String getFoo()
{
    return foo;
}
{code}

Example:
{code:sql}
Select x,y from A group by y;
FAILED: SemanticException Error 10025: Line 1:7 Expression not in GROUP BY key 
'x'
{code}

But, in case of a subquery, the error message is misleading.
{code:sql}
CREATE TABLE A(x int, y int);
Select a.x, a.y from (select x, y from A) as a group by a.y;
FAILED: SemanticException Error 10002: Line 1:9 Invalid column reference 'x'
{code}



> Incorrect Error Message when column is not present in GroupBy clause
> --------------------------------------------------------------------
>
>                 Key: HIVE-18345
>                 URL: https://issues.apache.org/jira/browse/HIVE-18345
>             Project: Hive
>          Issue Type: Improvement
>          Components: Query Planning
>    Affects Versions: 2.1.0
>            Reporter: Nitin Khandelwal
>            Priority: Minor
>
> Hive gives the error message  - _Expression not in GROUP BY key_ if a column 
> which is not present in GBY clause is projected without aggregation.
> Example:
> {code:sql}
> Select x,y from A group by y;
> FAILED: SemanticException Error 10025: Line 1:7 Expression not in GROUP BY 
> key 'x'
> {code}
> But, in case of a subquery, the error message is misleading.
> {code:sql}
> CREATE TABLE A(x int, y int);
> Select a.x, a.y from (select x, y from A) as a group by a.y;
> FAILED: SemanticException Error 10002: Line 1:9 Invalid column reference 'x'
> {code}



--
This message was sent by Atlassian JIRA
(v6.4.14#64029)

Reply via email to