Skip to content

ORC-2239: [C++] Prefetch stripe I/O before RowReader::next() - #2743

Closed
wgtmac wants to merge 1 commit into
apache:mainfrom
wgtmac:codex/orc-2239-try-prefetch-io
Closed

wgtmac wants to merge 1 commit into
apache:mainfrom
wgtmac:codex/orc-2239-try-prefetch-io

Conversation

@wgtmac

@wgtmac wgtmac commented Nov 30, 2026 •

Copy link
Copy Markdown
Member

What changes were proposed in this pull request?

ORC-2239 adds RowReader::tryPrefetchIO(). With async prefetch enabled, callers can use it before the first next() and after consuming a batch at a stripe boundary. It prepares the next eligible stripe using the existing split, projection, predicate pushdown, and small-stripe look-ahead logic. A subsequent next() call reuses that preparation and builds the column readers without submitting the same data reads again.

Why are the changes needed?

The C++ row reader currently starts the first stripe's data reads inside next(). Query engines that already prepare files on background threads can use this entry point to overlap stripe I/O with other work before requesting the first batch.

How was this patch tested?

Added C++ tests that use a deferred input stream to verify that reads are submitted before next() and that the prefetch call returns before those reads complete. The tests cover split boundaries, multiple stripes, small-stripe look-ahead, repeated calls, mid-stripe and disabled-prefetch no-ops, EOF, and seeks with predicate pushdown.

Was this patch authored or co-authored using generative AI tooling?

Generated-by: OpenAI Codex (GPT-6)

Expose tryPrefetchIO() so callers can submit reads for the next selected stripe at a stripe boundary. Reuse the existing stripe preparation and defer column reader construction until next().

Generated-by: OpenAI Codex (GPT-6)
@wgtmac

wgtmac commented Dec 1, 2026

Copy link
Copy Markdown
Member Author

Thank you for the review, @ffacs!

@wgtmac wgtmac closed this in b168428 Dec 1, 2026
wgtmac added a commit that referenced this pull request Dec 1, 2026
### What changes were proposed in this pull request?

[ORC-2239](https://issues.apache.org/jira/browse/ORC-2239) adds `RowReader::tryPrefetchIO()`. With async prefetch enabled, callers can use it before the first `next()` and after consuming a batch at a stripe boundary. It prepares the next eligible stripe using the existing split, projection, predicate pushdown, and small-stripe look-ahead logic. A subsequent `next()` call reuses that preparation and builds the column readers without submitting the same data reads again.

### Why are the changes needed?

The C++ row reader currently starts the first stripe's data reads inside `next()`. Query engines that already prepare files on background threads can use this entry point to overlap stripe I/O with other work before requesting the first batch.

### How was this patch tested?

Added C++ tests that use a deferred input stream to verify that reads are submitted before `next()` and that the prefetch call returns before those reads complete. The tests cover split boundaries, multiple stripes, small-stripe look-ahead, repeated calls, mid-stripe and disabled-prefetch no-ops, EOF, and seeks with predicate pushdown.

### Was this patch authored or co-authored using generative AI tooling?

Generated-by: OpenAI Codex (GPT-6)

Closes #2743 from wgtmac/codex/orc-2239-try-prefetch-io.

Authored-by: Gang Wu <ustcwg@gmail.com>
Signed-off-by: Gang Wu <ustcwg@gmail.com>
(cherry picked from commit b168428)
Signed-off-by: Gang Wu <ustcwg@gmail.com>
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.

2 participants