Skip to content

Commit

Permalink
cargo fmt
Browse files Browse the repository at this point in the history
  • Loading branch information
ctsk committed Feb 13, 2025
1 parent 5a88a02 commit 2961710
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 8 deletions.
16 changes: 9 additions & 7 deletions datafusion/physical-plan/benches/partial_ordering.rs
Original file line number Diff line number Diff line change
Expand Up @@ -23,15 +23,13 @@ use criterion::{criterion_group, criterion_main, Criterion};
use datafusion_physical_expr::{expressions::col, LexOrdering, PhysicalSortExpr};
use datafusion_physical_plan::aggregates::order::GroupOrderingPartial;



const BATCH_SIZE: usize = 8192;

fn create_test_arrays(num_columns: usize) -> Vec<ArrayRef> {
(0..num_columns)
.map(|i| {
Arc::new(Int32Array::from_iter_values(
(0..BATCH_SIZE as i32).map(|x| x * (i + 1) as i32)
(0..BATCH_SIZE as i32).map(|x| x * (i + 1) as i32),
)) as ArrayRef
})
.collect()
Expand Down Expand Up @@ -61,15 +59,19 @@ fn bench_new_groups(c: &mut Criterion) {
group.bench_function(format!("order_indices_{}", num_columns), |b| {
let batch_group_values = create_test_arrays(num_columns);
let group_indices: Vec<usize> = (0..BATCH_SIZE).collect();

b.iter(|| {
let mut ordering = GroupOrderingPartial::try_new(&schema, &order_indices, &ordering).unwrap();
ordering.new_groups(&batch_group_values, &group_indices, BATCH_SIZE).unwrap();
let mut ordering =
GroupOrderingPartial::try_new(&schema, &order_indices, &ordering)
.unwrap();
ordering
.new_groups(&batch_group_values, &group_indices, BATCH_SIZE)
.unwrap();
});
});
}
group.finish();
}

criterion_group!(benches, bench_new_groups);
criterion_main!(benches);
criterion_main!(benches);
2 changes: 1 addition & 1 deletion datafusion/physical-plan/src/aggregates/order/partial.rs
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,9 @@
// under the License.

use arrow::array::ArrayRef;
use arrow_ord::partition::partition;
use arrow::compute::SortOptions;
use arrow::datatypes::Schema;
use arrow_ord::partition::partition;
use datafusion_common::utils::{compare_rows, get_row_at_idx};
use datafusion_common::{Result, ScalarValue};
use datafusion_execution::memory_pool::proxy::VecAllocExt;
Expand Down

0 comments on commit 2961710

Please sign in to comment.