Skip to content

refactor: cowardly refuse to use scalar indexes on expressions with null literals#4815

Merged
westonpace merged 2 commits intolance-format:mainfrom
westonpace:refactor/avoid-scalar-index-nulls
Sep 25, 2025
Merged

refactor: cowardly refuse to use scalar indexes on expressions with null literals#4815
westonpace merged 2 commits intolance-format:mainfrom
westonpace:refactor/avoid-scalar-index-nulls

Conversation

@westonpace
Copy link
Copy Markdown
Member

The current search logic with scalar indexes assumes that the list returned by a scalar index contains either:

  • All the true rows and all other rows are false
  • All the false rows and all other rows are true

This is a problem when dealing with nulls. This is related to #4756

This PR doesn't fix #4756 however it does help avoid some areas where we are definitely likely to do the wrong thing.

expected: Option<IndexedExpression>,
optimize: bool,
) {
println!("Checking expression: {}", expr);
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should remove the println?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Whoops. Removed.

@codecov-commenter
Copy link
Copy Markdown

codecov-commenter commented Sep 25, 2025

Codecov Report

❌ Patch coverage is 94.64286% with 3 lines in your changes missing coverage. Please review.
✅ Project coverage is 80.88%. Comparing base (7624a7c) to head (fe50ca7).
⚠️ Report is 2 commits behind head on main.

Files with missing lines Patch % Lines
rust/lance-index/src/scalar/expression.rs 94.64% 2 Missing and 1 partial ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #4815      +/-   ##
==========================================
+ Coverage   80.87%   80.88%   +0.01%     
==========================================
  Files         328      328              
  Lines      129406   129461      +55     
  Branches   129406   129461      +55     
==========================================
+ Hits       104657   104718      +61     
+ Misses      21069    21065       -4     
+ Partials     3680     3678       -2     
Flag Coverage Δ
unittests 80.88% <94.64%> (+0.01%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@westonpace westonpace merged commit 432d91b into lance-format:main Sep 25, 2025
29 checks passed
jackye1995 pushed a commit to jackye1995/lance that referenced this pull request Jan 21, 2026
…ull literals (lance-format#4815)

The current search logic with scalar indexes assumes that the list
returned by a scalar index contains either:

* All the true rows and all other rows are false
* All the false rows and all other rows are true

This is a problem when dealing with nulls. This is related to
lance-format#4756

This PR doesn't fix lance-format#4756 however it does help avoid some areas where we
are definitely likely to do the wrong thing.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Scalar index queries handle NOT and NULL incorrectly

3 participants