fix(index): align row_range with partition_size for absent partitions - #9013
Open
LuciferYang wants to merge 2 commits into
Open
fix(index): align row_range with partition_size for absent partitions#9013LuciferYang wants to merge 2 commits into
LuciferYang wants to merge 2 commits into
Conversation
IvfModel::row_range indexed offsets and lengths directly, so a partition the model does not carry panicked. partition_size answers the same question for the same input and returns 0. Align row_range with it. I could not construct the panic through the public API: user-supplied partition ids are range-checked at load_partition, and the builder cannot emit a model whose num_partitions exceeds its offsets. This is a contract alignment between two neighbouring methods rather than a fix for a reachable failure.
Contributor
There was a problem hiding this comment.
✅ Gate recommendation: approve.
The prior finding is addressed: absent layout entries now produce a contextual error through the fallible range lookup, every production caller propagates it, and explicitly stored zero-length partitions retain their own offsets.
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.
Problem
IvfModel::row_rangeindexedoffsetsandlengthsdirectly, so a partition the model does not carry panicked.partition_sizeanswers the same question for the same input and returns 0.Fixes #9012.
What this changes
row_rangereturns an empty range wherepartition_sizereturns 0.Worth stating plainly: I could not construct the panic through the public API. User-supplied partition ids are range-checked at
load_partition, search-path ids come fromfind_partitionsover the centroids, and neither the builder nor the distributed merger can emit a model whosenum_partitions()exceeds itsoffsets. So this is a contract alignment between two neighbouring methods rather than a fix for a reachable failure, and it is fine to close as not worth it on those grounds.Test plan
test_row_range_out_of_range_is_emptybuilds a one-partition model and checks that partition 1 andusize::MAXgive an empty range and thatpartition_sizeagrees, then adds a zero-length partition to show a present-but-empty partition keeps its own offset and is still distinguishable from an absent one. Restoring the direct indexing makes it panic.cargo test -p lance-index --lib1231 passed, 3 ignoredcargo clippy --all --tests --benches -- -D warningscleancargo fmt --all --checkclean