HIVE-29290: Wrong results when n-way join contains both anti and outer join #6173
+281
−2
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.



What changes were proposed in this pull request?
The
CommonJoinOperatorimplements several types of joins: inner, outer, and anti joins. It also supports binary and n-way joins, and combinations of these. The operator fetches and buffers rows from each join input. After the required input rows are present, the operator constructs the joined rows and forwards them. In the case of an anti join, a joined row is forwarded when the right input is empty. For binary joins this logic is already present. For n-way joins the logic works only when none of the other joins are outer joins.This pull request extends support for anti joins mixed with outer joins.
Why are the changes needed?
The current implementation does not recognize when an n-way join contains both anti and outer joins; it therefore constructs and forwards rows even if the right side of an anti join has rows, which leads to incorrect results.
Does this PR introduce any user-facing change?
No.
How was this patch tested?