test: characterize correlated NOT IN null-aware behaviour - #25558
Merged
Merged
Conversation
Adds sqllogictest and benchmark coverage for correlated `NOT IN`, pinned to what DataFusion does today. Several of these expectations are wrong, and a few shapes do not plan at all; each such block carries a note and a link to apache#25336. The fixes flip them, so the flip is visible in those diffs rather than buried in a large change. sqllogictest, in `null_aware_anti_join.slt` and `null_aware_mark_join.slt`: - correlated `NOT IN` with a non-equality correlation, which stays a residual join filter; - a correlation that names only outer columns, so it cannot become an equi-join key; - a constant value expression with and without a correlation; - a subquery inside the `IN` value, both spellings of the outer `IN`; - `IS NOT NULL` over a subquery predicate and a comparison between two marks, the contexts that can tell a NULL mark from a FALSE mark; - plan pins for the joins the planner chooses in each case. Benchmarks: - Q09, a correlated non-negated `IN`. It must not use a null-aware join, a direction none of Q01-Q08 covers, and it passes today; - correctness canaries on Q05-Q08, each comparing the `NOT IN` result with a reference that does not use `NOT IN`. All four currently disagree, so they are pinned to `false`. Expected results verified with DuckDB and PostgreSQL. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
xudong963
approved these changes
Sep 21, 2026
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #25558 +/- ##
==========================================
- Coverage 82.42% 82.41% -0.01%
==========================================
Files 1138 1138
Lines 435429 435429
Branches 435429 435429
==========================================
- Hits 358889 358875 -14
- Misses 54839 54848 +9
- Partials 21701 21706 +5 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
Contributor
Author
|
Thanks @xudong963 |
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.
Which issue does this PR close?
Rationale for this change
Correlated
NOT INreturns wrong results in several shapes, and a few do not plan at all. The fixes span two layers — the hash join executor and decorrelation — and touch different shapes. Landing the coverage first, pinned to what DataFusion does today, makes each fix's diff show exactly which behaviour it changes instead of burying the flips in a large change.Nothing here changes behaviour. Every expectation is what
mainproduces right now, and the wrong ones carry a note and a link to the issue.Concretely, this is wrong today (DuckDB 1.5.2 and PostgreSQL 17.11 both return three rows):
What changes are included in this PR?
sqllogictest, in
null_aware_anti_join.sltandnull_aware_mark_join.slt:NOT INwith a non-equality correlation, which stays a residual join filter;INvalue, both spellings of the outerIN;IS NOT NULLover a subquery predicate, and a comparison between two marks — the contexts that can tell a NULL mark from a FALSE mark;Benchmarks:
IN. It must not use a null-aware join. Q01–Q08 all cover the direction where null-awareness is required, so a regression that adds it where it is not needed is invisible to them. Q09 passes today.NOT INresult against a reference that does not useNOT IN. All four disagree today, so they are pinned tofalse.What is the testing strategy for this PR?
This PR is tests. Expected results were verified against DuckDB 1.5.2 and PostgreSQL 17.11. The whole suite is green on
main, including all nine benchmarks.Are there any user-facing changes?
No.
🤖 Generated with Claude Code