You are viewing a plain text version of this content. The canonical link for it is here.
Posted to github@arrow.apache.org by "alamb (via GitHub)" <gi...@apache.org> on 2023/07/02 11:18:07 UTC

[GitHub] [arrow-datafusion] alamb commented on a diff in pull request #6820: fix: from_plan generate Agg can be with different schema.

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


##########
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 (the schema should always be unchanged if the same expressions are used)
   
   Is this a change to make the code more defensive, or do you think it is causing a problem?
   
   Related, perhaps we should remove `Aggregate::try_new_with_schema` as well (to force the recalculation / validation of the output 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: github-unsubscribe@arrow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org