Skip to content

Commit

Permalink
clippy
Browse files Browse the repository at this point in the history
Signed-off-by: jayzhan211 <jayzhan211@gmail.com>
  • Loading branch information
jayzhan211 committed Nov 18, 2024
1 parent ef8a859 commit 568f749
Showing 1 changed file with 8 additions and 8 deletions.
16 changes: 8 additions & 8 deletions datafusion/functions-aggregate-common/benches/accumulate.rs
Original file line number Diff line number Diff line change
Expand Up @@ -20,11 +20,11 @@ extern crate criterion;
use std::sync::Arc;

use arrow::array::{ArrayRef, BooleanArray, Int64Array};
use criterion::{black_box, criterion_group, criterion_main, Criterion};
use criterion::{criterion_group, criterion_main, Criterion};
use datafusion_functions_aggregate_common::aggregate::groups_accumulator::accumulate::accumulate_indices;

fn generate_group_indices(len: usize) -> Vec<usize> {
(0..len).map(|i| i).collect()
(0..len).collect()
}

fn generate_values(len: usize, has_null: bool) -> ArrayRef {
Expand Down Expand Up @@ -72,41 +72,41 @@ fn criterion_benchmark(c: &mut Criterion) {

c.bench_function("Handle both nulls and filter", |b| {
b.iter(|| {
black_box(accumulate_indices(
accumulate_indices(
&group_indices,
values.logical_nulls().as_ref(),
opt_filter.as_ref(),
|group_index| {
counts[group_index] += 1;
},
));
);
})
});

c.bench_function("Handle nulls only", |b| {
b.iter(|| {
black_box(accumulate_indices(
accumulate_indices(
&group_indices,
values.logical_nulls().as_ref(),
None,
|group_index| {
counts[group_index] += 1;
},
));
);
})
});

let values = generate_values(len, false);
c.bench_function("Handle filter only", |b| {
b.iter(|| {
black_box(accumulate_indices(
accumulate_indices(
&group_indices,
values.logical_nulls().as_ref(),
opt_filter.as_ref(),
|group_index| {
counts[group_index] += 1;
},
));
);
})
});
}
Expand Down

0 comments on commit 568f749

Please sign in to comment.