Skip to content

Commit

Permalink
count group
Browse files Browse the repository at this point in the history
Signed-off-by: Jay Zhan <[email protected]>
  • Loading branch information
jayzhan211 committed Nov 17, 2024
1 parent 3721e74 commit a889299
Showing 1 changed file with 5 additions and 9 deletions.
14 changes: 5 additions & 9 deletions datafusion/functions-aggregate/src/count.rs
Original file line number Diff line number Diff line change
Expand Up @@ -481,15 +481,11 @@ impl GroupsAccumulator for CountGroupsAccumulator {
// Adds the counts with the partial counts
self.counts.resize(total_num_groups, 0);
match opt_filter {
Some(filter) => filter
.iter()
.zip(group_indices.iter())
.zip(partial_counts.iter())
.for_each(|((filter_value, &group_index), partial_count)| {
if let Some(true) = filter_value {
self.counts[group_index] += partial_count;
}
}),
Some(filter) => {
filter.values().set_indices().for_each(|index| {
self.counts[group_indices[index]] += partial_counts[index]
});
}
None => group_indices.iter().zip(partial_counts.iter()).for_each(
|(&group_index, partial_count)| {
self.counts[group_index] += partial_count;
Expand Down

0 comments on commit a889299

Please sign in to comment.