Xianqing He has uploaded a new patch set (#3). ( 
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
 - Ran 'mvn test' for the FE

Change-Id: I34f659d15073d69aa0a4685f56ad94557df86560
---
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(-)


  git pull ssh://gerrit.cloudera.org:29418/Impala-ASF refs/changes/53/16353/3
--
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: newpatchset
Gerrit-Change-Id: I34f659d15073d69aa0a4685f56ad94557df86560
Gerrit-Change-Number: 16353
Gerrit-PatchSet: 3
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