Noemi Pap-Takacs has submitted this change and it was merged. ( 
http://gerrit.cloudera.org:8080/23855 )

Change subject: IMPALA-14563: Throw AnalysisException when aggregating complex 
type
......................................................................

IMPALA-14563: Throw AnalysisException when aggregating complex type

Before this change, when the user tries to aggregate by a complex type,
we threw an IllegalStateException.

  SELECT complex_col, count(*) FROM table_example GROUP BY complex_col;

Error:

  java.lang.IllegalStateException: null

This does not provide appropriate context about the query's problem.

Instead of throwing an IllegalStateException, we now throw the
appropriate AnalysisException, which highlights the issue with the query.

  AnalysisException: GROUP BY expression cannot be used on complex types
                     without specifying a field

This helps the user rewrite the query correctly by making them aware that
specifying a field would fix the query.

  SELECT complex_col.val1, count(*) FROM table_example GROUP BY 
complex_col.val1;

Testing:
  Added tests to TestsGroupBy() method in AnalyzeStmtsTest.java

Change-Id: Ie431873efe7100e8150e93be2aa016381d687268
Reviewed-on: http://gerrit.cloudera.org:8080/23855
Tested-by: Impala Public Jenkins <[email protected]>
Reviewed-by: Noemi Pap-Takacs <[email protected]>
---
M fe/src/main/java/org/apache/impala/analysis/SelectStmt.java
M fe/src/test/java/org/apache/impala/analysis/AnalyzeStmtsTest.java
2 files changed, 16 insertions(+), 6 deletions(-)

Approvals:
  Impala Public Jenkins: Verified
  Noemi Pap-Takacs: Looks good to me, approved

--
To view, visit http://gerrit.cloudera.org:8080/23855
To unsubscribe, visit http://gerrit.cloudera.org:8080/settings

Gerrit-Project: Impala-ASF
Gerrit-Branch: master
Gerrit-MessageType: merged
Gerrit-Change-Id: Ie431873efe7100e8150e93be2aa016381d687268
Gerrit-Change-Number: 23855
Gerrit-PatchSet: 6
Gerrit-Owner: Surya Hebbar <[email protected]>
Gerrit-Reviewer: Impala Public Jenkins <[email protected]>
Gerrit-Reviewer: Noemi Pap-Takacs <[email protected]>
Gerrit-Reviewer: Peter Rozsa <[email protected]>
Gerrit-Reviewer: Surya Hebbar <[email protected]>

Reply via email to