You are viewing a plain text version of this content. The canonical link for it is here.
Posted to github@arrow.apache.org by GitBox <gi...@apache.org> on 2023/01/07 09:16:58 UTC
[GitHub] [arrow-datafusion] HaoYang670 opened a new pull request, #4842: Simplify the break rule of logical optimizer passes
HaoYang670 opened a new pull request, #4842:
URL: https://github.com/apache/arrow-datafusion/pull/4842
Signed-off-by: remzi <13...@gmail.com>
# Which issue does this PR close?
<!--
We generally require a GitHub issue to be filed for all bug fixes and enhancements and this helps us generate change logs for our releases. You can link an issue to this PR using the GitHub syntax. For example `Closes #123` indicates that this PR will close issue #123.
-->
Closes #4841.
# Rationale for this change
<!--
Why are you proposing this change? If this is already explained clearly in the issue then this section is not needed.
Explaining clearly why changes are proposed helps reviewers understand your changes and offer better suggestions for fixes.
-->
# What changes are included in this PR?
<!--
There is no need to duplicate the description in the issue here but it is sometimes worth providing a summary of the individual changes in this PR.
-->
# Are these changes tested?
<!--
We typically require tests for all PRs in order to:
1. Prevent the code from being accidentally broken by subsequent changes
2. Serve as another way to document the expected behavior of the code
If tests are not included in your PR, please explain why (for example, are they covered by existing tests)?
-->
# Are there any user-facing changes?
<!--
If there are user-facing changes then we may require documentation to be updated before approving the PR.
-->
<!--
If there are any breaking changes to public APIs, please add the `api change` label.
-->
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: github-unsubscribe@arrow.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [arrow-datafusion] jackwener commented on pull request #4842: Simplify the break rule of logical optimizer passes
Posted by GitBox <gi...@apache.org>.
jackwener commented on PR #4842:
URL: https://github.com/apache/arrow-datafusion/pull/4842#issuecomment-1374786211
> > e.g: some rule recurse inside themselves, and alway return Ok(Some())
> > It's expected behavior.
>
> Why don't we return None if the rule can't optimize the plan is this scenario?
Some rule I modify them to avoid self-recurse, those rules is ok. But other rules still use original code, always return Ok(Some())
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: github-unsubscribe@arrow.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [arrow-datafusion] alamb commented on a diff in pull request #4842: Simplify the break rule of logical optimizer passes
Posted by GitBox <gi...@apache.org>.
alamb commented on code in PR #4842:
URL: https://github.com/apache/arrow-datafusion/pull/4842#discussion_r1064014394
##########
datafusion/optimizer/src/optimizer.rs:
##########
@@ -309,17 +309,11 @@ impl Optimizer {
}
log_plan(&format!("Optimized plan (pass {i})"), &new_plan);
- // TODO this is an expensive way to see if the optimizer did anything and
- // it would be better to change the OptimizerRule trait to return an Option
- // instead
- let new_plan_str = format!("{}", new_plan.display_indent());
- if plan_str == new_plan_str {
+ if !plan_is_changed {
Review Comment:
I agree with @jackwener that that returning `Ok(Some(plan))` may not actually have changed the plan
Perhaps we need to have a `impl PartialEq` for `LogicalPlan` that does the correct deep equality check?
https://github.com/apache/arrow-datafusion/blob/3cc607de4ce6e9e1fd537091e471858c62f58653/datafusion/expr/src/logical_plan/plan.rs#L50
I remember at some point we tried to `#[derive(PartialEq)]` for `LogicalPlan` but we hit some problem 🤔 maybe it has been resolved. Or maybe we can manually derive `PartialEq` 🤔
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: github-unsubscribe@arrow.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [arrow-datafusion] jackwener commented on pull request #4842: Simplify the break rule of logical optimizer passes
Posted by GitBox <gi...@apache.org>.
jackwener commented on PR #4842:
URL: https://github.com/apache/arrow-datafusion/pull/4842#issuecomment-1374490347
When `result` is `Ok(Some())`, it doesn't means that plan have changed.
Sometimes, plan didn't changed, some rule also will return `Ok(Some())`.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: github-unsubscribe@arrow.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [arrow-datafusion] HaoYang670 commented on pull request #4842: Simplify the break rule of logical optimizer passes
Posted by GitBox <gi...@apache.org>.
HaoYang670 commented on PR #4842:
URL: https://github.com/apache/arrow-datafusion/pull/4842#issuecomment-1374771667
>e.g: some rule recurse inside themselves, and alway return Ok(Some())
It's expected behavior.
Why don't we return None if the rule can't optimize the plan is this scenario?
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: github-unsubscribe@arrow.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [arrow-datafusion] alamb commented on pull request #4842: Simplify the break rule of logical optimizer passes
Posted by GitBox <gi...@apache.org>.
alamb commented on PR #4842:
URL: https://github.com/apache/arrow-datafusion/pull/4842#issuecomment-1376393249
> Why don't we return None if the rule can't optimize the plan is this scenario?
I don't think there is a theoretical reason we don't do this (and it would probably be more efficient) but I don't think it is how the code works today. I would definitely be supportive of updating the passes so they had this property, however 👍
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: github-unsubscribe@arrow.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] Simplify the break rule of logical optimizer passes [arrow-datafusion]
Posted by "alamb (via GitHub)" <gi...@apache.org>.
alamb closed pull request #4842: Simplify the break rule of logical optimizer passes
URL: https://github.com/apache/arrow-datafusion/pull/4842
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: github-unsubscribe@arrow.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [arrow-datafusion] jackwener commented on pull request #4842: Simplify the break rule of logical optimizer passes
Posted by GitBox <gi...@apache.org>.
jackwener commented on PR #4842:
URL: https://github.com/apache/arrow-datafusion/pull/4842#issuecomment-1374765923
> Thank you for your review @jackwener and @alamb 😁.
>
> > Sometimes, plan didn't changed, some rule also will return Ok(Some()).
> > e.g: some rule recurse inside themselves, and alway return Ok(Some())
>
> Hi @jackwener, is this the expected behavior or a known bug that hasn't been fixed yet?
It's expected behavior.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: github-unsubscribe@arrow.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] Simplify the break rule of logical optimizer passes [arrow-datafusion]
Posted by "alamb (via GitHub)" <gi...@apache.org>.
alamb commented on PR #4842:
URL: https://github.com/apache/arrow-datafusion/pull/4842#issuecomment-1830644088
Closing as this PR is over a year old. Please feel free to reopen it / rebase it if you plan to keep working on it
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: github-unsubscribe@arrow.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [arrow-datafusion] HaoYang670 commented on pull request #4842: Simplify the break rule of logical optimizer passes
Posted by GitBox <gi...@apache.org>.
HaoYang670 commented on PR #4842:
URL: https://github.com/apache/arrow-datafusion/pull/4842#issuecomment-1374763405
Thank you for your review @jackwener and @alamb 😁.
> Sometimes, plan didn't changed, some rule also will return Ok(Some()).
e.g: some rule recurse inside themselves, and alway return Ok(Some())
Hi @jackwener, is this the expected behavior or a known bug that hasn't been fixed yet?
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: github-unsubscribe@arrow.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org