Aman Sinha has uploaded this change for review. ( http://gerrit.cloudera.org:8080/15693
Change subject: IMPALA-9620: Ensure group-by and cnf exprs are analyzed ...................................................................... IMPALA-9620: Ensure group-by and cnf exprs are analyzed This change initializes the SelectStmt's groupingExprs_ with the analyzed version. It also analyzes the new predicates created by the Conjunctive Normal Form rewrite rule such that potential consumers of this rewrite don't encounter problems. Before this change, the SelectStmt.analyzeGroupingExprs() made a deep copy of the original grouping exprs, then analyzed the copy but left the original intact. This causes problems because a rewrite rule (invoked by SelectStmt.rewriteExprs()) may try to process the original grouping exprs and encounter INVALID_TYPE (types are only assigned after analyze). This was the root cause of the problem described in the JIRA. Although this was a pre- existing behavior, it gets exposed when enable_cnf_rewrites=true. Note that the deep-copied analyzed grouping exprs are supplied to MultiAggregateInfo and since many operations are using this data structure, we don't see widespread issues. This patch fixes it and as a conservative measure, does the analyze of new predicates in the CNF rule. (note: there are likely other rewrite rules where explicit analyze should be done but that is outside the scope for this issue). Testing: - Added new unit tests with predicates in SELECT and GROUP BY - Ran 'mvn test' for the FE Change-Id: I6da4a17c6e648f466ce118c4646520ff68f9878e --- M fe/src/main/java/org/apache/impala/analysis/SelectStmt.java M fe/src/main/java/org/apache/impala/rewrite/ConvertToCNFRule.java M testdata/workloads/functional-planner/queries/PlannerTest/convert-to-cnf.test 3 files changed, 53 insertions(+), 6 deletions(-) git pull ssh://gerrit.cloudera.org:29418/Impala-ASF refs/changes/93/15693/1 -- To view, visit http://gerrit.cloudera.org:8080/15693 To unsubscribe, visit http://gerrit.cloudera.org:8080/settings Gerrit-Project: Impala-ASF Gerrit-Branch: master Gerrit-MessageType: newchange Gerrit-Change-Id: I6da4a17c6e648f466ce118c4646520ff68f9878e Gerrit-Change-Number: 15693 Gerrit-PatchSet: 1 Gerrit-Owner: Aman Sinha <[email protected]>
