Skip to content

fix(index): use zone map index for IS NOT NULL predicates - #8088

Open
westonpace wants to merge 2 commits into
lance-format:mainfrom
westonpace:fix/not-null-index-search
Open

fix(index): use zone map index for IS NOT NULL predicates#8088
westonpace wants to merge 2 commits into
lance-format:mainfrom
westonpace:fix/not-null-index-search

Conversation

@westonpace

Copy link
Copy Markdown
Member

We recently started tracking null bitmaps in the zone map index so we can give an exact answer to IS NULL queries.

We have a failsafe in query planning that disables NOT <index-search> for an inexact index since the result will most likely be a small AtLeast result which will not meaningfully speed up the query and may slow it down slightly by wasting time on an index search.

Unfortunately, we have to make this failsafe at planning time, so we haven't loaded the index yet, and so we don't know if a zonemap is new enough to handle exact nulls.

This PR adds a flag to the zone map details recording whether or not we have a null bitmap. We then use that at planning time to determine if we need to recheck on is null queries or not.

Zone maps track exact null row addresses via a null bitmap, so IS NULL
is an exact query. Allow SargableQueryParser to distinguish IS NULL
exactness from range/equality exactness via a new is_null_needs_recheck
field and with_exact_null_tracking() builder. Persist has_null_bitmap in
ZoneMapIndexDetails proto so new_query_parser can enable this at plan
time, allowing maybe_not() to succeed for IS NOT NULL on modern zone maps.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@github-actions

Copy link
Copy Markdown
Contributor

Important

This PR touches the Lance format specification.

Substantive changes to the format specification — the .proto definitions
and the spec docs under docs/src/format/ — require a PMC vote before merge.
Minor edits such as typo fixes, wording, or formatting are excluded; use your
judgment.

If this is a meaningful format change:

  • Start a vote following the Lance community voting process.
    Format specification modifications need 3 binding +1 votes (excluding the
    proposer), held on GitHub Discussions, with a minimum voting period of 1 week.
  • Once the vote passes, link the completed vote in this PR. It should not be
    merged until the vote is linked.

@github-actions github-actions Bot added A-index Vector index, linalg, tokenizer A-format On-disk format: protos and format spec docs bug Something isn't working labels Jul 29, 2026
@codecov

codecov Bot commented Jul 29, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 94.44444% with 1 line in your changes missing coverage. Please review.

Files with missing lines Patch % Lines
rust/lance-index/src/scalar/zonemap.rs 91.66% 1 Missing ⚠️

📢 Thoughts on this report? Let us know!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

A-format On-disk format: protos and format spec docs A-index Vector index, linalg, tokenizer bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant