rtpsw commented on code in PR #34904:
URL: https://github.com/apache/arrow/pull/34904#discussion_r1163804001


##########
cpp/src/arrow/acero/aggregate_node.cc:
##########
@@ -665,14 +680,47 @@ class GroupByNode : public ExecNode, public TracedNode {
     }
     base += segment_keys.size();
     for (size_t i = 0; i < aggs.size(); ++i) {
-      output_fields[base + i] =
-          agg_result_fields[i]->WithName(aggregate_options.aggregates[i].name);
+      output_fields[base + i] = agg_result_fields[i]->WithName(aggs[i].name);
+    }
+
+    return 
AggregateNodeArgs<HashAggregateKernel>{schema(std::move(output_fields)),
+                                                  std::move(key_field_ids),
+                                                  
std::move(segment_key_field_ids),
+                                                  std::move(segmenter),
+                                                  std::move(agg_src_fieldsets),
+                                                  std::move(aggs),
+                                                  std::move(agg_kernels),
+                                                  std::move(agg_src_types),
+                                                  /*states=*/{}};

Review Comment:
   Technically, this is because `GroupByNode` does not take states in [its 
constructor](https://github.com/apache/arrow/blob/d9e672f40e831dd8f6a73a21b3a9bebfc35c5a45/cpp/src/arrow/acero/aggregate_node.cc#L543-L549)
 whereas `ScalarAggregateNode` 
[does](https://github.com/apache/arrow/blob/d9e672f40e831dd8f6a73a21b3a9bebfc35c5a45/cpp/src/arrow/acero/aggregate_node.cc#L257-L265).
 I don't think there is a real design justification for this difference; I just 
didn't change the original design here.



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