Repository navigation
feat(blob): read blobs from explicitly opened handles - #10171
Merged
Xuanwo merged 7 commits intoNov 13, 2026
Merged
Conversation
`read_blobs` and `read_blob_ranges` take the blob column's descriptors
from the dataset on every execution before they can read payloads. On
object storage that is a separate request the payload reads wait for. A
`BlobFile` from `take_blobs` already holds its descriptor, but reading
through handles meant one `BlobFile` call at a time, outside the planner.
Add `Dataset::read_blob_files` (whole blobs) and
`Dataset::read_blob_file_ranges` (blob-local ranges), backed by a new
`ReadBlobFilesBuilder`. Handles become planner entries directly, so the
read issues only payload requests, grouped by backing object, coalesced
across handles and batched by the I/O buffer like the row selectors.
`None` (a null blob from `take_blobs`) yields `data: None`. Results are
`ReadBlobFile { request_index, data }` because a null handle has no row
address to report. Ranges are checked against handle sizes and closed
handles are rejected before any I/O. Handles are not checked against the
builder's dataset or version: they name immutable files, so they keep
returning the bytes of the version they were taken from.
The three builders now share one plan/execute/totalize helper.
Refs lance-format#6178
Co-Authored-By: Claude Opus 5.5 <[email protected]>
Expose `Dataset.read_blob_files(blob_files)` and `Dataset.read_blob_file_ranges(requests)`, thin wrappers over the Rust `read_blob_files` / `read_blob_file_ranges` builders. They take the `BlobFile` handles returned by `take_blobs` (or `None` for null blobs) and return one `(request_index, data)` pair per request, accepting the same `io_buffer_size` and `preserve_order` options as `read_blobs`. Callers that read the same blobs repeatedly, such as Zarr shard reads that fetch an index and then chunk ranges, can take handles once and skip the descriptor request `read_blobs` and `read_blob_ranges` issue on every call. Refs lance-format#6178 Co-Authored-By: Claude Opus 5.5 <[email protected]>
Xuanwo
marked this pull request as ready for review
November 12, 2026 08:17
Xuanwo
added a commit
that referenced
this pull request
Nov 12, 2026
Controlled services need to reject stored External Blob references outside registered storage bases before URI resolution or size probing, while immutable payload caches must not return stale External data. Add an opt-in Session policy for unregistered External reads and logical reference writes. Embedded sessions retain the existing Allow default. Provider filtering removes selected schemes and clears cached bindings; it does not revoke previously issued handles. Policy-aware writes report that remote tables require registered storage bases. Explicit Ingest and low-level file APIs retain their existing contracts. Add an External-store wrapper hook that derives a view from the resolved store, preserving credentials, endpoints, connection pools and provider state. Immutable cache wrappers can bypass their cache for External reads while retaining ordinary Managed behavior. A weak cache reuses live External views without a reference cycle, and source/scheduler identity prevents stores or wrapper views with matching prefixes from being combined. Behavioral validation covers rejection before source access, filtered local providers, registered-base matching, repeated locator batches sharing one executor, fresh External reads after overwrite, and zero origin reads for warm Managed payloads. The final reviewed delta passed 483 IO and 227 Blob tests; earlier 189 Dataset IO cases and two doctests remain applicable. The integrated tree adds only the upstream SAFETY-comment fix from #10980; full root Clippy passed on the integrated PR head (`cargo clippy --all --tests --benches --profile ci -j 4 -- -D warnings`, exit 0). Hosted CI and formal approval remain pending. Service adoption must propagate the policy when rebuilding Sessions and implement the External hook in its immutable cache wrapper. Production RAM/NVMe, cloud credentials and REST/SQL integration are separate downstream work. This PR does not establish that those service boundaries are already enforced. It overlaps the internal read keys in #10171; a separately reviewed integration candidate with that PR retained Arc-instance-plus-path scheduler identity and row-independent entries and passed 605 Blob tests (0 failures). This does not claim downstream Sophon adoption or a merged prerequisite.
Xuanwo
approved these changes
Nov 13, 2026
Xuanwo
left a comment
Member
There was a problem hiding this comment.
Approving the accepted source semantics: reads resolve through each handle's own payload location without re-reading descriptors; null/duplicate/unordered/range requests keep request identity; already-closed handles are rejected before payload I/O; schedulers stay per store instance with payload grouping keyed by store identity and path. Re-ran the 10 focused handle-read tests and cargo fmt --all --check on the merged candidate tree (live main 5a26f39 + this head), all passed. Formal approval was the only outstanding blocker.
This was referenced Nov 27, 2026
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.
Bulk reads from already opened
BlobFilehandles can now reuse the bounded Blob read planner without taking descriptors again. Rust exposeslance::blob::read_blob_filesandread_blob_file_ranges; Python exposes the same APIs at thelancemodule level. This addresses the handle-input portion of #6178.Requests retain their input identity, including NULL and empty values, with ordered results by default. Defaults come from the first non-null handle's own store and can be overridden. Empty and all-NULL inputs perform no I/O. Handles keep their source and ranges across dataset commits while their backing files remain available; External objects retain their provider's consistency semantics. Public Rust and Python docs state that handles already closed when the read stream is created are rejected; closing a handle afterwards does not cancel reads already planned.
Payload grouping distinguishes ObjectStore Arc instances and object paths, so stores with matching prefixes cannot share credentials, cache state, or payloads accidentally. Execution schedulers are shared across paths within the same store instance; cached schedulers retain that Arc, preventing address reuse while the execution is alive. Handle and row-selector reads use the same bounded executor, with no placeholder row addresses in the internal execution path.
The branch is merged with current
main(4344ec32), preserving the incoming Blob raw-reader schema normalization from #10946 and the session/version stub additions; the original two contributor commits remain in history. Validation on the integrated tree: 373 targeted Rust Blob tests passed (233dataset::blob, 140dataset::tests::dataset_blob), including all 11 new handle cases; 146lancedoctests passed, including both new public examples; full-workspaceciClippy and formatting passed. Python: 292test_blob.pycases passed, including all 17 new handle cases;uv run make lintpassed. The docs site builds; external integration docs were absent and stayed on their placeholders. Live S3/MinIO credential isolation and latency benchmarks have not been run; request-count tests do not establish a latency claim.Formal approval is still pending.