feat(python): expose updated_fragment_offsets in the Update operation binding - #8447
Merged
Xuanwo merged 1 commit intoAug 10, 2026
Merged
Conversation
… binding Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
pengw0048
marked this pull request as ready for review
August 10, 2026 13:57
Contributor
There was a problem hiding this comment.
✅ Gate recommendation: approve.
This closes the Python transaction-binding gap at the existing wire boundary: populated offset bitmaps round-trip as compact portable bytes, absent legacy fields remain None, and malformed bytes fail with fragment context. Keeping raw bytes is preferable to expanding dense bitmaps into Python integers while the dedicated bitmap wrapper remains separate.
Contributor
|
@Xuanwo @pengw0048 I have a PR on the Java JNI side, can you please help review #6748? |
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.
Summary
Operation::Update.updated_fragment_offsets(#6650, #7432) is not reachable from Python: the Rust-to-Python export drops the field, and the Python-to-Rust conversion hardcodesNone. This PR wires the field through the Python bindings asdict[int, bytes].The bytes are the portable RoaringBitmap serialization, the same encoding as proto field 10 (#7432). This keeps dense offset sets compact and avoids materializing one Python int per matched row. A Python RoaringBitmap wrapper type (#7695) can replace the raw bytes later.
Changes
python/python/lance/dataset.py
updated_fragment_offsets: Optional[Dict[int, bytes]] = NonetoLanceOperation.Update, with attribute documentation.python/src/transaction.rs
RoaringBitmap::deserialize_from. Invalid bytes raiseValueError. A missing attribute (objects predating the field) extracts asNone.RoaringBitmap::serialize_intoand pass the resultingdict[int, bytes]to the dataclass.Test plan
test_update_with_commit_updated_fragment_offsets: commit anUpdatecarrying offsets for two fragments, read it back withread_transaction, and verify a byte-identical round trip through proto field 10.test_update_with_commit_rejects_invalid_offset_bytes: a commit with invalid bitmap bytes fails withValueError.