-
Notifications
You must be signed in to change notification settings - Fork 530
refactor: align blob behavior that write via lance.blob.version, read via layout #5752
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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 project(struct_array: &StructArray, fields: &Fields) -> Result<StructArray> { | ||
| if struct_array.fields().len() != struct_array.columns().len() { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
How do we get an Arrow array that is invalid like this?
| } | ||
| } | ||
|
|
||
| fn normalize_blob_v2_input(array: ArrayRef) -> Result<StructArray> { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you drop a short comment explaining what this function is doing?
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:
lance.blob.version(aka the user's BlobVersion).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.