perf: Reduce eager Ray dataset actions - #1025
Open
fengrui-z wants to merge 1 commit into
Open
Conversation
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
Reduce unnecessary eager Ray Dataset actions and fix row retrieval truncation.
Changes
count()call before building an operator pipeline.take(k)directly instead ofcount(),limit(k), andtake().take_all()whenget_column()is expected to return every row.columns()andschema()calls.Motivation
Ray Datasets are lazily evaluated, but
count()triggers execution. Calling it before constructing every processing pipeline adds unnecessary work, especially when the partitioned executor invokesprocess()for each partition or checkpoint group.Additionally, Ray’s
take()defaults to 20 rows. The previous implementation could therefore silently truncate results fromget()andget_column()even when more rows were requested.Validation
process()no longer callscount()before building the execution plan.Note
get_column(k=None)now follows its documented behavior and returns all rows usingtake_all(). As before, callers should avoid using it with datasets too large to fit in driver memory.