Repository navigation
fix(blob): decode legacy blob pages in 2.2 files after promotion - #10454
Merged
Xuanwo merged 2 commits intoOct 30, 2026
Merged
Conversation
The single-fragment writers keep a legacy blob column in the legacy layout when they write a 2.2 file. Once a later commit promotes the column to Blob v2, the dataset adapter decoded those pages as v2 descriptors because it chose the layout by file version alone, and reads of the column failed. Decide per column instead: in a 2.2 file, a blob column whose pages use the blob page layout is read and normalized as legacy. 2.0 and 2.1 files keep the version rule.
Xuanwo
approved these changes
Oct 30, 2026
Xuanwo
left a comment
Member
There was a problem hiding this comment.
Approved on the integrated head. The reader decides legacy blob layout per 2.2 file column, and the released 12.0.0 fixture covers promotion, mixed layouts, scans, blob handles and ranges, compaction, and historical reads. Current-head CI and Gatekeeper checks pass.
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
) Fix reading legacy blob pages from 2.2 data files after the dataset schema promotes the column to Blob v2. The file adapter now detects the legacy page layout per column, normalizes those descriptors at the dataset boundary, and preserves mixed legacy and Blob v2 layouts in one file. Add a released 12.0.0 fixture that covers schema promotion, scans, blob handles and ranges, compaction, and historical version reads. (cherry picked from commit fb465bb)
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)
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.
FragmentCreateBuilder::writeandwrite_fragments, behind PythonLanceFragment.createand JavaFragment.write(), keep a legacy blob column in the legacy layout when they write a 2.2 file, and 2.2 is their default. Since 13.0.0, the next commit that keeps such a file (append, delete, update, an index or config change, a partial compaction) promotes the column to Blob v2, and reads of the column that reach the file fail:v2_adapterpicks the legacy descriptor layout by file version alone, so it decodes these pages as v2 descriptors. Tables that the 12.0.0 fragment writer produced this way break on their first commit under 13.0.0 or later.For 2.2 files the adapter now decides per column: a column whose pages use the blob page layout, which only the legacy encoder writes and which the decoder already dispatches on, is read and normalized as legacy. 2.0 and 2.1 files keep the current rule. Blob projections already open the reader with the full footer; it is now read once before the reader opens, so this adds no I/O.
Testing
test_released_legacy_blob_fragment_reads_after_promotionopens a table written by the 12.0.0 wheel (test_data/v12.0.0/blobs), deletes a row, and checks scans,take_blobs, blob ranges, compaction and the released version.test_read_legacy_and_v2_blob_layouts_from_one_filereads a 2.2 file that holds both layouts. Both fail on main with the error above.cargo test -p lance --release -- blob dataset::fragment legacy, with debug assertions on as in CIcargo fmt --all -- --check,cargo clippy --release --all --tests --benches -- -D warnings