Skip to content

feat(parquet): bound input prefetch with a row-group window - #604

Open
SteNicholas wants to merge 1 commit into
apache:mainfrom
SteNicholas:PAIMON-602
Open

SteNicholas wants to merge 1 commit into
apache:mainfrom
SteNicholas:PAIMON-602

Conversation

@SteNicholas

@SteNicholas SteNicholas commented Nov 30, 2026 •

Copy link
Copy Markdown
Member

Purpose

Linked issue: close #602

Bound Parquet input pre-buffering in Paimon C++ with a sliding row-group window, following Velox's scheduling approach. Arrow could buffer the projected input for every selected row group before returning the first batch, so compressed input memory grew with wide scans.

  • Prefetch projected column chunks and selected pages in a window of up to 64 row groups per reader.
  • Count coalesced gaps and in-flight reads against the byte budget. Read oversized groups on demand and fall back to on-demand reads after prefetch failures.
  • Reuse buffered input on seeks within the window. Drain submitted reads before releasing groups discarded by a seek or close.
  • Retire fully matched and page-filtered groups as their final batch is returned. Drop buffer references held by completed callbacks so consumed input can be reclaimed.
  • Preserve row-group and page pruning, file row IDs, batch order and the lifetime of returned Arrow batches.

One local Release run used a 900 KiB budget, 32 rows per group with 12 KiB of padding per string, and four rows per output batch. At 6 and 30 row groups, peak input was 787,072 bytes in both scans. First-batch latency was 135 and 170 µs, scan throughput was 775.38 and 1,338.14 MiB/s, and physical bytes read were 2,361,006 and 11,805,030, respectively.

Tests

  • Wide-string scan tests for bounded input as row-group count grows, file row IDs, batch order and returned batch lifetime.
  • Seek and retirement tests for reuse within the window, jumps across windows, release at the end of a page-filtered group and early close with pending reads.
  • Prefetch I/O tests for coalesced gaps, oversized groups and on-demand fallback after submission exceptions or asynchronous read failures.
  • Page-pruning tests for default, disabled and undersized budgets, and a reader-builder test for negative budgets.

API and Format

  • Add parquet.read.cache-option.window-size-limit in bytes. It defaults to 64 MiB per reader, and 0 disables the window.
  • Read the existing Parquet file format.

Documentation

Yes. docs/source/user_guide/prefetch.rst covers the window, the byte budget, lazy reads and the shared read-ahead cache.

Generative AI tooling

Generated-by: OpenAI Codex (GPT-6)

🤖 Generated with OpenAI Codex

Arrow could pre-buffer all selected row groups before returning the
first batch. With wide projections, compressed input memory grew with
the number of selected row groups even when output batches were small.

- Prefetch projected column chunks and selected pages in a sliding
  row-group window, addressing apache#602.
- Count coalesced gaps and in-flight reads against the per-reader byte
  budget, which defaults to 64 MiB. Read oversized groups on demand.
- Reuse buffered input on seeks within the window. Retire groups after
  their final batch and drain submitted reads before releasing buffers
  from consumed or discarded groups.
- Preserve row-group and page pruning, file row IDs, batch order and the
  lifetime of returned Arrow batches.
@SteNicholas SteNicholas changed the title feat(parquet): bound prefetch with a row-group sliding window feat(parquet): bound input prefetch with a row-group window Nov 30, 2026
@lxy-9602
lxy-9602 requested a review from lucasfang December 1, 2026 07:29
@lucasfang

Copy link
Copy Markdown
Member

Could we make the number of subsequent row groups to prefetch configurable, instead of hardcoding a limit of 64? This would align with Velox’s prefetchRowGroups semantics: default to 1 additional row group beyond the current one, with 0 meaning no lookahead.

@lucasfang

Copy link
Copy Markdown
Member

Could we also add before-and-after performance benchmarks on slower storage, such as an HDD-backed distributed file system, to verify that the reduced prefetch window does not cause a significant performance regression? It would be useful to compare scan throughput and first-batch latency across different row-group sizes.

@lucasfang

Copy link
Copy Markdown
Member

Could we consider increasing the default prefetch budget to 128 MiB? Also, could we allow at least the current row group to be prefetched even if it exceeds the budget, and apply the budget when deciding whether to prefetch subsequent groups? Increasing the default alone would still leave larger row groups falling back to on-demand reads.

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Feature] Support a bounded row-group sliding window for Parquet prefetch

2 participants