wangsheng has uploaded a new patch set (#6). (
http://gerrit.cloudera.org:8080/18099 )
Change subject: IMPALA-11049: Substitute order by elements when creating
SortInfo
......................................................................
IMPALA-11049: Substitute order by elements when creating SortInfo
Currently, Impala cloned order by elements' exprs, and substitute
these cloned exprs in-place, original exprs not changed. But when
executing 'SelectStmt.rewriteExprs()', Impala rewrite 'orderByElements_'
instead of 'sortInfo_', which causes AnalysisException due to 'INVALID'
exprs in 'orderByElements_'. They are 'INVALID' type because they
weren't not analyzed.
This patch will substitute exprs in 'orderByElements_' in-place, and
use these substituted exprs to create 'SortInfo'. But Pay attention,
this will changed explain result when printing sql. For example:
explain select id, count(1) from functional.alltypes
group by 1 order by 1;
Without this patch, the EXPLAIN output is:
Analyzed query: SELECT id, count(*) FROM functional.alltypes
GROUP BY id ORDER BY CAST(1 AS TINYINT) ASC
After rewrite 'sortInfo_', the EXPLAIN output is:
Analyzed query: SELECT id, count(*) FROM functional.alltypes
GROUP BY id ORDER BY id ASC
Besides, we also add a condition check in 'SimplifyCastExprRule' to
ensure that exprs are already analyzed.
Testing:
- Added test cases in 'explain-level3.test'
Change-Id: I2780e04a6d5a32e224cd0470cf6f166a832363ec
---
M fe/src/main/java/org/apache/impala/rewrite/SimplifyCastExprRule.java
M testdata/workloads/functional-query/queries/QueryTest/explain-level3.test
2 files changed, 62 insertions(+), 0 deletions(-)
git pull ssh://gerrit.cloudera.org:29418/Impala-ASF refs/changes/99/18099/6
--
To view, visit http://gerrit.cloudera.org:8080/18099
To unsubscribe, visit http://gerrit.cloudera.org:8080/settings
Gerrit-Project: Impala-ASF
Gerrit-Branch: master
Gerrit-MessageType: newpatchset
Gerrit-Change-Id: I2780e04a6d5a32e224cd0470cf6f166a832363ec
Gerrit-Change-Number: 18099
Gerrit-PatchSet: 6
Gerrit-Owner: wangsheng <[email protected]>
Gerrit-Reviewer: Impala Public Jenkins <[email protected]>
Gerrit-Reviewer: Quanlong Huang <[email protected]>
Gerrit-Reviewer: Zoltan Borok-Nagy <[email protected]>
Gerrit-Reviewer: wangsheng <[email protected]>