Skip to content

Commit fd65f12

Browse files
committed
refactor: use true_count for filtered row counts
1 parent 995c187 commit fd65f12

1 file changed

Lines changed: 1 addition & 7 deletions

File tree

‎datafusion/functions-aggregate-common/src/aggregate/groups_accumulator.rs‎

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -867,13 +867,7 @@ fn get_filter_at_indices(
867867

868868
fn filtered_row_count(opt_filter: Option<&BooleanArray>, offsets: &[usize]) -> usize {
869869
let (offset, length) = (offsets[0], offsets[1] - offsets[0]);
870-
opt_filter.map_or(length, |filter| {
871-
filter
872-
.slice(offset, length)
873-
.iter()
874-
.filter(|value| matches!(value, Some(true)))
875-
.count()
876-
})
870+
opt_filter.map_or(length, |filter| filter.slice(offset, length).true_count())
877871
}
878872

879873
fn update_accumulator(

0 commit comments

Comments
 (0)