Rachelint commented on code in PR #11943: URL: https://github.com/apache/datafusion/pull/11943#discussion_r1723581246
########## 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: It is very well and I have refactored following the comment. The reason why some queries unable to use the blocked optimization slower may be due to this. -- 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-unsubscr...@datafusion.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org --------------------------------------------------------------------- To unsubscribe, e-mail: github-unsubscr...@datafusion.apache.org For additional commands, e-mail: github-h...@datafusion.apache.org