Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
86 changes: 86 additions & 0 deletions arrow/benches/coalesce_kernels.rs
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
//! Benchmarks for the `coalesce` kernels in Arrow.
use arrow::util::bench_util::*;
use arrow::util::data_gen::create_random_array;
use std::sync::Arc;

use arrow::array::*;
Expand Down Expand Up @@ -105,6 +106,29 @@ fn add_all_filter_benchmarks(c: &mut Criterion) {
// TODO model other dictionary types here (FixedSizeBinary for example)
]));

let single_dictionary_schema = SchemaRef::new(Schema::new(vec![Field::new(
"value",
DataType::Dictionary(Box::new(DataType::Int32), Box::new(DataType::Utf8)),
true,
)]));

let single_run_end_schema = SchemaRef::new(Schema::new(vec![Field::new(
"value",
DataType::RunEndEncoded(
Arc::new(Field::new(
Field::REE_RUN_ENDS_FIELD_DEFAULT_NAME,
DataType::Int32,
false,
)),
Arc::new(Field::new(
Field::REE_VALUES_FIELD_DEFAULT_NAME,
DataType::Int32,
true,
)),
),
true,
)]));

let single_fsb16_schema = SchemaRef::new(Schema::new(vec![Field::new(
"value",
DataType::FixedSizeBinary(16),
Expand Down Expand Up @@ -320,6 +344,18 @@ fn add_all_filter_benchmarks(c: &mut Criterion) {
}
.build();

FilterBenchmarkBuilder {
c,
name: "single_dict",
batch_size,
num_output_batches: 25,
null_density,
selectivity,
max_string_len: 30,
schema: &single_dictionary_schema,
}
.build();

FilterBenchmarkBuilder {
c,
name: "single_fsb16",
Expand Down Expand Up @@ -356,6 +392,18 @@ fn add_all_filter_benchmarks(c: &mut Criterion) {
}
.build();

FilterBenchmarkBuilder {
c,
name: "single_ree",
batch_size,
num_output_batches: 25,
null_density,
selectivity,
max_string_len: 0,
schema: &single_run_end_schema,
}
.build();

FilterBenchmarkBuilder {
c,
name: "single_fsl4",
Expand Down Expand Up @@ -470,6 +518,29 @@ fn add_all_gather_benchmarks(c: &mut Criterion, operation: GatherOperation) {
Field::new("float_val2", DataType::Float64, true),
]));

let single_dictionary_schema = SchemaRef::new(Schema::new(vec![Field::new(
"value",
DataType::Dictionary(Box::new(DataType::Int32), Box::new(DataType::Utf8)),
true,
)]));

let single_run_end_schema = SchemaRef::new(Schema::new(vec![Field::new(
"value",
DataType::RunEndEncoded(
Arc::new(Field::new(
Field::REE_RUN_ENDS_FIELD_DEFAULT_NAME,
DataType::Int32,
false,
)),
Arc::new(Field::new(
Field::REE_VALUES_FIELD_DEFAULT_NAME,
DataType::Int32,
true,
)),
),
true,
)]));

let single_fsb16_schema = SchemaRef::new(Schema::new(vec![Field::new(
"value",
DataType::FixedSizeBinary(16),
Expand Down Expand Up @@ -568,6 +639,12 @@ fn add_all_gather_benchmarks(c: &mut Criterion, operation: GatherOperation) {
max_string_len: 30,
schema: &mixed_dict_schema,
},
GatherBenchmarkScenario {
name: "single_dict",
num_output_batches: 25,
max_string_len: 30,
schema: &single_dictionary_schema,
},
GatherBenchmarkScenario {
name: "single_fsb16",
num_output_batches: 50,
Expand All @@ -586,6 +663,12 @@ fn add_all_gather_benchmarks(c: &mut Criterion, operation: GatherOperation) {
max_string_len: 0,
schema: &single_boolean_schema,
},
GatherBenchmarkScenario {
name: "single_ree",
num_output_batches: 25,
max_string_len: 0,
schema: &single_run_end_schema,
},
GatherBenchmarkScenario {
name: "single_fsl4",
num_output_batches: 50,
Expand Down Expand Up @@ -1385,6 +1468,9 @@ impl DataStreamBuilder {
10,
seed,
)),
DataType::RunEndEncoded(_, _) => {
create_random_array(field, self.batch_size, self.null_density, 0.5).unwrap()
}
_ => panic!("Unsupported data type: {field:?}"),
}
}
Expand Down
Loading