Merge ANTI JOIN should preserve unmatched NULL keys - #5242
Draft
bvolpato wants to merge 1 commit into
Draft
Conversation
bvolpato
force-pushed
the
bvolpato/fix-merge-anti-null-keys
branch
from
September 4, 2026 16:37
ca084e2 to
0c3d7fe
Compare
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.



Jira Link
Pending issue creation and linkage. This PR is a draft.
Changes Proposed
Enumerable merge ANTI joins currently stop processing left rows when they reach a NULL join key. Under strict equality, NULL keys do not match and those left rows must survive the ANTI join.
Preserve left NULL keys in all three merge-join advancement paths. Correct the existing ANTI test expectations and add repeated-NULL coverage. The tests also cover empty inputs, NULL keys on the right, and the overload with an additional predicate.
Reproduction
With ascending, NULLS LAST inputs, an equality ANTI join of left
[1, 2, NULL]and right[1]returns[2]. The correct result is[2, NULL]../gradlew :core:test --tests 'org.apache.calcite.runtime.EnumerablesTest'Validation
EnumerablesTestclass directly passes all 53 enabled tests; one existing test is disabled.[2, NULL]after the fix../gradlew autostyleApplyandgit diff --checkpass.mainwas blocked byjava.io.IOException: No space left on device; the full Gradle build has not been validated locally.