alamb commented on code in PR #4733:
URL: https://github.com/apache/arrow-datafusion/pull/4733#discussion_r1057660822


##########
datafusion/optimizer/src/common_subexpr_eliminate.rs:
##########
@@ -254,9 +238,16 @@ impl OptimizerRule for CommonSubexprEliminate {
             | LogicalPlan::Extension(_)
             | LogicalPlan::Prepare(_) => {
                 // apply the optimization to all inputs of the plan
-                Ok(Some(utils::optimize_children(self, plan, config)?))
+                utils::optimize_children(self, plan, config)?
             }
+        };
+
+        // add an additional projection if the output schema changed.
+        if optimized_plan.schema() != &original_schema {

Review Comment:
   👍 



-- 
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]

Reply via email to