Use SQL null semantics for DuckDB IN and NOT IN pushdown - #10054
Draft
robert3005 wants to merge 3 commits into
Draft
robert3005 wants to merge 3 commits into
robert3005 wants to merge 3 commits into
Conversation
robert3005
added this pull request to stack #10055
September 25, 2026 13:56
This was referenced Sep 25, 2026
Merging this PR will not alter performance
|
robert3005
removed this pull request from stack #10055
September 25, 2026 14:05
robert3005
force-pushed
the
rk/duckdb-list-contains
branch
from
September 25, 2026 14:06
7f7f687 to
29fa2b0
Compare
robert3005
added this pull request to stack #10058
September 25, 2026 14:06
robert3005
removed this pull request from stack #10058
September 25, 2026 14:09
robert3005
added this pull request to stack #10061
September 25, 2026 14:09
robert3005
force-pushed
the
rk/duckdb-list-contains
branch
from
September 25, 2026 14:09
29fa2b0 to
adc15ee
Compare
robert3005
force-pushed
the
rk/duckdb-list-contains
branch
from
September 25, 2026 15:53
adc15ee to
2535299
Compare
robert3005
force-pushed
the
rk/duckdb-list-contains
branch
from
September 25, 2026 16:28
2535299 to
cafd7d2
Compare
robert3005
force-pushed
the
rk/duckdb-list-contains
branch
2 times, most recently
from
September 25, 2026 17:26
04bd414 to
459162a
Compare
robert3005
force-pushed
the
rk/duckdb-list-contains
branch
2 times, most recently
from
September 28, 2026 20:43
c0e6065 to
843d57c
Compare
robert3005
commented
Sep 28, 2026
| ) { | ||
| let mut children = op.children(); | ||
| return children.next().is_some_and(can_push_expression) | ||
| && children.all(|child| matches!(child.as_class(), Some(BoundConstant(_)))); |
Contributor
Author
There was a problem hiding this comment.
this seems stricter than before
robert3005
commented
Sep 28, 2026
| TableFilterClass::InFilter(values) => { | ||
| // TODO(ngates): I'm pretty sure we actually need this as ScalarValue with the | ||
| // scope dtype | ||
| let scalars: Vec<_> = values.iter().map(Scalar::try_from).try_collect()?; |
Contributor
Author
There was a problem hiding this comment.
we should remove this
Convert both IN table filters and bound membership expressions through in_list, so a null set element leaves nonmatches unknown. Decline nonconstant lists instead of promising conversion and failing later. Add scan-result and EXPLAIN regressions for nullable sets, views, large constant lists, and fallback for nonconstant list elements. Signed-off-by: Robert Kruszewski <github@robertk.io>
Signed-off-by: Robert Kruszewski <github@robertk.io>
Signed-off-by: Robert Kruszewski <github@robertk.io>
robert3005
force-pushed
the
rk/duckdb-list-contains
branch
from
September 29, 2026 19:13
843d57c to
e4b6598
Compare
This branch has not been deployed
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.
Summary
DuckDB membership pushdown used Vortex's default null rules, which can make a nonmatch in
NOT IN (1, NULL)true. Use SQL null semantics so that result remains unknown and the row is excluded.Stacked on #10053; uses SQL null semantics from #10057 and membership optimizations from #10052.
Changes
IN/NOT INexpressions andINtable filters throughin_list.EXPLAINregressions for null elements in either position, nullable needles, negation, scans through views, and a 1,000-element set. Add a nonconstant-list fallback regression.Validation:
cargo clippy -p vortex-duckdb --all-targets --all-features -- -D warningspassed on this branch. Runtime tests were not executed.