Repository navigation
feat(parquet): bound input prefetch with a row-group window - #604
SteNicholas wants to merge 1 commit into
Conversation
a347b35 to
170ae3e
Compare
|
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 |
|
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. |
|
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. |
170ae3e to
c651059
Compare
Arrow could pre-buffer every selected row group before returning the first batch, letting compressed input memory grow with wide scans. Issue apache#602 calls for bounding Parquet input pre-buffering with a sliding row-group window. - Prefetch projected column chunks and selected pages in a sliding window covering the current row group and configurable lookahead via parquet.read.cache-option.prefetch-row-groups (default 1, 0 disables lookahead). - Apply parquet.read.cache-option.window-size-limit (default 128 MiB, 0 disables the window) to subsequent lookahead, counting coalesced gaps and in-flight reads while still prefetching at least the current row group when enabled. - Reuse buffered input on seeks within the window, retire consumed groups after their final batch and drain submitted reads before releasing buffers from consumed or discarded groups. - Fall back to on-demand reads after prefetch failures and preserve row-group and page pruning, file row IDs, batch order and returned Arrow batch lifetimes. - Cover bounded wide-string scans, lookahead limits, oversized current groups, coalesced gaps, seeks, early close and prefetch failures. Document the window options and lifecycle behavior.
c651059 to
7333df0
Compare
|
Thanks @lucasfang for the thorough review! I have updated the PR (commit
|
|
@zjw1111 Please run the Parquet read performance regression again for this pr (test both with prefetch enabled and disabled). Thanks! |
|
Also, it looks like #598 has only one patch left. @SteNicholas How about merging it first (it already went through full review and performance regression), and then rebasing the current PR? I noticed both changes have modified the Arrow patch. |
| } | ||
| } else { | ||
| // No overlap, add as new range | ||
| merged.push_back(curr); |
There was a problem hiding this comment.
I think the previous comment was fine—why did we remove it this time?
| /// | ||
| /// This exercises the full path: ComputePageRanges → PreBufferRanges → CachedInputStream → | ||
| /// ReadFilteredRowGroup with page_ranges. | ||
| TEST_F(PageFilteredRowGroupReaderTest, EndToEndPageLevelPreBuffer) { |
There was a problem hiding this comment.
Could you clarify why the test comments were removed? I noticed some tests were updated because the code changed, and in those cases the comments should be updated accordingly. However, for the test I’m looking at, there were no functional changes—yet the related comment was still deleted. I also saw several similar comment deletions elsewhere in the PR. Could you please double-check whether these were intentional, or whether an automated cleanup mistakenly removed those comments?
Purpose
Linked issue: close #602
Bound Parquet input pre-buffering in Paimon C++ with a sliding row-group window, aligned with Velox's
prefetchRowGroupsscheduling. Previously, Arrow could buffer projected input for every selected row group before returning the first batch, causing compressed input memory to grow with wide scans.parquet.read.cache-option.prefetch-row-groupssubsequent row groups (default1;0disables lookahead).parquet.read.cache-option.window-size-limit(default128 MiB;0disables the window) when deciding whether to prefetch subsequent groups, counting coalesced gaps and in-flight reads while still prefetching at least the current row group when enabled.Benchmarks (Release)
Before-and-after comparison on a simulated HDD-backed DFS async stream (
12 msseek/RPC latency,150 MiB/sshared bandwidth, 8 async I/O threads) across row-group sizes:4MiB_x32RGpre_buffer)4MiB_x32RG128MiB,prefetch=0)4MiB_x32RG128MiB,prefetch=1, default)4MiB_x32RG128MiB,prefetch=4)32MiB_x8RGpre_buffer)32MiB_x8RG128MiB,prefetch=1, default)128MiB_x3RGpre_buffer)128MiB_x3RG128MiB,prefetch=1, default)160MiB_x2RGpre_buffer)160MiB_x2RG128MiB,prefetch=1, default)Tests
prefetch-row-groups=0,1,3, negative rejection, byte-budget cap, andwindow-size-limit = 0disabling prefetch) and end-to-endParquetReaderBuilderoption validation and async read count checks.API and Format
parquet.read.cache-option.window-size-limitin bytes (default128 MiB;0disables the window).parquet.read.cache-option.prefetch-row-groupsfor subsequent row groups to prefetch beyond the current one (default1;0disables lookahead).Documentation
Yes. Updated
docs/source/user_guide/prefetch.rstto document the sliding row-group window, byte budget, lookahead option, lazy reads, and interaction with the shared read-ahead cache.Generative AI tooling
Generated-by: Google Antigravity (Gemini 4)