refactor: align blob behavior that write via file format version, read via layout#5752
refactor: align blob behavior that write via file format version, read via layout#5752
Conversation
PR ReviewSummaryThis PR ensures that when blob v2 is enabled (file version >= 2.2), all blob-marked fields use the v2 encoder regardless of their input type (Binary/LargeBinary or Struct). The key addition is a Critical Issues (P0)1. Potential panic from unchecked cast operations // blob.rs:455-457
let data_col = data_col.as_binary::<i64>();
let uri_col = uri_col.as_string::<i32>();Consider using Moderate Issues (P1)2. Missing unit tests for
3. Test assertion may be fragile assert_eq!(struct_arr.fields()[0].name(), "kind");
assert_eq!(struct_arr.fields()[1].name(), "position");Consider using |
Codecov Report❌ Patch coverage is 📢 Thoughts on this report? Let us know! |
westonpace
left a comment
There was a problem hiding this comment.
I think my initial question is why a user will specify v1 or v2?
| data_storage_version: Optional[ | ||
| Literal["stable", "2.0", "2.1", "2.2", "next", "legacy", "0.1"] | ||
| ] = None, | ||
| blob_version: Optional[Literal["v1", "v2"]] = None, |
There was a problem hiding this comment.
We should document this parameter. Make sure to clearly specify when a user would choose v1. Is it only if they need backwards compatibility with a legacy software? Are there any good reasons a user would choose v1?
| } | ||
| } | ||
|
|
||
| fn normalize_blob_v2_input(array: ArrayRef) -> Result<StructArray> { |
There was a problem hiding this comment.
Can you drop a short comment explaining what this function is doing?
The original idea is to allow users to continue using blob v1 even after a new file version has been released. What do you think? Perhaps it would be better to require users to enable blob v2 on new datasets created by newer versions? |
westonpace
left a comment
There was a problem hiding this comment.
Looks nice, thanks for bearing with the reviews!
|
"index::vector::ivf::v2::tests::test_build_ivf_pq_4bit::case_3" is known to be a flaky test, just skip. |
…d via layout (lance-format#5752) This PR fixes a bug where users could encode blob v1 even when blob v2 was enabled. However, our decoder only reads the dataset's configuration `lance.blob.version`, which can lead to decoding issues. In this PR, we changed the following: - During write operations, we determine which blob layout to use based on file format version. - During read operations, we decide which blob layout to decode based on its physical layout. --- **Parts of this PR were drafted with assistance from Codex (with `gpt-5.2`) and fully reviewed and edited by me. I take full responsibility for all changes.**
This PR fixes a bug where users could encode blob v1 even when blob v2 was enabled. However, our decoder only reads the dataset's configuration
lance.blob.version, which can lead to decoding issues.In this PR, we changed the following:
Parts of this PR were drafted with assistance from Codex (with
gpt-5.2) and fully reviewed and edited by me. I take full responsibility for all changes.