Impala Public Jenkins has submitted this change and it was merged. ( 
http://gerrit.cloudera.org:8080/16353 )

Change subject: IMPALA-10096: Use the original ordinal if the group by ordinal 
reference is a constant int
......................................................................

IMPALA-10096: Use the original ordinal if the group by ordinal reference is a 
constant int

The SelectStmt's groupingExprs_ uses the analyzed version and the
ordinal reference will be substituted.
It will throw an exception if the ordinal reference is still a numeric
literal, because we will re-analyze after the expression has been
rewritten. For example, here "count(1)" is rewritten to "count(*)" so
we need to re-analyze the new query.
select 13, id, count(1) from dimtbl group by 1, 2;
The rewritten sql should be
select 13, id, count(*) from dimtbl group by 1, id;
If the original query uses "count(*)", it won't hit the bug since
no rewriting happens.

Testing:
 - Added new unit tests with ordinal in GROUP BY whereas SELECT has
   the INT literal.
 - Ran 'mvn test' for the FE

Change-Id: I34f659d15073d69aa0a4685f56ad94557df86560
Reviewed-on: http://gerrit.cloudera.org:8080/16353
Reviewed-by: Impala Public Jenkins <[email protected]>
Tested-by: Impala Public Jenkins <[email protected]>
---
M fe/src/main/java/org/apache/impala/analysis/SelectStmt.java
M testdata/workloads/functional-planner/queries/PlannerTest/aggregation.test
2 files changed, 71 insertions(+), 1 deletion(-)

Approvals:
  Impala Public Jenkins: Looks good to me, approved; Verified

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

Gerrit-Project: Impala-ASF
Gerrit-Branch: master
Gerrit-MessageType: merged
Gerrit-Change-Id: I34f659d15073d69aa0a4685f56ad94557df86560
Gerrit-Change-Number: 16353
Gerrit-PatchSet: 8
Gerrit-Owner: Xianqing He <[email protected]>
Gerrit-Reviewer: Aman Sinha <[email protected]>
Gerrit-Reviewer: Impala Public Jenkins <[email protected]>
Gerrit-Reviewer: Quanlong Huang <[email protected]>
Gerrit-Reviewer: Xianqing He <[email protected]>

Reply via email to