Repository navigation
fix: support boolean predicates in scalar segment scans #93
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
yanghua
merged 3 commits into
lance-format:main
from
Gabriel39:fix/scalar-segment-expressions
Sep 30, 2026
+736
−36
Merged
Changes from all commits
Commits
Show all changes
3 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
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
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
Oops, something went wrong.
Oops, something went wrong.
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Negated
IS TRUEandIS FALSEsilently omit matching NULL rows through this newly enabled NOT branch. The pinned Lance planner representskey IS TRUEaskey = true, so it reports NULL rows as SQL NULL instead of FALSE. Negation then excludes those rows from the candidate mask. Reapplying the complete filter cannot recover rows already excluded. Both BTree and Bitmap segments fail, with and without stable row IDs; the base implementation instead takes the correct scoped fallback for these predicates.Preserve the scoped fallback for affected predicates until the planner repair is available, and cover both negated boolean tests on nullable columns.
Reproducer
Add this test to
tests/c_api_test.rs, using its existing fixture helpers:Run
cargo test --locked --test c_api_test gate_scalar_segment_not_is_true_keeps_nulls. On this head, the assertion fails with actual IDs[2, 3, 6]instead of[0, 2, 3, 4, 6]; the missing IDs are the NULL rows. A scan with scalar indices disabled returns the expected IDs.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixed in 78626b1. I reproduced the missing NULL rows, then added a conservative guard on the original filter expression before scalar planning. Filters containing IS [NOT] TRUE/FALSE now retain the complete scoped scan, with scalar_segment_fallback_boolean_truth_test=1 and no segment search. The guard stays in place until the dependency includes lance-format/lance#9568; ordinary NOT over equality remains accelerated. Regressions cover BTree/Bitmap with and without stable row IDs, both negated truth tests, positive truth tests, nested AND/OR, fragment boundaries, and LIMIT/OFFSET. Validation: 455 Rust tests and all 3 native C/C++ integration tests passed, plus formatting, cargo check, and Clippy.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixed in 78626b1: the original filter is checked before scalar planning, so boolean truth tests retain the complete scoped scan and matching NULL rows. Verified BTree/Bitmap with and without stable row IDs, nested predicates, fragment scope and pagination; ordinary
NOT (key = true)still uses segment search.