Skip to content

feat(io): apply byte-sized batch budget to blob materialization - #8927

Merged
Xuanwo merged 6 commits into
lance-format:mainfrom
lichuang:issue-8857
Sep 16, 2026
Merged

Xuanwo merged 6 commits into
lance-format:mainfrom
lichuang:issue-8857

Conversation

@lichuang

@lichuang lichuang commented Sep 1, 2026

Copy link
Copy Markdown
Contributor

close #8857

Apply the scanner's batch_size_bytes budget a second time after blob v2 payloads are materialized, splitting the merged batch by bytes so blob reads are capped at 2x oversubscription relative to the inline/descriptor budget.

@github-actions github-actions Bot added the enhancement New feature or request label Sep 1, 2026
lance-gatekeeper[bot]

This comment was marked as outdated.

@lance-gatekeeper lance-gatekeeper Bot added the K-changes Latest Gatekeeper recommendation requests changes. label Sep 1, 2026
zhangyue19921010 pushed a commit that referenced this pull request Sep 2, 2026
…ns (#8933)

Serialize the scanner's `batch_size_bytes` budget into
`FilteredReadOptionsProto` so remote execution no longer drops the byte
cap when `file_reader_options` is reconstructed from the wire.

## Summary

Fixes #8857 (follow-up to #8927): carry `batch_size_bytes` through
distributed FilteredReadOptions

This is a follow-up to #8927 ("feat(io): apply byte-sized batch budget
to blob materialization"), which applies the scanner's
`batch_size_bytes` budget a second time after blob v2 payloads are
materialized. The gatekeeper review on #8927 flagged that the budget is
silently dropped under distributed execution, because
`FilteredReadOptionsProto` does not serialize `file_reader_options`.
This PR lands that missing wire field.

## Problem

#8927 forwards the byte budget into the row-stream `FilteredReadExec`,
but its distributed codec does not serialize `file_reader_options`;
`FilteredReadOptionsProto` has no corresponding field and decode
reconstructs `None`. Remote execution therefore silently drops the byte
cap.

## Fix

Add an optional `batch_size_bytes` field to `FilteredReadOptionsProto`
and round-trip it through the proto codec.

### Changes

- `protos/filtered_read.proto`
- Add `optional uint64 batch_size_bytes = 14` to
`FilteredReadOptionsProto`, documented as the scanner-level byte budget
corresponding to `FileReaderOptions.batch_size_bytes`.
- `rust/lance/src/io/exec/filtered_read_proto.rs`
- `fr_options_to_proto`: serialize
`options.file_reader_options.batch_size_bytes` into the new field.
- `fr_options_from_proto`: reconstruct `file_reader_options` with
`batch_size_bytes` when present.
- Extend `test_options_roundtrip_basic` to set `batch_size_bytes:
Some(4096)` and assert it survives the round-trip.

### Tests

- `cargo test -p lance --features substrait --lib
filtered_read_proto::tests::test_options_roundtrip_basic` — verifies
`batch_size_bytes` round-trips through the proto codec (sender
`Some(4096)` → decoded `Some(4096)`).
- `cargo check -p lance --features substrait` — compiles cleanly.

## Relationship to #8927

#8927 implements the core blob byte-budget feature and is still open.
This PR is a focused follow-up that addresses one of its three
gatekeeper findings (distributed execution dropping the budget). The
other two findings — skewed-row chunk sizing in `split_batch_by_bytes`
and chunk boundaries being re-merged by `RowStreamRead::read_batch` —
are tracked separately and not addressed here.
…e-format#8857)

Apply the scanner's `batch_size_bytes` budget a second time after blob v2
payloads are materialized, recursively splitting the merged batch by bytes
(2x oversubscription) and preserving chunk boundaries through late
materialization so blob reads stay within the envelope.
@lance-gatekeeper lance-gatekeeper Bot removed the K-changes Latest Gatekeeper recommendation requests changes. label Sep 3, 2026
lance-gatekeeper[bot]

This comment was marked as outdated.

@lance-gatekeeper lance-gatekeeper Bot added the K-changes Latest Gatekeeper recommendation requests changes. label Sep 3, 2026
…e-format#8857)

Apply the scanner's `batch_size_bytes` budget a second time after blob v2
payloads are materialized, recursively splitting the merged batch by bytes
(2x oversubscription) and preserving chunk boundaries through late
materialization so blob reads stay within the envelope.
@lance-gatekeeper lance-gatekeeper Bot removed the K-changes Latest Gatekeeper recommendation requests changes. label Sep 3, 2026
lance-gatekeeper[bot]

This comment was marked as outdated.

@lance-gatekeeper lance-gatekeeper Bot added the K-approved Latest Gatekeeper recommendation permits acceptance. label Sep 3, 2026
@lance-gatekeeper lance-gatekeeper Bot removed the K-approved Latest Gatekeeper recommendation permits acceptance. label Sep 15, 2026
lance-gatekeeper[bot]

This comment was marked as outdated.

lance-gatekeeper[bot]

This comment was marked as outdated.

@lance-gatekeeper lance-gatekeeper Bot added K-changes Latest Gatekeeper recommendation requests changes. and removed K-changes Latest Gatekeeper recommendation requests changes. labels Sep 15, 2026
lance-gatekeeper[bot]

This comment was marked as outdated.

@lance-gatekeeper lance-gatekeeper Bot added the K-approved Latest Gatekeeper recommendation permits acceptance. label Sep 16, 2026
The merged stable-format contract rejects the legacy lance-encoding:blob
metadata marker for file version >= 2.2, so Dataset::write failed before
the batch_size_bytes assertions could run in these two coverage tests.
Build both fixtures with blob_field / BlobArrayBuilder, a genuine
lance.blob.v2 logical array, and keep the writes and byte-envelope
assertions on the stable v2.2 format.
@lance-gatekeeper lance-gatekeeper Bot removed the K-approved Latest Gatekeeper recommendation permits acceptance. label Sep 16, 2026
lance-gatekeeper[bot]

This comment was marked as outdated.

@lance-gatekeeper lance-gatekeeper Bot added the K-approved Latest Gatekeeper recommendation permits acceptance. label Sep 16, 2026
@lance-gatekeeper lance-gatekeeper Bot removed the K-approved Latest Gatekeeper recommendation permits acceptance. label Sep 16, 2026
lance-gatekeeper[bot]

This comment was marked as outdated.

@lance-gatekeeper lance-gatekeeper Bot added the K-approved Latest Gatekeeper recommendation permits acceptance. label Sep 16, 2026
@lance-gatekeeper lance-gatekeeper Bot removed the K-approved Latest Gatekeeper recommendation permits acceptance. label Sep 16, 2026

@lance-gatekeeper lance-gatekeeper Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

✅ Gate recommendation: approve.

The beta.3 base merge leaves the effective PR patch unchanged and preserves the verified contracts: stable blob-v2 fixtures satisfy the late-materialization and vector-search byte envelopes, while splitting, ordering, reservation lifetime, memory admission, and distributed budget propagation remain intact.

@lance-gatekeeper lance-gatekeeper Bot added the K-approved Latest Gatekeeper recommendation permits acceptance. label Sep 16, 2026
@Xuanwo
Xuanwo merged commit 3a12096 into lance-format:main Sep 16, 2026
39 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request K-approved Latest Gatekeeper recommendation permits acceptance.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Byte-sized batch support for blobs

2 participants