yyy1000 commented on code in PR #8780:
URL: https://github.com/apache/arrow-datafusion/pull/8780#discussion_r1460707683
##########
datafusion/optimizer/src/simplify_expressions/simplify_exprs.rs:
##########
@@ -93,16 +93,31 @@ impl SimplifyExpressions {
.map(|input| Self::optimize_internal(input, execution_props))
.collect::<Result<Vec<_>>>()?;
- let expr = plan
- .expressions()
- .into_iter()
- .map(|e| {
- // TODO: unify with `rewrite_preserving_name`
- let original_name = e.name_for_alias()?;
- let new_e = simplifier.simplify(e)?;
- new_e.alias_if_changed(original_name)
- })
- .collect::<Result<Vec<_>>>()?;
+ let expr = match plan {
+ LogicalPlan::Join(_) => {
+ plan
+ .expressions()
+ .into_iter()
+ .map(|e| {
+ // TODO: unify with `rewrite_preserving_name`
+ let original_name = e.name_for_alias()?;
+ let new_e = simplifier.simplify(e)?;
+ new_e.alias_if_changed(original_name)
+ }).collect::<Result<Vec<_>>>()?
+ },
+ _ => {
+ plan
Review Comment:
This is what I tried for the second method, I define a new function called
`canonicalize` in `simplifier`.
And the rule `SimplifyExpressions` will call this if the `plan` is not
`Join`.
I didn't change the current `simplify` function because I think add a param
to judge whether the `Expr` is from a `Join` plan would break a lot.
--
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: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]