Repository navigation
perf: reuse loaded utf8 pages for byte-sized batches - #11746
Merged
Merged
Conversation
BubbleCal
marked this pull request as ready for review
December 2, 2026 12:14
There was a problem hiding this comment.
Claude Code Review
This repository is configured for manual code reviews. Comment @claude review for a one-time review, or @claude review always to subscribe this PR to a review on every future push.
Tip: disable this comment in your organization's Code Review settings.
Contributor
There was a problem hiding this comment.
✅ Gate recommendation: approve.
The loaded-page estimate is a reasonable exception to the speculative-read guard from #10295. It removes the small-fragment decode-task overhead while retaining conservative startup batches for dictionary expansion and sparse chunk reuse.
Xuanwo
approved these changes
Dec 2, 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.
Why
With an explicit byte target, a structural reader limits variable-width batches to 128 rows until it gets decode feedback. A small fragment can already have its full UTF-8 page loaded at that point, so equality scans over many small fragments pay for several decode tasks per fragment.
What changed
For a single
Utf8column, use the existing decoded-byte planner to size a larger batch from already-loaded rows. Keep the row and offset limits and use the regular drain path. Account for the MiniBlock builder's reservation of whole chunks. Fall back to the existing batch size when sparse ranges re-use a chunk, dictionary expansion or all-null pages prevent a usable estimate, or the layout cannot be sized.Validation
ReadBatchParams::Ranges. It verifies a 128-row first batch within a 16 MiB target and checks the complete result in input order.lance-encodingandlance-fileunit binaries passed 3,419 tests with 3 ignored.cargo fmt --all --checkandcargo clippy --locked --all --tests --benches -- -D warningspassed.Paired AB/BA on one x86-64 Linux VM with gp3 and cgroup v2. Baseline is
38040f844. Both binaries use the same release profile and frozen 258,844-row datasets. Each arm has 40 warm repetitions. The query uses a string equality predicate and limit 1. The filter reader materializes one UTF-8 column before fetching the remaining columns.With the target enabled, peak scanner RSS for the 40-column 652-fragment miss was 61.2 MiB → 62.1 MiB (+1.5%). A direct file-reader check using
release-with-debugreduced 1,956 batches to 652 across the v2.2 fixture and measured a maximum Arrow buffer capacity of 39,584 bytes in the candidate. The v2.1 fixture's 42 dictionary pages retained the small batches.With the target disabled, the 40-column 652-fragment miss measured 125.87 ms → 118.45 ms in an additional interleaved run. The 2-column late hit measured 115.50 ms → 120.51 ms, with overlapping per-block medians. All timings cover the Lance scanner on the local filesystem.
The byte target remains approximate. For an 8,192-row batch, the offset vector can grow by up to about 24 KiB beyond the offset and validity allowance used in the estimate.