-
Notifications
You must be signed in to change notification settings - Fork 5.8k
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] Allow specifying insertion index when registering custom plan optimization Rule
s
#48039
[Data] Allow specifying insertion index when registering custom plan optimization Rule
s
#48039
Conversation
Signed-off-by: Scott Lee <sjl@anyscale.com>
Signed-off-by: Scott Lee <sjl@anyscale.com>
Rule
sRule
s
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not in scope for this PR, but I've been wondering how we can mitigate the issue where the correctness of optimizer rules depends on it's ordering. Not sure what the best long term solution would be
def register_logical_rule(cls: Type[Rule]): | ||
_LOGICAL_RULES.append(cls) | ||
def register_logical_rule(cls: Type[Rule], insert_index: Optional[int] = None): | ||
if not insert_index: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should this be if insert_index is not None
? If insert_index == 0
, this'd append the rule rather than making it the first item, right?
…8051) ## Why are these changes needed? Fix the bug reported #48039 (comment) ## Related issue number ## Checks - [x] I've signed off every commit(by using the -s flag, i.e., `git commit -s`) in this PR. - [x] 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 - [x] Unit tests - [ ] Release tests - [ ] This PR is not tested :( Signed-off-by: Scott Lee <sjl@anyscale.com>
…optimization `Rule`s (ray-project#48039) ## Why are these changes needed? Currently, when registering custom `LogicalPlan` or `PhysicalPlan` optimization `Rule`s, the only option is to append to the end of the registered rules. The optimization rules will then be executed in order. This is limiting because there are some cases where we want to specify the order of newly registered rules. For example, we may want to add our own custom rule prior to operator fusion taking place. This PR adds the ability to specify an insertion index when registering a custom logical/physical rule. The existing behavior of methods are unchanged. ## Related issue number ## Checks - [x] I've signed off every commit(by using the -s flag, i.e., `git commit -s`) in this PR. - [x] 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. - [x] 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 - [x] Unit tests - [ ] Release tests - [ ] This PR is not tested :( --------- Signed-off-by: Scott Lee <sjl@anyscale.com>
…y-project#48051) ## Why are these changes needed? Fix the bug reported ray-project#48039 (comment) ## Related issue number ## Checks - [x] I've signed off every commit(by using the -s flag, i.e., `git commit -s`) in this PR. - [x] 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 - [x] Unit tests - [ ] Release tests - [ ] This PR is not tested :( Signed-off-by: Scott Lee <sjl@anyscale.com>
Why are these changes needed?
Currently, when registering custom
LogicalPlan
orPhysicalPlan
optimizationRule
s, the only option is to append to the end of the registered rules. The optimization rules will then be executed in order. This is limiting because there are some cases where we want to specify the order of newly registered rules. For example, we may want to add our own custom rule prior to operator fusion taking place.This PR adds the ability to specify an insertion index when registering a custom logical/physical rule. The existing behavior of methods are unchanged.
Related issue number
Checks
git commit -s
) in this PR.scripts/format.sh
to lint the changes in this PR.method in Tune, I've added it in
doc/source/tune/api/
under thecorresponding
.rst
file.