andygrove commented on code in PR #3305:
URL: https://github.com/apache/arrow-datafusion/pull/3305#discussion_r959627345
##########
datafusion/optimizer/src/single_distinct_to_groupby.rs:
##########
@@ -86,64 +101,66 @@ fn optimize(plan: &LogicalPlan) -> Result<LogicalPlan> {
distinct: false,
}
}
- _ => agg_expr.clone(),
+ _ => aggr_expr.clone(),
})
.collect::<Vec<_>>();
- let all_group_expr =
grouping_set_to_exprlist(&all_group_args)?;
-
- let all_field = all_group_expr
+ // construct the inner AggrPlan
+ let inner_fields = inner_group_exprs
.iter()
.map(|expr| expr.to_field(input.schema()).unwrap())
.collect::<Vec<_>>();
-
- let grouped_schema = DFSchema::new_with_metadata(
- all_field,
+ let inner_schema = DFSchema::new_with_metadata(
+ inner_fields,
input.schema().metadata().clone(),
)
.unwrap();
- let grouped_agg = LogicalPlan::Aggregate(Aggregate {
+ let grouped_aggr = LogicalPlan::Aggregate(Aggregate {
Review Comment:
Please use `Aggregate::try_new` here, once
https://github.com/apache/arrow-datafusion/pull/3286 is merged
--
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]