Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[data] Fix early stop for multiple limit ops. #42958

Merged
merged 6 commits into from Feb 5, 2024

Conversation

raulchen
Copy link
Contributor

@raulchen raulchen commented Feb 3, 2024

Why are these changes needed?

  • When there are multiple limit ops, the dataset should stop when the smallest limit is reached. For example, ds.limit(1000).limit(1) should stop when 1 row is outputted. But the current implementation won't. This PR fixes this issue.
  • Also mark LimitOp as throttling_disabled, so it will be prioritized in the scheduler.

Related issue number

Checks

  • I've signed off every commit(by using the -s flag, i.e., git commit -s) in this PR.
  • I've run scripts/format.sh to lint the changes in this PR.
  • I've included any doc changes needed for https://docs.ray.io/en/master/.
    • I've added any new APIs to the API Reference. For example, if I added a
      method in Tune, I've added it in doc/source/tune/api/ under the
      corresponding .rst file.
  • I've made sure the tests are passing. Note that there might be a few flaky tests, see the recent failures at https://flakey-tests.ray.io/
  • Testing Strategy
    • Unit tests
    • Release tests
    • This PR is not tested :(

Signed-off-by: Hao Chen <chenh1024@gmail.com>
Signed-off-by: Hao Chen <chenh1024@gmail.com>
Signed-off-by: Hao Chen <chenh1024@gmail.com>
Signed-off-by: Hao Chen <chenh1024@gmail.com>
Signed-off-by: Hao Chen <chenh1024@gmail.com>
@raulchen raulchen changed the title [data] Fix early stop for consecutive limit ops. [data] Fix early stop for multiple limit ops. Feb 3, 2024
Copy link
Contributor

@scottjlee scottjlee left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, by the way, i previously implemented this limit fusion logic for the case of Limit[n] -> Limit[m] to Limit[min(n, m)]:

def _apply_limit_fusion(self, op: LogicalOperator) -> LogicalOperator:

But this is currently disabled since LimitPushdownRule is not used right now. We could also enable this logic separately to further optimize this case

Signed-off-by: Hao Chen <chenh1024@gmail.com>
@raulchen raulchen merged commit 9a09d2d into ray-project:master Feb 5, 2024
9 checks passed
@raulchen raulchen deleted the consecutive-limit-ops branch February 5, 2024 21:33
tterrysun pushed a commit to tterrysun/ray that referenced this pull request Feb 14, 2024
* When there are multiple limit ops, the dataset should stop when the smallest limit is reached. For example, `ds.limit(1000).limit(1)` should stop when 1 row is outputted. But the current implementation won't. This PR fixes this issue. 
* Also mark LimitOp as `throttling_disabled`, so it will be prioritized in the scheduler. 

---------

Signed-off-by: Hao Chen <chenh1024@gmail.com>
Signed-off-by: tterrysun <terry@anyscale.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.

None yet

4 participants