Improve simplify_expressions rule#15735
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
| /// ``` | ||
| 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.
Only changed the simplify_with_cycle_count API, keep the simplify API to avoid two API changes.
There was a problem hiding this comment.
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
alamb
left a comment
There was a problem hiding this comment.
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
| /// ``` | ||
| 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.
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::noAre 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?