fix(index): preserve fts prewarm position codec#6485
Merged
Conversation
Xuanwo
approved these changes
Apr 11, 2026
Codecov Report❌ Patch coverage is
📢 Thoughts on this report? Let us know! |
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.
Bug Fix
What is the bug?
FTS v2 indices built with
with_position=truecan reconstruct cached posting lists with the wrong shared-position codec during prewarm. The prewarm path rebuildsPostingListvalues from projectedRecordBatchobjects and re-infers the positions codec from batch metadata, even though the reader has already resolved the correct partition-levelpositions_layout.What issues or incorrect behavior does the bug cause?
After
prewarm_index(..., with_position=True), phrase queries can fail even though the same query succeeds before prewarm. In practice this shows up as shared position stream decode failures in the cached path becausePackedDeltadata can be interpreted as the legacy codec.How does this PR fix the problem?
This PR threads
positions_layoutfromPostingListReaderthrough the prewarm reconstruction path intoCompressedPostingList::from_batch, so cached postings reuse the already-parsed shared-position codec instead of guessing from projected batch metadata. It also adds a regression test that covers the V2 + positions + tail-remainder case and verifies prewarm preserves correct phrase-query behavior.Validation
cargo test -p lance-index test_prewarm_with_ -- --nocapture