Repository navigation
test: run microbenchmarks in extended CI #25836
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -23,7 +23,8 @@ use arrow::datatypes::{DataType, Field, Int64Type}; | |
| use criterion::{Criterion, criterion_group, criterion_main}; | ||
| use datafusion_common::ScalarValue; | ||
| use datafusion_common::config::ConfigOptions; | ||
| use datafusion_expr::{ColumnarValue, ScalarFunctionArgs}; | ||
| use datafusion_expr::type_coercion::functions::fields_with_udf; | ||
| use datafusion_expr::{ColumnarValue, ReturnFieldArgs, ScalarFunctionArgs}; | ||
| use datafusion_spark::function::array::slice; | ||
| use rand::rngs::StdRng; | ||
| use rand::{Rng, SeedableRng}; | ||
|
|
@@ -115,6 +116,19 @@ fn array_slice_benchmark( | |
| <Arc<Field>>::from(Field::new(format!("arg_{idx}"), arg.data_type(), true)) | ||
| }) | ||
| .collect::<Vec<_>>(); | ||
| // Apply planner coercion (including ListView to List) before timing the UDF. | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Could we label the ListView cases as |
||
| let arg_fields = fields_with_udf(&arg_fields, array_slice.as_ref()).unwrap(); | ||
| let args = args | ||
| .iter() | ||
| .zip(&arg_fields) | ||
| .map(|(arg, field)| arg.cast_to(field.data_type(), None).unwrap()) | ||
| .collect::<Vec<_>>(); | ||
| let return_field = array_slice | ||
| .return_field_from_args(ReturnFieldArgs { | ||
| arg_fields: &arg_fields, | ||
| scalar_arguments: &vec![None; arg_fields.len()], | ||
| }) | ||
| .unwrap(); | ||
| c.bench_function(name, |b| { | ||
| b.iter(|| { | ||
| black_box( | ||
|
|
@@ -123,8 +137,7 @@ fn array_slice_benchmark( | |
| args: args.clone(), | ||
| arg_fields: arg_fields.clone(), | ||
| number_rows: size, | ||
| return_field: Field::new_list_field(args[0].data_type(), true) | ||
| .into(), | ||
| return_field: Arc::clone(&return_field), | ||
| config_options: Arc::new(ConfigOptions::default()), | ||
| }) | ||
| .unwrap(), | ||
|
|
@@ -161,7 +174,10 @@ fn criterion_benchmark(c: &mut Criterion) { | |
| let scalar_to = ColumnarValue::Scalar(ScalarValue::from(child_array_size as i64 / 2)); | ||
|
|
||
| for input in [list_array, list_view_array] { | ||
| let input_type = input.data_type().to_string(); | ||
| let input_type = match input.data_type() { | ||
| DataType::ListView(_) => "ListView -> List (coercion excluded)".to_string(), | ||
| _ => input.data_type().to_string(), | ||
| }; | ||
|
|
||
| array_slice_benchmark( | ||
| &format!("slice: input {input_type}, array args, no stride"), | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Optional: could we check once outside the timed loop that the overflow error contains
string size overflow on repeat?expect_erralso accepts unrelated errors. The production regression test already checks this diagnostic, so this is only a smoke-check improvement.