Repository navigation
[Data] Fix FileReader reading past a pushed-down row limit - #68343
Merged
sampan-s-nayak merged 4 commits intoNov 24, 2026
Merged
Conversation
Signed-off-by: zzchun <[email protected]>
zzchun
marked this pull request as ready for review
November 19, 2026 12:07
Contributor
There was a problem hiding this comment.
Code Review
This pull request optimizes the file reader's limit handling by returning early when the limit is less than or equal to zero, and stopping file scanning as soon as the row limit is reached. It also adds unit tests to verify that scanning stops at the limit and that errors propagate correctly, and updates an existing test to use a predicate filter instead of a zero limit. There are no review comments, so I have no feedback to provide.
AarryaSaraf
reviewed
Nov 19, 2026
Signed-off-by: will <[email protected]>
AarryaSaraf
reviewed
Nov 20, 2026
Signed-off-by: will <[email protected]>
AarryaSaraf
approved these changes
Nov 21, 2026
Signed-off-by: will <[email protected]>
Contributor
Author
|
Hi @sampan-s-nayak, when you have a chance, would you mind reviewing this |
sampan-s-nayak
approved these changes
Nov 24, 2026
sampan-s-nayak
left a comment
Contributor
There was a problem hiding this comment.
Thanks for working on this!
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.
Summary
Stop a DataSource V2 file reader as soon as it yields its pushed-down row budget. A zero-row budget skips Arrow dataset construction.
Before and after
Previously the reader pulled another batch before checking its budget. In an ordered two-file ORC read, both files were scanned even when the first batch satisfied the limit. The check now runs before the next pull. Errors still propagate from fragments needed to fill the budget, and parallel scans may already have prefetched data.
Subsystem
IO (DataSource V2 shared file reader).
flowchart LR subgraph Before["Before · IO / FileReader"] A1["Yield the final batch"] --> A2["Pull another batch"] --> A3["Check the budget and stop"] end subgraph After["After · IO / FileReader"] B1["Yield the final batch"] --> B2["Check the budget and stop"] end classDef removed fill:#ffcdd2,color:#222 classDef added fill:#c8e6c9,color:#222 class A2 removed class B2 addedRelated work
Fixes #68341. #51966 tracks propagating limits into reads. #68338 and #68339 address surplus tasks after the downstream physical limit is satisfied. This change addresses the iterator inside a single read task after the limit has already reached the reader. The open-PR search found no change to this reader loop.
Testing
391 passed on
2c9d2b98b1using the branch's Ray Data code with Python 3.12, PyArrow 26.0.1, and Ray Core nightlyeb50407602.Both shared-reader regression tests raise
OSErrorwith the PR base reader (3cba3775f0). On this branch, both pass.limit=0returns[]for a corrupt gzip file.limit=1returns the first row and the iterator finishes normally when a corrupt file follows a valid one, using the default execution settings.