jackwener commented on code in PR #6820:
URL: https://github.com/apache/arrow-datafusion/pull/6820#discussion_r1249454828


##########
datafusion/expr/src/utils.rs:
##########
@@ -827,14 +827,13 @@ pub fn from_plan(
             window_expr: expr[0..window_expr.len()].to_vec(),
             schema: schema.clone(),
         })),
-        LogicalPlan::Aggregate(Aggregate {
-            group_expr, schema, ..
-        }) => Ok(LogicalPlan::Aggregate(Aggregate::try_new_with_schema(
-            Arc::new(inputs[0].clone()),
-            expr[0..group_expr.len()].to_vec(),
-            expr[group_expr.len()..].to_vec(),
-            schema.clone(),
-        )?)),
+        LogicalPlan::Aggregate(Aggregate { group_expr, .. }) => {

Review Comment:
   > I don't understand when this change would result in a different plan
   
   This change just affect `schema`, It has no effect on Plan itself
   
   > Is this a change to make the code more defensive, or do you think it is 
causing a problem?
   
   it will cause some problem, but it's hidden by other code.
   
   > Related, perhaps we should remove Aggregate::try_new_with_schema as well 
(to force the recalculation / validation of the output schema)?
   
   we don't need delete it, because some condition we don't change expr, such 
`with new inputs`.
   
   In these case, we use `try_new_with_schema` can avoid recompute `schema`



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