feat: add snapshot-level field assignment tracking - #8531
Closed
Xuanwo wants to merge 7 commits into
Closed
Conversation
Contributor
|
Important This PR touches the Lance format specification. Substantive changes to the format specification — the If this is a meaningful format change:
|
Codecov Report✅ All modified and coverable lines are covered by tests. 📢 Thoughts on this report? Let us know! |
Collaborator
Author
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.
Why
Lance needs a snapshot-level primitive that records whether each logical field has been successfully written for each row. Applications currently have to materialize and maintain a separate Boolean state column, which couples assignment semantics to user data and requires independent index maintenance.
This implements the contract accepted in Discussion #8520. Assignment is bound to stable field IDs; explicit NULL writes are assigned, omitted fields are unassigned, explicit invalidation clears assignment atomically, and physical rewrites preserve rather than create assignment. Ordinary projection continues to return stored Arrow values, while
is_assigned(field)is a non-null Boolean expression across projection, filtering, aggregation, ordering, DataFusion, and the Lance Substrait extension.The implementation keeps this as a Lance storage/query/mutation primitive. It does not add computed-column dependencies, provenance, jobs, or scheduling semantics.
Compatibility
Tracked snapshots require FieldAssignment reader and writer feature support, so released implementations that do not understand the format fail closed. On the final PR head, the current writer opened the measured S3 snapshot at version 7 before and after the compatibility probe, while Lance 10.0.0 rejected the same snapshot with unsupported feature flag 256. Queries that do not reference
is_assignedbypass assignment binding and do not load assignment state.Validation
The final head passes the 20-test FieldAssignment integration suite, the ordinary-scan binding fast-path regression, the exact all-feature/all-target Clippy command used by CI, and the Java
VectorIndexTestsuite with the default 1 MiB JVM native stack. The PR's Java 11/17/21/25, Python, Rust coverage, Windows, rustdoc, MSRV, format, and Clippy jobs have also passed.Performance evidence
This is not a before/after comparison with an existing equivalent feature. It compares the new FieldAssignment primitive with the closest application-managed representation: a materialized
assigned_state: boolcolumn plus a LanceBITMAPscalar index. Boolean mutation timings include the required index catch-up.Both variants were measured at exact PR head
ee730236cf7896e19e972cd5497787628fbd213eon the same retainedc7i.4xlargeEC2 instance, using 10,000,000 identical rows, 100 initial fragments, concurrency 8, seven query repeats, and three mutation/compaction repeats. Local FS and S3 used the same parameters; Local cold runs dropped the Linux page cache.Representative medians (seconds):
Each full storage run contains 108 measurements and 27 integrity records with no mismatches. Every FieldAssignment filter plan used exact row-selection pushdown, and both variants scanned 10,000 of 10,000,000 rows. All 14 S3 FieldAssignment planner samples recorded zero assignment I/O and zero host-network delta. S3 warm-filter p95 was 0.411 seconds for FieldAssignment versus 0.398 seconds for the Boolean baseline.
The trade-off is metadata and write amplification. FieldAssignment-managed objects occupy 24,596 bytes versus 1,714 bytes for the Boolean index, while total incremental setup storage is 3,349,314 bytes versus 1,309,678 bytes on S3. Sparse assignment write amplification is 9.44x versus 6.29x; invalidation is 118.66x versus 86.80x. In this workload, avoiding separate index maintenance still yields lower end-to-end mutation and compaction latency.
The reproducible harness, checksums, exact commands, machine inventory, and machine-readable Local FS/S3 results are retained outside this project repository in the task-specific private personal repository
Xuanwo/lance-field-assignment-benchmarkat signed commit7d219949e6aa54270c7932e302096741a0e0fc1b.