Repository navigation
Conversation
Signed-off-by: SIDDARTHA REDDY <[email protected]>
|
Friendly ping — would appreciate a review when possible. |
Signed-off-by: SIDDARTHA REDDY <[email protected]>
|
Pushed 9771a10: ran rustfmt on the blob_with_options signature in rust/lancedb/src/blob.rs (single line, as the Format Rust check requested). No logic change. The remaining rerun failures look unrelated to this PR: the cargo-deny job failed to install its pinned toolchain, and the Node 24 test failure was a single S3/DynamoDB integration test timing out (907 of 909 tests passed). |
geruh
left a comment
There was a problem hiding this comment.
Thanks for adding this @SIDDARTHAREDDY8! Did a pass
| inline_size_threshold: Optional[int] = None, | ||
| dedicated_size_threshold: Optional[int] = None, | ||
| pack_file_size_threshold: Optional[int] = None, | ||
| ) -> pa.Field: |
There was a problem hiding this comment.
nit: I need to try this, but should we put * before the three threshold arguments to make keyword only? seems like blob("payload", True, 8192) binds 8192 to inline_size_threshold.
| blob_type = _resolve_blob_type() | ||
| return pa.field(name, blob_type(), nullable=nullable) | ||
| try: | ||
| from lance import blob_field |
There was a problem hiding this comment.
nit: this file already imports importlib for the optional lance dependency. wdyt about using that for the import like importlib.import_module("lance") or pssing in directly lance.blob_field like the others.
| raise ValueError( | ||
| "Setting blob tier thresholds requires pylance to be installed" | ||
| ) from err | ||
| return blob_field( |
There was a problem hiding this comment.
Can we keep the _resolve_blob_type() check here? This path skips the existing check for conflicting extension registrations.
| /// [`lance::blob::blob_field_with_options`] builds them. Note that lance does | ||
| /// not currently expose a pack file size threshold option, so only the inline | ||
| /// and dedicated size thresholds are supported here. | ||
| pub use lance::blob::BlobFieldOptions as BlobOptions; |
There was a problem hiding this comment.
Python supports all three thresholds, but Rust only exposes two. Should we keep our own BlobOptions and store the pack threshold in field metadata?
…keep registration check Signed-off-by: SIDDARTHA REDDY <[email protected]>
|
Thanks for the pass. Pushed f461aba addressing the three Python points: the three thresholds are now keyword-only (so blob("payload", True, 8192) no longer binds positionally), the threshold path now loads lance via importlib.import_module("lance") like the rest of the file, and it calls _resolve_blob_type() before delegating to lance.blob_field so the conflicting-registration check is no longer skipped. The check runs after the import, so the missing-pylance path still raises before any fallback registration. Local verification is py_compile only (no pyarrow on my box); CI will run the blob tests. On the Rust point: lance BlobFieldOptions has no pack threshold field, so keeping our own BlobOptions and storing the pack threshold in field metadata would mean defining that metadata format on our side. Happy to do that if that is the direction you want; otherwise I can leave Rust at the two thresholds lance supports and say so in the doc comment. Which do you prefer? |
There was a problem hiding this comment.
✅ Gate recommendation: approve.
The author's update is verified: thresholds are keyword-only, the optional import uses importlib, and threshold calls now reject competing Arrow registrations. Metadata and validation still delegate to Lance; focused tests cover these paths, unchanged defaults, and missing-pylance behavior. This preserves the field-builder solution to #4285, with the prior create/write/read evidence still applicable.
For Rust, keep the upstream options alias and its already documented two-threshold scope. Lance already defines the pack-file metadata key; extending Lance's builder is a simpler future path to parity than maintaining a separate options type here.
Closes #4285.
What changed
Python (
python/python/lancedb/schema.py):lancedb.blob()now accepts optionalinline_size_threshold,dedicated_size_threshold, andpack_file_size_thresholdkeyword arguments, forwarded tolance.blob_field(which validates them and stores them aslance-encoding:blob-*-thresholdfield metadata). When all thresholds are omitted the behavior is unchanged, including the no-pylance fallback type. Setting a threshold without pylance installed raises a clear error instead of silently writing unvalidated metadata.Rust (
rust/lancedb/src/blob.rs): addedblob_with_options(name, nullable, options)plusBlobOptions(a re-export oflance::blob::BlobFieldOptions, so thresholds are built exactly the way lance builds them). WithBlobOptions::default()the result is identical toblob(). Note: lance's Rust API at the pinned version (v13.0.0-beta.12) exposes only the inline and dedicated size thresholds, so there is no pack-file-size-threshold option on the Rust side yet.Tests
python/python/tests/test_blob.py: thresholds land in field metadata, defaults carry no threshold metadata, invalid values raiseValueError/TypeError.rust/lancedb/src/blob.rs(metadata assertions, default-options equivalence). Not compiled locally (no Rust toolchain in this environment); please rely on CI for the Rust build.Note: this PR was drafted with AI assistance; I reviewed and tested the changes.