alamb commented on code in PR #4888:
URL: https://github.com/apache/arrow-datafusion/pull/4888#discussion_r1069120955
##########
datafusion/optimizer/src/common_subexpr_eliminate.rs:
##########
@@ -242,12 +245,16 @@ impl OptimizerRule for CommonSubexprEliminate {
}
};
- // add an additional projection if the output schema changed.
- if optimized_plan.schema() != &original_schema {
- optimized_plan = build_recover_project_plan(&original_schema,
optimized_plan);
+ match optimized_plan {
+ Some(optimized_plan) if optimized_plan.schema() !=
&original_schema => {
+ // add an additional projection if the output schema changed.
+ Ok(Some(build_recover_project_plan(
+ &original_schema,
+ optimized_plan,
+ )))
+ }
+ plan => Ok(plan),
Review Comment:
You might be able to do this something like
```suggestion
optimized_plan.map(|optimized_plan| {
if optimized_plan.schema() != &original_schema => {
// add an additional projection if the output schema changed.
build_recover_project_plan(
&original_schema,
optimized_plan,
)
});
```
Not sure if that is all that much better
--
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]