BlobV2Descriptor Structured Extension — Fine-Grained Random Access for Multimodal Blob #8739
wenxuanguan
started this conversation in
Lance File Format
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Background & Motivation
Blob v2 already provides efficient storage and access for large binary objects. However, the current BlobV2Descriptor only records the blob's overall position and size (kind / position / size / blob_id / blob_uri) and is unaware of the blob's internal structure.
This limits Lance's applicability in multimodal scenarios:
Building on prior discussions, #7174 points out that the Blob v2 descriptor only expresses physical storage location and cannot support richer logical objects such as multiple rows sharing the same object, delta encoding, or chunked blobs. It proposes an Object Layer abstraction that decouples physical location from logical representation through a unified resolve → plan → read → decode flow, enabling domain-specific blob layouts (e.g., GOP-level video storage) and cross-row object sharing (I/O coalescing). #4320 points out that the Blob API treats video as unstructured binary data and cannot perceive video metadata (e.g., frame rate); it proposes a video encoding extension that pluggably supports "encode-on-write" and "background progressive rewrite (at GOP level)" while retaining the native strengths of columnar storage.
I'd like to suggest a minimal, forward-compatible BlobV2Descriptor extension on top of these discussions, so that Lance can perceive a blob's internal structure and support fine-grained random access, while keeping the Lance core free of any codec dependency.
Core Design: A Minimal Extension to BlobV2Descriptor
On top of the existing 5 native fields, the only addition is a nullable sub-field blob_info, which carries the metadata and internal-structure index for various multimodal blobs. Taking video as an example, the full structure is defined as follows:
The design supports a variety of multimodal data formats without hardcoding specific metadata schemas into the Lance core. The blob_info field provides a generic and extensible container for auxiliary metadata. Lance is responsible only for storing and retrieving this payload; it does not need to parse or understand its internal structure. The actual content of stream_info and entries is an opaque payload—its schema and semantics are fully defined and handled by the client application. For video, this might include stream‑level metadata(e.g., fps), and GOP/Frame offsets. For image, it could contain page‑level metadata such as page count, and index entries for a multi-page document.
Architecture: How It Maps Onto the Object Layer
This proposal follows the implementation path of #7174 Object Layer. It adheres to resolve → plan → read → decode, using video frame extraction as an example.
Mapping of the blob read path:
blob_info is inlined in the descriptor, so the number of I/O reads stays the same.
Data write: extend the existing write entry point to detect a video-splitting request, demux the video container, extract video metadata to populate the blob_info field of BlobV2Descriptor, and store the GOP byte stream — reusing the existing write path and committing the transaction. No video frame decoding or re-encoding is involved.
The boundary of changes is clear:
Compatibility
Taking video frame‑extraction scenarios as an example:
The proposal decomposes MP4 files into GOP collections and stores them as GOP byte streams in the Lance Dataset. Since original MP4 container metadata is stripped during demultiplexing, legacy interfaces cannot correctly interpret these raw GOP byte sequences or reproduce a valid MP4.
Performance Gains
Taking video frame extraction as an example, the blob_info extension reduces the number of I/O operations by an order of magnitude compared to the BlobFile-based random access approach, thereby significantly lowering the I/O cost for multimodal frame-extraction workloads.
4.1 End-to-End Latency Comparison
Test setup: MP4 video stored on MinIO (133.4 MB, H.264, fps 25, 40 min duration); Ten 500 ms time windows are randomly generated, and ten corresponding keyframe extraction operations are performed.The test implementation follows the official Lance lazy video decoding example: example-decode-video-frames-lazily. In that example, the
process_framefunction performs RGB conversion and materializes the frame as an ndarray.This proposal's extraction flow: The target frame sequence is located and retrieved from the blob according to the time interval, and then decoded to all keyframes using ffmpeg.
Baseline extraction flow: Using take_blobs to fetch the BlobFile, a container is built from it. The container is then seeked to the closest keyframe position based on the given start time, and all keyframes are subsequently extracted in sequential order.
Results:
4.2 Performance Breakdown
This proposal decodes from the GOP's keyframe sequentially to the target frame; the baseline computes a seek to the preceding keyframe from the frame number and fps (and related info), then decodes sequentially to the target frame. Decode times are close — the performance gap mainly comes from blob data reads.
Comparing the I/O traffic of reading blob data, the difference is significant:
All reactions