-
Notifications
You must be signed in to change notification settings - Fork 1.6k
Improve simplify_expressions
rule
#15735
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
Conversation
I think what we need to do is return datafusion/datafusion/optimizer/src/simplify_expressions/expr_simplifier.rs Lines 201 to 231 in 3818b7a
|
Sounds good, will give a try |
datafusion/optimizer/src/simplify_expressions/simplify_exprs.rs
Outdated
Show resolved
Hide resolved
ecb150c
to
101b80a
Compare
@@ -188,7 +188,7 @@ impl<S: SimplifyInfo> ExprSimplifier<S> { | |||
/// assert_eq!(expr, b_lt_2); | |||
/// ``` | |||
pub fn simplify(&self, expr: Expr) -> Result<Expr> { | |||
Ok(self.simplify_with_cycle_count(expr)?.0) | |||
Ok(self.simplify_with_cycle_count_transformed(expr)?.0.data) |
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.
Only changed the simplify_with_cycle_count
API, keep the simplify
API to avoid two API changes.
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.
Maybe after we merge this one in, it would be worth considering changing the simplify API as well -- but I agree that would be good as a follow on pR
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.
Thank you @xudong963 -- this looks great to me. I'll try and run some planning benchmarks on this too
cc @erratic-pattern as you wrote some of this code initially
@@ -188,7 +188,7 @@ impl<S: SimplifyInfo> ExprSimplifier<S> { | |||
/// assert_eq!(expr, b_lt_2); | |||
/// ``` | |||
pub fn simplify(&self, expr: Expr) -> Result<Expr> { | |||
Ok(self.simplify_with_cycle_count(expr)?.0) | |||
Ok(self.simplify_with_cycle_count_transformed(expr)?.0.data) |
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.
Maybe after we merge this one in, it would be worth considering changing the simplify API as well -- but I agree that would be good as a follow on pR
datafusion/optimizer/src/simplify_expressions/expr_simplifier.rs
Outdated
Show resolved
Hide resolved
BTW I tried to run the planning benchmarks to see if this made things better, but sadly I found a bug: |
Thanks @xudong963 |
* Improve simplify_expressions rule * address comments * address comments
* Improve simplify_expressions rule * address comments * address comments
* Improve simplify_expressions rule * address comments * address comments
Which issue does this PR close?
Rationale for this change
Before:
Now
What changes are included in this PR?
Check if expr is simplified, if not, return
Transformed::no
Are these changes tested?
By existing tests.
For specific influence, it's difficult to check by test, so I put the log to check
Are there any user-facing changes?