GH-48111: [C++][Dataset] Fix scans hanging with zero fragment readahead - #51543
Open
maximilliangrand wants to merge 1 commit into
Open
maximilliangrand wants to merge 1 commit into
maximilliangrand wants to merge 1 commit into
Conversation
maximilliangrand
requested review from
AlenkaF,
raulcd and
rok
as code owners
September 27, 2026 13:27
|
|
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.
Rationale for this change
fragment_readahead=0is documented to disable fragment readahead, butScanner.to_table()hangs even on an empty dataset. The unordered scan creates a merged generator with zero subscriptions, so no fragment is pulled and the first consumer future never completes.Fixes #48111.
What changes are included in this PR?
Keep at least one active fragment in the unordered merge. All positive readahead limits and the sequenced scan path retain their existing behavior.
Add regressions for empty and multiple-fragment datasets, sequenced and unordered C++ scans, and threaded and unthreaded Python Parquet scans.
Are these changes tested?
pytest python/pyarrow/tests/test_dataset.py -k "scanner or to_table or fragment"passes 63 tests, with 2 skips for S3 and Substrait support not enabled in the local build.head,to_batches, and positive-readahead controls. Tested on macOS arm64 with Python 3.13.Are there any user-facing changes?
Table scans finish when fragment readahead is disabled. No public API changes.
Was AI used for this PR?
Codex investigated the issue, wrote the implementation and regression tests, and ran local validation. The changes also received independent AI review.
PR code and description written by:
Reviewed before submission by: