Repository navigation
Conversation
Blob v2 is supported only under Struct, List and LargeList: the write preprocessor, external URI checks, legacy page normalization, materialization, Managed reference scans and clone walk no other container. Schema promotion still recurses into every child, so since fragment and update writes promote legacy blob input at 2.2+, a legacy blob inside a Map or FixedSizeList<Struct> became a Blob v2 field whose array the preprocessor passed through untouched, and the writer failed with an opaque FieldTypeMismatch. Native logical Blob v2 input in those containers passed through too and failed in the encoder, which expects the prepared layout; prepared input passed through unchecked. BlobPreprocessField::new, which every 2.2+ data file writer goes through, now returns NotSupported naming the container field when a Map or FixedSizeList holds a Blob v2 field.
| // 2.2+ data file writer prepares its input here, so reject the column up front | ||
| // rather than let the writer fail on an unprepared array or commit a | ||
| // column the rest of the format cannot read. | ||
| let container = match field.data_type() { |
There was a problem hiding this comment.
I tried this with a schema only add, and it looks like we can still add a Map or FixedSizeList with a blob on 2.2+, but can't write to it afterward. Maybe we can enforce this at schema commit side, and we'd still need to allow legacy blobs on 2.1.
WDYT?
| #[case::map(true)] | ||
| #[case::fixed_size_list(false)] | ||
| #[tokio::test] | ||
| async fn test_legacy_blob_in_map_or_fixed_size_list_is_rejected_at_v2_2(#[case] map: bool) { |
There was a problem hiding this comment.
Have you tested the prepared blob v2 logic? Lets add a test for that
|
|
||
| /// Blob v2 nests only in Struct and List, so legacy blob input in a Map or | ||
| /// FixedSizeList, which 2.2 promotes to Blob v2, is rejected as unsupported | ||
| /// instead of failing on the unprepared array. |
There was a problem hiding this comment.
nit: we can make this logic a little more self documenting, and drop this comment
| } | ||
| } | ||
|
|
||
| // Blob v2 nests only in Struct and List: the readers, the external URI |
There was a problem hiding this comment.
nit: this comment can be trimmed down maybe to something like:
// Blob v2 readers only support nesting under Struct, List, and LargeList.
| { | ||
| return Err(Error::not_supported(format!( | ||
| "Blob v2 fields nested in {container} field '{}' are not supported; Blob v2 can be nested only in Struct, List and LargeList (legacy blob input is stored as Blob v2 from file version 2.2)", | ||
| field.name() |
There was a problem hiding this comment.
Maybe we can cleanup and shorten this error? I don't think we need to explain legacy blob promotion here. Just saying which nesting types are supported should be enough.
The write-time check only runs when a data file is written, so schema changes that write none, such as add_columns with AllNulls or an empty Dataset::write, still committed a blob nested in a Map or FixedSizeList on a 2.2+ table, and every later write to that column failed. The rule now lives in Schema::check_blob_nesting. The Blob v2 writer calls it as before, and the manifest build calls it on the final schema, which covers Overwrite, Merge and Project schemas and the commit-time promotion of legacy blobs. At commit a blob is rejected if it is Blob v2 or the table stores 2.2+ files, so legacy blobs in 2.1 tables stay allowed. Fields the parent manifest already rejected under the same rule are skipped, so a table that already holds one can still commit and drop it. The error no longer explains legacy blob promotion, and the fragment write test gains a prepared descriptor case.
The commit-time exemption looked up the parent field by id and only asked whether the parent table stored 2.2+ files, which holds for any field there. A table without non-reusable field ids restarts ids on Overwrite, so an empty overwrite to a schema with a Blob v2 in a Map passed whenever the nested blob's id matched any old column, and every later write to that column failed. An Overwrite defines a new table, so its schema is now checked in full. Other operations keep a field only if the parent schema already held it as a blob nested in a Map or FixedSizeList under the same rule. The tests collapse into one that covers the writer for legacy and prepared input, a schema-only add, the empty overwrite, and a legacy blob that stays allowed in a 2.1 table.
A field metadata update could mark a field nested in a Map as a blob after the commit-time check had run, publishing a schema no writer accepts. Run the check on the final schema. Also recognize Map and FixedSizeList by logical type instead of rebuilding the Arrow type of every subtree.
|
Thanks @geruh, all addressed:
|
| ConcreteFileVersion::V2_2 | ConcreteFileVersion::V2_3 | ||
| ) | ||
| }; | ||
| let already_nested = |field: &lance_core::datatypes::Field| { |
There was a problem hiding this comment.
nit: Is already_nested running check_blob_nesting on the previous schema for each field? Looks like that is validating through the whole schema each time. Could we just collect the fields and compare?
geruh
left a comment
There was a problem hiding this comment.
LGTM, just left one nit fine to ignore!
The commit check walked the parent schema again for every nested blob it found, through `check_blob_nesting(..).is_err()` used as a predicate. `Schema::nested_blob_fields` now lists the blobs nested in a Map or FixedSizeList, and the commit collects the ids the parent schema already nests this way into a set once, then compares.
Thanks a lot for all your help! changed. |
There was a problem hiding this comment.
✅ Gate recommendation: approve.
Shared write and commit checks reject unsupported Blob v2 nesting while preserving legacy 2.1 behavior and recovery for existing unsupported schemas. The added regression coverage checks FixedSizeList diagnostics and confirms that rejected metadata updates leave the published dataset unchanged. No blocking findings.
Xuanwo
left a comment
There was a problem hiding this comment.
Reviewed the integrated head, including the shared writer/commit guard, public API documentation, and Map/FixedSizeList regression coverage. Current-head CI and Gatekeeper are green; no blocking findings.
Blob v2 is supported only under Struct, List and LargeList: the write preprocessor, external URI checks, legacy page normalization, materialization, Managed reference scans and clone walk no other container. Schema promotion still recurses into every child, so since fragment and update writes promote legacy blob input at 2.2+, a legacy blob inside a Map or FixedSizeList became a Blob v2 field whose array the preprocessor passed through untouched, and the writer failed with an opaque FieldTypeMismatch. Native logical Blob v2 input in those containers passed through too and failed in the encoder, which expects the prepared layout; prepared input passed through unchecked.
BlobPreprocessField::new, which every 2.2+ data file writer goes through, now returns NotSupported naming the container field when a Map or FixedSizeList holds a Blob v2 field.