Rachelint commented on code in PR #11943:
URL: https://github.com/apache/datafusion/pull/11943#discussion_r1723565362


##########
datafusion/functions-aggregate/src/count.rs:
##########
@@ -372,13 +381,27 @@ impl GroupsAccumulator for CountGroupsAccumulator {
 
         // Add one to each group's counter for each non null, non
         // filtered value
-        self.counts.resize(total_num_groups, 0);
+        ensure_enough_room_for_values(&mut self.counts, self.mode, 
total_num_groups, 0);
+
         accumulate_indices(
             group_indices,
             values.logical_nulls().as_ref(),
             opt_filter,
             |group_index| {
-                self.counts[group_index] += 1;
+                let count = match self.mode {

Review Comment:
   > I wonder if it makes any difference to move this check out of the loop 
(specialize call to `accumulate_indices` for each `self.mode`)
   
   Seems no difference and can slightly improve performance? I am trying it.



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


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to