Repository navigation
feat(blob): support mixed v1 and v2 files - #9459
Merged
Merged
Conversation
Xuanwo
marked this pull request as ready for review
September 22, 2026 06:46
Contributor
There was a problem hiding this comment.
✅ Gate recommendation: approve.
Promoting the current snapshot on its first 2.2+ Blob file and normalizing legacy descriptors at the dataset boundary satisfies the mixed-version contract without rewriting historical payloads. Root field identity, historical snapshots, the dataset default file version, and original data files remain stable; the paired mixed-version feature flag fences incompatible readers and writers.
BubbleCal
approved these changes
Sep 22, 2026
wjones127
pushed a commit
that referenced
this pull request
Oct 6, 2026
Since #9459, create and append on file format 2.2+ accept legacy blob-marked binary input and convert it to Blob v2. Merge insert still compared the source schema strictly, so the input that created a table failed to upsert into it: "`blob` should have type struct but type was large_binary". With 2.2 now the default, this hits any table written from legacy blob input. The merge source checks now match legacy blob input to Blob v2 as append does, and the pre-write blob rewrite passes byte input through to the writer, which already converts it.
Xuanwo
pushed a commit
that referenced
this pull request
Nov 2, 2026
…tes (#10586) ## Problem Since Lance 13 (#9459), a commit that publishes a 2.2+ data file referencing a legacy blob column (`lance-encoding:blob` on a binary field) promotes that column to Blob v2 in the manifest. The dataset write path already converts legacy input to the Blob v2 layout at 2.2+, but `FragmentCreateBuilder::write` and `write_fragments` (pylance `LanceFragment.create`, Java `Fragment.create`), the `Updater` behind `add_columns`, `merge` and `update_columns`, `write_column_with_version` and the merge_insert partial path handed their schema to the file writer untouched. The 2.2 encoder accepts both layouts, so these paths wrote legacy pages into 2.2 files, which the promotion on commit then described as v2. Reads failed with `should contain 5 child data array(s), had 2` until #10454 taught the reader to detect legacy pages per column; the writers kept producing such files. ## Fix Every writer path now applies the dataset write policy: when the target file version is 2.2+, legacy blob fields are promoted with `promote_legacy_blob_schema` before the writer opens, and `open_writer` selects the Blob v2 writer whose `BlobPreprocessor` already accepts binary input. The single-fragment writer opens its writer through `versions::open_writer` instead of a raw `V2WriterAdapter`, `open_update_writer` promotes its write schema, and the overlay writer rejects legacy blob fields at 2.2+ because it writes single columns. The version rule lives in one exhaustive helper, `versions::writes_blob_v2`, and the three `WriteParams`-to-`WriterOptions` mappings collapse into `WriterOptions::from_params`. Data files record only the blob root field id, so the child ids assigned here need not match the ones the commit assigns, and files pinned to 2.1 keep the legacy layout as before. Tests: fragment writes (single and multi file) and `add_columns` at 2.2 assert that the new file's footer stores a Blob v2 descriptor struct.
Xuanwo
pushed a commit
that referenced
this pull request
Nov 2, 2026
…tes (#10586) Since Lance 13 (#9459), a commit that publishes a 2.2+ data file referencing a legacy blob column (`lance-encoding:blob` on a binary field) promotes that column to Blob v2 in the manifest. The dataset write path already converts legacy input to the Blob v2 layout at 2.2+, but `FragmentCreateBuilder::write` and `write_fragments` (pylance `LanceFragment.create`, Java `Fragment.create`), the `Updater` behind `add_columns`, `merge` and `update_columns`, `write_column_with_version` and the merge_insert partial path handed their schema to the file writer untouched. The 2.2 encoder accepts both layouts, so these paths wrote legacy pages into 2.2 files, which the promotion on commit then described as v2. Reads failed with `should contain 5 child data array(s), had 2` until #10454 taught the reader to detect legacy pages per column; the writers kept producing such files. Every writer path now applies the dataset write policy: when the target file version is 2.2+, legacy blob fields are promoted with `promote_legacy_blob_schema` before the writer opens, and `open_writer` selects the Blob v2 writer whose `BlobPreprocessor` already accepts binary input. The single-fragment writer opens its writer through `versions::open_writer` instead of a raw `V2WriterAdapter`, `open_update_writer` promotes its write schema, and the overlay writer rejects legacy blob fields at 2.2+ because it writes single columns. The version rule lives in one exhaustive helper, `versions::writes_blob_v2`, and the three `WriteParams`-to-`WriterOptions` mappings collapse into `WriterOptions::from_params`. Data files record only the blob root field id, so the child ids assigned here need not match the ones the commit assigns, and files pinned to 2.1 keep the legacy layout as before. Tests: fragment writes (single and multi file) and `add_columns` at 2.2 assert that the new file's footer stores a Blob v2 descriptor struct. (cherry picked from commit d2df9e5)
Xuanwo
added a commit
that referenced
this pull request
Nov 12, 2026
Complete the descriptor-transition contract from #9458 and #9459 with regression assertions for exact historical descriptors, an unchanged default storage version, and implicit-version compaction failing without committing a new snapshot. Remove the obsolete schema-transition discussion link while retaining the requirement to explicitly select `data_storage_version >= 2.2` for mixed-column Blob v2 compaction. Validation evidence for this unchanged patch contains five passing Rust behavior cases: all four mixed-version cases and the released legacy-fragment regression. Formatting and diff checks pass. Workspace Clippy and the targeted lance Clippy run are blocked by the existing `clippy::undocumented_unsafe_blocks` error at `rust/lance-encoding/src/data.rs:1200`; the separate fix is tracked in #10980 and is not duplicated here. Full workspace tests and Python bindings were not run. Closes #9458.
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.
Allow an existing 2.0/2.1 Blob column to accept 2.2+ files without rewriting its historical payloads. The target file version selects the encoding, using the existing mixed-data-file capability.
The first v2 file commit promotes the column's snapshot schema. Scans normalize older descriptors to v2 Inline descriptors, including scans restricted to old fragments; historical snapshots retain their original schema. The table's default file version remains unchanged, so v2 struct writes and v2 compaction require an explicit 2.2+ target.
Compatibility coverage uses legacy files generated by released Lance 8.0.0 and checks payloads, null/empty values, BlobFile and range reads, fragment selection, historical snapshots, and compaction while asserting that the original data files are unchanged.
Related to #9458, which tracks the user-visible descriptor schema transition.