Xianqing He has uploaded this change for review. ( 
http://gerrit.cloudera.org:8080/19116


Change subject: WIP IMPALA-11536: fix invalid predicates propagate for outer 
join simplification
......................................................................

WIP IMPALA-11536: fix invalid predicates propagate for outer join simplification

When set ENABLE_OUTER_JOIN_TO_INNER_TRANSFORMATION = true, the planner
will simplify outer joins if the WHERE clause contains at least one
null rejecting condition and then will remove the outer-joined tuple id
from the map of GlobalState#outerJoinedTupleIds.
However, there may be false removals for right join simplification or
full join simplification. This may lead to incorrect results since it
is incorrect to propagate predicates into a plan subtree that is on the
nullable side of an outer join if the predicate is not null-rejecting
and determine whether it is a nullable side of an outer join according
to GlobalState#outerJoinedTupleIds.

E.g.
SELECT COUNT(*)
FROM functional.nullrows t1
  FULL JOIN functional.nullrows t2 ON t1.id = t2.id
  FULL JOIN functional.nullrows t3 ON coalesce(t1.id, t2.id) = t3.id
WHERE t1.group_str = 'a'
  AND coalesce(t2.group_str, 'f') = 'f'
The predicate coalesce(t2.group_str, 'f') = 'f' will propagate into t2
if we remove t2 from GlobalState#outerJoinedTupleIds.

Testing:
- Add new plan tests in outer-to-inner-joins.test
- Add new query tests to verify the correctness on transformation

Change-Id: I6565c5bff0d2f24f30118ba47a2583383e83fff7
---
M fe/src/main/java/org/apache/impala/analysis/Analyzer.java
M 
testdata/workloads/functional-planner/queries/PlannerTest/outer-to-inner-joins.test
M 
testdata/workloads/functional-query/queries/QueryTest/outer-to-inner-joins.test
3 files changed, 273 insertions(+), 4 deletions(-)



  git pull ssh://gerrit.cloudera.org:29418/Impala-ASF refs/changes/16/19116/4
--
To view, visit http://gerrit.cloudera.org:8080/19116
To unsubscribe, visit http://gerrit.cloudera.org:8080/settings

Gerrit-Project: Impala-ASF
Gerrit-Branch: master
Gerrit-MessageType: newchange
Gerrit-Change-Id: I6565c5bff0d2f24f30118ba47a2583383e83fff7
Gerrit-Change-Number: 19116
Gerrit-PatchSet: 4
Gerrit-Owner: Xianqing He <[email protected]>

Reply via email to