Michael Smith has submitted this change and it was merged. ( 
http://gerrit.cloudera.org:8080/23962 )

Change subject: IMPALA-14714: Fix incorrect results for anti-join with constant 
ON clause predicates
......................................................................

IMPALA-14714: Fix incorrect results for anti-join with constant ON clause 
predicates

This patch fixes incorrect query results when using LEFT/RIGHT ANTI JOIN
with constant predicates in the ON clause (e.g., ON FALSE, ON NULL or ON TRUE).

Previously, constant anti-join predicates were incorrectly handled:
- They were marking the entire query as having an empty result set
- They were being assigned to scan nodes instead of join nodes
- They were being migrated into inline views incorrectly
- They were being pushed into the operands of a UNION/VALUES inline view
  on the preserved side of the anti-join, which emptied that input

The fix adds special handling for anti-join conjuncts to:
1. Skip them in markConstantConjunct() to avoid marking query as empty
2. Route constant ON clause predicates to canEvalOnClauseConjunct()
3. Ensure constant anti-join predicates are evaluated at join nodes
4. Prevent migration of anti-join predicates into inline views
5. Exclude anti-join conjuncts from the union-operand push-down in
   SingleNodePlanner.createUnionPlan(), so they stay unassigned and are
   evaluated at the anti-join node

Testing:
- Added test cases covering ON FALSE, ON TRUE, and mixed predicates for
  both LEFT and RIGHT ANTI JOIN
- Added test cases for constant UNION ALL inline views on the preserved
  side, covering ON FALSE, ON NULL, RIGHT ANTI JOIN and mixed predicates

Change-Id: I0e0f4a69263bb0ff11f421a1a340dffb904c6842
Reviewed-on: http://gerrit.cloudera.org:8080/23962
Reviewed-by: Impala Public Jenkins <[email protected]>
Tested-by: Michael Smith <[email protected]>
---
M fe/src/main/java/org/apache/impala/analysis/Analyzer.java
M fe/src/main/java/org/apache/impala/planner/SingleNodePlanner.java
M 
testdata/workloads/functional-planner/queries/PlannerTest/subquery-rewrite.test
M testdata/workloads/functional-query/queries/QueryTest/semi-joins.test
4 files changed, 284 insertions(+), 8 deletions(-)

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

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

Gerrit-Project: Impala-ASF
Gerrit-Branch: master
Gerrit-MessageType: merged
Gerrit-Change-Id: I0e0f4a69263bb0ff11f421a1a340dffb904c6842
Gerrit-Change-Number: 23962
Gerrit-PatchSet: 6
Gerrit-Owner: Yifan Zhang <[email protected]>
Gerrit-Reviewer: Aleksandr Efimov <[email protected]>
Gerrit-Reviewer: Csaba Ringhofer <[email protected]>
Gerrit-Reviewer: Impala Public Jenkins <[email protected]>
Gerrit-Reviewer: Michael Smith <[email protected]>
Gerrit-Reviewer: Steve Carlin <[email protected]>
Gerrit-Reviewer: Yifan Zhang <[email protected]>

Reply via email to