andygrove commented on code in PR #268:
URL:
https://github.com/apache/arrow-datafusion-comet/pull/268#discussion_r1566463015
##########
core/src/execution/datafusion/planner.rs:
##########
@@ -1094,8 +1094,15 @@ impl PhysicalPlanner {
) -> Result<Arc<dyn AggregateExpr>, ExecutionError> {
match spark_expr.expr_struct.as_ref().unwrap() {
AggExprStruct::Count(expr) => {
- let child = self.create_expr(&expr.children[0], schema)?;
- Ok(Arc::new(Count::new(child, "count", DataType::Int64)))
+ let mut children = vec![];
+ for child in expr.children.iter() {
+ children.push(self.create_expr(child, schema.clone())?);
+ }
Review Comment:
This could be written in a functional style to avoid mutating state.
```suggestion
let children = expr
.children
.iter()
.map(|child| self.create_expr(child, schema.clone()))
.collect::<Result<Vec<_>, _>>()?;
```
--
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]