fix: bitmap iterator exhaustion in mask_to_offset_ranges#6046
fix: bitmap iterator exhaustion in mask_to_offset_ranges#6046Xuanwo merged 5 commits intolance-format:mainfrom
Conversation
…egment sequences In mask_to_offset_ranges, the RangeWithBitmap case advanced the bitmap iterator using a global offset (addr - range.start + offset_start) instead of a range-local position (addr - range.start). When a RangeWithBitmap segment appeared after other segments (offset_start > 0), the iterator was advanced past its end, causing a panic. The fix separates range-local iteration from the final offset calculation: iterate the bitmap using position_in_range, then add offset_start at the end. Includes an integration test that reproduces the panic through the user-facing API: write 2 fragments with stable row IDs, delete some rows, compact, create a BTree index, then run a filtered scan. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
ReviewClean, correct fix. No P0/P1 issues. The bitmap in Test coverage is good — the integration test reproduces the exact multi-segment scenario through the public API. LGTM. |
Codecov Report✅ All modified and coverable lines are covered by tests. 📢 Thoughts on this report? Let us know! |
Xuanwo
left a comment
There was a problem hiding this comment.
Thank you for working on this!
…s-panic Amp-Thread-ID: https://ampcode.com/threads/T-019cc1ba-6e5b-74ca-979a-34ab5be8fd84 Co-authored-by: Amp <amp@ampcode.com> # Conflicts: # rust/lance/tests/query/primitives.rs
Amp-Thread-ID: https://ampcode.com/threads/T-019cc1ba-6e5b-74ca-979a-34ab5be8fd84 Co-authored-by: Amp <amp@ampcode.com>
Amp-Thread-ID: https://ampcode.com/threads/T-019cc1ba-6e5b-74ca-979a-34ab5be8fd84 Co-authored-by: Amp <amp@ampcode.com>
In mask_to_offset_ranges, the RangeWithBitmap case advanced the bitmap iterator using a global offset (addr - range.start + offset_start) instead of a range-local position (addr - range.start). When a RangeWithBitmap segment appeared after other segments (offset_start > 0), the iterator was advanced past its end, causing a panic.
The fix separates range-local iteration from the final offset calculation: iterate the bitmap using position_in_range, then add offset_start at the end.
Includes an integration test that reproduces the panic through the user-facing API: write 2 fragments with stable row IDs, delete some rows, compact, create a BTree index, then run a filtered scan.