Repository navigation
Description
Part of #6946.
What users get
Today, ParquetPushDecoder returns no rows of a row group until the caller has pushed all bytes that the row group reads. For a large row group on object storage, the first batch waits for the full row group, and the decoder holds the full row group in memory.
With this EPIC, a caller can opt in to getting each batch as soon as its pages are pushed:
let mut decoder = ParquetPushDecoderBuilder::try_new_decoder(metadata)?
.with_request_granularity(RequestGranularity::Batch) // new, opt-in
.build()?;
// `NeedsData` asks only for the pages of the next batch.Prototype measurement (one row group of 84 MB, 50 ms per request, caller reads 8 MB ahead):
| Mode | Time to the first batch | Peak buffered bytes |
|---|---|---|
Today (RequestGranularity::RowGroup) |
451 ms | 84 MB |
RequestGranularity::Batch |
89 ms | 8.1 MB |
DataFusion can use this mode to scan large row groups with less memory (apache/datafusion#24086).
Terms
| Term | Meaning |
|---|---|
Push decoder (ParquetPushDecoder) |
A Parquet decoder that does no I/O. try_decode returns NeedsData(ranges); the caller fetches the byte ranges and pushes them. |
| Row group, column chunk, page | A row group holds one column chunk per column. A column chunk is a sequence of pages (an optional dictionary page, then data pages). |
| Offset index | Parquet metadata that gives the file offset, size and first row of each data page. |
Predicate (RowFilter) |
A filter that the decoder evaluates while it decodes, to skip rows of other columns. |
| Read-ahead | The caller fetches ranges before the decoder asks for them. |
Plan
Last update: 2026-12-03.
Open
| Order | PR | What users get | State |
|---|---|---|---|
| 1 | #12486 | Benchmarks that decode a file with try_decode, as the baseline for batch mode |
Draft |
| 1 | #12487 | A binary search for the pages of a row selection. It has no effect on main, and it removes 13% of the cost of batch mode with many small pages. |
Draft |
| 1 | #11609 | Refactor: the decoder and scan_plan share the logic that decides what a stage fetches |
Draft |
| 2 | #11238 | RequestGranularity::Batch: each batch as soon as its pages are pushed. Works with a RowFilter, releases pages after each batch, and uses the configured RowSelectionPolicy. |
Draft until 12486 and 12487 merge |
main ──┬── 12486 benchmarks ──┬── 11238 batch mode
├── 12487 page lookup ─┘
└── 11609 fetch refactor (11238 needs a small rebase after it)
The three PRs of order 1 do not depend on each other. #11238 contains the commits of 12486 and 12487 until they merge.
#11238 changed design on 2026-11-27. It has no separate Incremental state and no page store. The decoder splits a row group into windows of batch_size rows, and each window runs the existing states of the decoder. The PR description has the details and the benchmarks.
Merged
| PR | What users get |
|---|---|
| #11218 | A test that shows the current behavior |
| #11235 | The decoder releases the bytes of a finished row group (fix for #11233) |
| #11237 | Faster lookups when a caller pushes many buffers |
| #11484 | A file with a bad offset index gives an error, not a panic |
| #11485 | Tests: the push decoder against the sync reader, with proptest |
| #10555 | ParquetPushDecoder::scan_plan, which a caller uses to read ahead |
Superseded
| PR | Replaced by |
|---|---|
| #11223 | The first version in one PR. Split into the PRs above. |
| #11236 | #11235 |
| #11239, #11241 | #11240 |
| #11613 | #11238, which now uses its design |
| #11240 | #11238, which now includes the predicate cache, the page release and the selection policy |
| #11487 | It changes the first design of #11238, which no longer exists |
Activity
feat(parquet): release each page when the batch-granular push decoder…
feat(parquet): use the predicate cache in the batch-granular push dec…
feat(parquet): release each page when the batch-granular push decoder…
feat(parquet): use the predicate cache in the batch-granular push dec…
perf(parquet): use the configured selection policy in batch windows
feat(parquet): release each page when the batch-granular push decoder…
feat(parquet): use the predicate cache in the batch-granular push dec…
perf(parquet): use the configured selection policy in batch windows
perf(parquet): use the configured selection policy in batch windows
adriangb commentedon Sep 27, 2026
Note
Out of date: see #11234 (comment)
@alamb, as you asked on #11223 (comment), I split #11223 (+4,156 lines) into the PRs below. This comment gives the reason for each cut and a suggested review order.
How the split works
mainfix or speed up the current decoder. Each PR on top of the core adds one improvement to batch mode.Suggested review order
into_builder().build()releases the pushed bytes of the row groups that the new decoder skipsPushBuffers:Nbuf/100000rangesgoes from 574 ms to 35 msFetchGranularity::Batch: the first batch of a row group as soon as its pages are pushedRowSelectionPolicyin each windowStep 2: how to read #11238
It is the largest PR, because the core cannot be smaller without a temporary fallback. About half of it is tests. Suggested reading order:
FetchGranularityinpush_decoder/mod.rs: the behavior that users see, and the I/O contract.IncrementalRowGroupandStageinreader_builder/incremental.rs: the design.IncrementalRowGroup::stepandColumnChunkPages: the engine.reader_builder/mod.rs,remaining.rsandpush_decoder/mod.rs, which is small.incremental_tests.rs: most tests compare batch mode with the default mode on the same scan.The PR description also records two decisions from review: windows stay
batch_sizerows of the row group, and the caller decides how far to read ahead.Merge notes
util/push_buffers.rs. The PR that merges last needs a small rebase: remove the duplicatemerge_rangesand test helper, and update the maximum buffer length of #11237 inrelease_rangesandretain_ranges.#11223 stays open as a reference for the full change. I will close it when the stack merges.
adriangb commentedon Sep 27, 2026
(sorry for the ping above andrew, i told it to post a summary so i could read it and then I was going to ping you after vetting, i always try to not have an ai ping a human, appoligies. that said i've now read the comment above and it is reasonable 😄)
cc @sunchao
feat(parquet): let ParquetPushDecoder decode a batch as soon as its p…
feat(parquet): release each page when the batch-granular push decoder…
feat(parquet): use the predicate cache in the batch-granular push dec…
perf(parquet): use the configured selection policy in batch windows
28 remaining items
feat(parquet): release each page when the batch-granular push decoder…
perf(parquet): use the configured selection policy in batch windows
feat(parquet): use the predicate cache in the batch-granular push dec…
feat(parquet): release each page when the batch-granular push decoder…
perf(parquet): use the configured selection policy in batch windows
test(parquet): differential tests of `ParquetPushDecoder` against the…
feat(parquet): use the predicate cache in the batch-granular push dec…
feat(parquet): release each page when the batch-granular push decoder…
perf(parquet): use the configured selection policy in batch windows
feat(parquet): use the predicate cache in the batch-granular push dec…
feat(parquet): release each page when the batch-granular push decoder…
perf(parquet): use the configured selection policy in batch windows
feat(parquet): use the predicate cache in the batch-granular push dec…
feat(parquet): release each page when the batch-granular push decoder…
perf(parquet): use the configured selection policy in batch windows