Skip to content

Apache DataFusion SQL Query Engine

bench(functions): Improve build time by reducing 63 `bench` targets into 9 (#24342)

Daniël Heres584c30d28f8c
diff --git a/datafusion/functions/Cargo.toml b/datafusion/functions/Cargo.toml
index a170e9f07c..00d1531a3a 100644
--- a/datafusion/functions/Cargo.toml
+++ b/datafusion/functions/Cargo.toml
@@ -100,270 +100,34 @@ tokio = { workspace = true, features = ["macros", "rt", "sync"] }
[[bench]]
harness = false
-name = "replace_scalar"
-required-features = ["string_expressions"]
-
-[[bench]]
-harness = false
-name = "round_dense"
-required-features = ["math_expressions"]
-
-[[bench]]
-harness = false
-name = "ascii"
-required-features = ["string_expressions"]
-
-[[bench]]
-harness = false
-name = "concat"
-required-features = ["string_expressions"]
-
-[[bench]]
-harness = false
-name = "concat_ws"
-required-features = ["string_expressions"]
-
-[[bench]]
-harness = false
-name = "to_timestamp"
+name = "datetime_expressions"
required-features = ["datetime_expressions"]
[[bench]]
harness = false
-name = "encoding"
-required-features = ["encoding_expressions"]
-
-[[bench]]
-harness = false
-name = "chr"
-required-features = ["string_expressions"]
-
-[[bench]]
-harness = false
-name = "gcd"
-required-features = ["math_expressions"]
-
-[[bench]]
-harness = false
-name = "lcm"
-required-features = ["math_expressions"]
-
-[[bench]]
-harness = false
-name = "nanvl"
+name = "math_expressions"
required-features = ["math_expressions"]
[[bench]]
harness = false
-name = "uuid"
-required-features = ["string_expressions"]
-
-[[bench]]
-harness = false
-name = "to_hex"
-required-features = ["string_expressions"]
-
-[[bench]]
-harness = false
-name = "regexp_match"
-required-features = ["regex_expressions"]
+name = "misc"
+required-features = []
[[bench]]
harness = false
-name = "regx"
+name = "regex_expressions"
required-features = ["regex_expressions"]
[[bench]]
harness = false
-name = "make_date"
-required-features = ["datetime_expressions"]
-
-[[bench]]
-harness = false
-name = "iszero"
-required-features = ["math_expressions"]
-
-[[bench]]
-harness = false
-name = "nullif"
-
-[[bench]]
-harness = false
-name = "date_bin"
-required-features = ["datetime_expressions"]
-
-[[bench]]
-harness = false
-name = "date_trunc"
-required-features = ["datetime_expressions"]
-
-[[bench]]
-harness = false
-name = "date_part"
-required-features = ["datetime_expressions"]
-
-[[bench]]
-harness = false
-name = "to_char"
-required-features = ["datetime_expressions"]
-
-[[bench]]
-harness = false
-name = "to_local_time"
-required-features = ["datetime_expressions"]
-
-[[bench]]
-harness = false
-name = "to_time"
-required-features = ["datetime_expressions"]
-
-[[bench]]
-harness = false
-name = "isnan"
-required-features = ["math_expressions"]
-
-[[bench]]
-harness = false
-name = "signum"
-required-features = ["math_expressions"]
-
-[[bench]]
-harness = false
-name = "atan2"
-required-features = ["math_expressions"]
-
-[[bench]]
-harness = false
-name = "power"
-required-features = ["math_expressions"]
-
-[[bench]]
-harness = false
-name = "substr_index"
-required-features = ["unicode_expressions"]
-
-[[bench]]
-harness = false
-name = "trim"
-required-features = ["string_expressions"]
-
-[[bench]]
-harness = false
-name = "lower"
+name = "string_expressions"
required-features = ["string_expressions"]
[[bench]]
harness = false
-name = "upper"
-
-[[bench]]
-harness = false
-name = "upper_unicode"
-required-features = ["string_expressions"]
-
-[[bench]]
-harness = false
-name = "pad"
-required-features = ["unicode_expressions"]
-
-[[bench]]
-harness = false
-name = "repeat"
-required-features = ["string_expressions"]
-
-[[bench]]
-harness = false
-name = "replace"
-required-features = ["string_expressions"]
-
-[[bench]]
-harness = false
-name = "overlay"
-
-[[bench]]
-harness = false
-name = "random"
-required-features = ["math_expressions"]
-
-[[bench]]
-harness = false
-name = "substr"
-required-features = ["unicode_expressions"]
-
-[[bench]]
-harness = false
-name = "character_length"
-required-features = ["unicode_expressions"]
-
-[[bench]]
-harness = false
-name = "cot"
-required-features = ["math_expressions"]
-
-[[bench]]
-harness = false
-name = "strpos"
-required-features = ["unicode_expressions"]
-
-[[bench]]
-harness = false
-name = "reverse"
-required-features = ["unicode_expressions"]
-
-[[bench]]
-harness = false
-name = "trunc"
-required-features = ["math_expressions"]
-
-[[bench]]
-harness = false
-name = "trunc_precision"
-required-features = ["math_expressions"]
-
-[[bench]]
-harness = false
-name = "initcap"
-required-features = ["unicode_expressions"]
-
-[[bench]]
-harness = false
-name = "find_in_set"
-required-features = ["unicode_expressions"]
-
-[[bench]]
-harness = false
-name = "find_in_set_literal"
+name = "unicode_expressions"
required-features = ["unicode_expressions"]
-[[bench]]
-harness = false
-name = "contains"
-required-features = ["string_expressions"]
-
-[[bench]]
-harness = false
-name = "starts_with"
-required-features = ["string_expressions"]
-
-[[bench]]
-harness = false
-name = "ends_with"
-required-features = ["string_expressions"]
-
-[[bench]]
-harness = false
-name = "regexp_count"
-required-features = ["regex_expressions"]
-
-[[bench]]
-harness = false
-name = "regexp_instr"
-required-features = ["regex_expressions"]
-
-[[bench]]
-harness = false
-name = "get_field"
-
[[bench]]
harness = false
name = "crypto"
@@ -371,40 +135,10 @@ required-features = ["crypto_expressions"]
[[bench]]
harness = false
-name = "translate"
-required-features = ["unicode_expressions"]
-
-[[bench]]
-harness = false
-name = "levenshtein"
-required-features = ["unicode_expressions"]
-
-[[bench]]
-harness = false
-name = "split_part"
-required-features = ["string_expressions"]
-
-[[bench]]
-harness = false
-name = "left_right"
-required-features = ["unicode_expressions"]
-
-[[bench]]
-harness = false
-name = "factorial"
-required-features = ["math_expressions"]
-
-[[bench]]
-harness = false
-name = "floor_ceil"
-required-features = ["math_expressions"]
-
-[[bench]]
-harness = false
-name = "round"
-required-features = ["math_expressions"]
+name = "dictionary_encoding"
+required-features = ["string_expressions", "unicode_expressions"]
[[bench]]
harness = false
-name = "dictionary_encoding"
-required-features = ["string_expressions", "unicode_expressions"]
+name = "encoding"
+required-features = ["encoding_expressions"]
diff --git a/datafusion/functions/benches/date_bin.rs b/datafusion/functions/benches/datetime_expressions/date_bin.rs
similarity index 96%
rename from datafusion/functions/benches/date_bin.rs
rename to datafusion/functions/benches/datetime_expressions/date_bin.rs
index bae1438fa4..d5a29ce1f3 100644
--- a/datafusion/functions/benches/date_bin.rs
+++ b/datafusion/functions/benches/datetime_expressions/date_bin.rs
@@ -20,7 +20,7 @@ use std::sync::Arc;
use arrow::array::{Array, ArrayRef, TimestampSecondArray};
use arrow::datatypes::Field;
-use criterion::{Criterion, criterion_group, criterion_main};
+use criterion::{Criterion, criterion_group};
use datafusion_common::ScalarValue;
use datafusion_common::config::ConfigOptions;
use datafusion_expr::{ColumnarValue, ScalarFunctionArgs};
@@ -71,4 +71,3 @@ fn criterion_benchmark(c: &mut Criterion) {
}
criterion_group!(benches, criterion_benchmark);
-criterion_main!(benches);
diff --git a/datafusion/functions/benches/date_part.rs b/datafusion/functions/benches/datetime_expressions/date_part.rs
similarity index 99%
rename from datafusion/functions/benches/date_part.rs
rename to datafusion/functions/benches/datetime_expressions/date_part.rs
index fb93ebd03b..aa4b3e1dba 100644
--- a/datafusion/functions/benches/date_part.rs
+++ b/datafusion/functions/benches/datetime_expressions/date_part.rs
@@ -27,7 +27,7 @@ use arrow::array::{
TimestampNanosecondArray, TimestampSecondArray,
};
use arrow::datatypes::{DataType, Field};
-use criterion::{Criterion, criterion_group, criterion_main};
+use criterion::{Criterion, criterion_group};
use datafusion_common::ScalarValue;
use datafusion_common::config::ConfigOptions;
use datafusion_expr::{ColumnarValue, ScalarFunctionArgs, ScalarUDF};
@@ -346,4 +346,3 @@ fn criterion_benchmark(c: &mut Criterion) {
}
criterion_group!(benches, criterion_benchmark);
-criterion_main!(benches);
diff --git a/datafusion/functions/benches/date_trunc.rs b/datafusion/functions/benches/datetime_expressions/date_trunc.rs
similarity index 97%
rename from datafusion/functions/benches/date_trunc.rs
rename to datafusion/functions/benches/datetime_expressions/date_trunc.rs
index e2372fff2a..b00c2b4a60 100644
--- a/datafusion/functions/benches/date_trunc.rs
+++ b/datafusion/functions/benches/datetime_expressions/date_trunc.rs
@@ -20,7 +20,7 @@ use std::sync::Arc;
use arrow::array::{Array, ArrayRef, TimestampNanosecondArray, TimestampSecondArray};
use arrow::datatypes::Field;
-use criterion::{Criterion, criterion_group, criterion_main};
+use criterion::{Criterion, criterion_group};
use datafusion_common::ScalarValue;
use datafusion_common::config::ConfigOptions;
use datafusion_expr::{ColumnarValue, ReturnFieldArgs, ScalarFunctionArgs};
@@ -110,4 +110,3 @@ fn criterion_benchmark(c: &mut Criterion) {
}
criterion_group!(benches, criterion_benchmark);
-criterion_main!(benches);
diff --git a/datafusion/functions/benches/datetime_expressions/main.rs b/datafusion/functions/benches/datetime_expressions/main.rs
new file mode 100644
index 0000000000..85788f9431
--- /dev/null
+++ b/datafusion/functions/benches/datetime_expressions/main.rs
@@ -0,0 +1,45 @@
+// Licensed to the Apache Software Foundation (ASF) under one
+// or more contributor license agreements. See the NOTICE file
+// distributed with this work for additional information
+// regarding copyright ownership. The ASF licenses this file
+// to you under the Apache License, Version 2.0 (the
+// "License"); you may not use this file except in compliance
+// with the License. You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing,
+// software distributed under the License is distributed on an
+// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+// KIND, either express or implied. See the License for the
+// specific language governing permissions and limitations
+// under the License.
+
+//! Benchmarks for functions behind the `datetime_expressions` feature.
+//!
+//! Each benchmark beside this file is a module rather than its own `[[bench]]`
+//! target to reduce compile times and output size.
+//!
+//! Run one of them with `cargo bench --bench datetime_expressions -- <filter>`.
+
+use criterion::criterion_main;
+
+mod date_bin;
+mod date_part;
+mod date_trunc;
+mod make_date;
+mod to_char;
+mod to_local_time;
+mod to_time;
+mod to_timestamp;
+
+criterion_main!(
+ date_bin::benches,
+ date_part::benches,
+ date_trunc::benches,
+ make_date::benches,
+ to_char::benches,
+ to_local_time::benches,
+ to_time::benches,
+ to_timestamp::benches,
+);
diff --git a/datafusion/functions/benches/make_date.rs b/datafusion/functions/benches/datetime_expressions/make_date.rs
similarity index 98%
rename from datafusion/functions/benches/make_date.rs
rename to datafusion/functions/benches/datetime_expressions/make_date.rs
index 2e82a871eb..8b23e9d35b 100644
--- a/datafusion/functions/benches/make_date.rs
+++ b/datafusion/functions/benches/datetime_expressions/make_date.rs
@@ -20,7 +20,7 @@ use std::sync::Arc;
use arrow::array::{Array, ArrayRef, Int32Array};
use arrow::datatypes::{DataType, Field};
-use criterion::{Criterion, criterion_group, criterion_main};
+use criterion::{Criterion, criterion_group};
use datafusion_common::ScalarValue;
use datafusion_common::config::ConfigOptions;
use datafusion_expr::{ColumnarValue, ScalarFunctionArgs};
@@ -173,4 +173,3 @@ fn criterion_benchmark(c: &mut Criterion) {
}
criterion_group!(benches, criterion_benchmark);
-criterion_main!(benches);
diff --git a/datafusion/functions/benches/to_char.rs b/datafusion/functions/benches/datetime_expressions/to_char.rs
similarity index 99%
rename from datafusion/functions/benches/to_char.rs
rename to datafusion/functions/benches/datetime_expressions/to_char.rs
index 8a9497bb33..2be28806c9 100644
--- a/datafusion/functions/benches/to_char.rs
+++ b/datafusion/functions/benches/datetime_expressions/to_char.rs
@@ -22,7 +22,7 @@ use arrow::array::{ArrayRef, Date32Array, Date64Array, StringArray};
use arrow::datatypes::{DataType, Field};
use chrono::TimeDelta;
use chrono::prelude::*;
-use criterion::{Criterion, criterion_group, criterion_main};
+use criterion::{Criterion, criterion_group};
use datafusion_common::ScalarValue;
use datafusion_common::config::ConfigOptions;
use datafusion_expr::{ColumnarValue, ScalarFunctionArgs};
@@ -339,4 +339,3 @@ fn criterion_benchmark(c: &mut Criterion) {
}
criterion_group!(benches, criterion_benchmark);
-criterion_main!(benches);
diff --git a/datafusion/functions/benches/to_local_time.rs b/datafusion/functions/benches/datetime_expressions/to_local_time.rs
similarity index 97%
rename from datafusion/functions/benches/to_local_time.rs
rename to datafusion/functions/benches/datetime_expressions/to_local_time.rs
index 04440bf0ac..f29453e326 100644
--- a/datafusion/functions/benches/to_local_time.rs
+++ b/datafusion/functions/benches/datetime_expressions/to_local_time.rs
@@ -20,7 +20,7 @@ use std::sync::Arc;
use arrow::array::{Array, ArrayRef, TimestampNanosecondArray};
use arrow::datatypes::Field;
-use criterion::{Criterion, criterion_group, criterion_main};
+use criterion::{Criterion, criterion_group};
use datafusion_common::config::ConfigOptions;
use datafusion_expr::{ColumnarValue, ScalarFunctionArgs};
use datafusion_functions::datetime::to_local_time;
@@ -86,4 +86,3 @@ fn criterion_benchmark(c: &mut Criterion) {
}
criterion_group!(benches, criterion_benchmark);
-criterion_main!(benches);
diff --git a/datafusion/functions/benches/to_time.rs b/datafusion/functions/benches/datetime_expressions/to_time.rs
similarity index 97%
rename from datafusion/functions/benches/to_time.rs
rename to datafusion/functions/benches/datetime_expressions/to_time.rs
index f4499e2a7d..953d2c80c5 100644
--- a/datafusion/functions/benches/to_time.rs
+++ b/datafusion/functions/benches/datetime_expressions/to_time.rs
@@ -20,7 +20,7 @@ use std::sync::Arc;
use arrow::array::{Array, ArrayRef, StringArray};
use arrow::datatypes::Field;
-use criterion::{Criterion, criterion_group, criterion_main};
+use criterion::{Criterion, criterion_group};
use datafusion_common::config::ConfigOptions;
use datafusion_expr::{ColumnarValue, ScalarFunctionArgs};
use datafusion_functions::datetime::to_time;
@@ -90,4 +90,3 @@ fn criterion_benchmark(c: &mut Criterion) {
}
criterion_group!(benches, criterion_benchmark);
-criterion_main!(benches);
diff --git a/datafusion/functions/benches/to_timestamp.rs b/datafusion/functions/benches/datetime_expressions/to_timestamp.rs
similarity index 99%
rename from datafusion/functions/benches/to_timestamp.rs
rename to datafusion/functions/benches/datetime_expressions/to_timestamp.rs
index 90ea145d5d..79a9395a6e 100644
--- a/datafusion/functions/benches/to_timestamp.rs
+++ b/datafusion/functions/benches/datetime_expressions/to_timestamp.rs
@@ -22,7 +22,7 @@ use arrow::array::builder::StringBuilder;
use arrow::array::{Array, ArrayRef, StringArray};
use arrow::compute::cast;
use arrow::datatypes::{DataType, Field, TimeUnit};
-use criterion::{Criterion, criterion_group, criterion_main};
+use criterion::{Criterion, criterion_group};
use datafusion_common::config::ConfigOptions;
use datafusion_expr::{ColumnarValue, ScalarFunctionArgs};
use datafusion_functions::datetime::to_timestamp;
@@ -302,4 +302,3 @@ fn criterion_benchmark(c: &mut Criterion) {
}
criterion_group!(benches, criterion_benchmark);
-criterion_main!(benches);
diff --git a/datafusion/functions/benches/atan2.rs b/datafusion/functions/benches/math_expressions/atan2.rs
similarity index 98%
rename from datafusion/functions/benches/atan2.rs
rename to datafusion/functions/benches/math_expressions/atan2.rs
index f1c9756a0c..e1f6727e40 100644
--- a/datafusion/functions/benches/atan2.rs
+++ b/datafusion/functions/benches/math_expressions/atan2.rs
@@ -15,11 +15,9 @@
// specific language governing permissions and limitations
// under the License.
-extern crate criterion;
-
use arrow::datatypes::{DataType, Field, Float32Type, Float64Type};
use arrow::util::bench_util::create_primitive_array;
-use criterion::{Criterion, criterion_group, criterion_main};
+use criterion::{Criterion, criterion_group};
use datafusion_common::ScalarValue;
use datafusion_common::config::ConfigOptions;
use datafusion_expr::{ColumnarValue, ScalarFunctionArgs};
@@ -143,4 +141,3 @@ fn criterion_benchmark(c: &mut Criterion) {
}
criterion_group!(benches, criterion_benchmark);
-criterion_main!(benches);
diff --git a/datafusion/functions/benches/cot.rs b/datafusion/functions/benches/math_expressions/cot.rs
similarity index 98%
rename from datafusion/functions/benches/cot.rs
rename to datafusion/functions/benches/math_expressions/cot.rs
index 16c3fba217..7d37a474f6 100644
--- a/datafusion/functions/benches/cot.rs
+++ b/datafusion/functions/benches/math_expressions/cot.rs
@@ -19,7 +19,7 @@ use arrow::{
datatypes::{Float32Type, Float64Type},
util::bench_util::create_primitive_array,
};
-use criterion::{Criterion, criterion_group, criterion_main};
+use criterion::{Criterion, criterion_group};
use datafusion_expr::{ColumnarValue, ScalarFunctionArgs};
use datafusion_functions::math::cot;
use std::hint::black_box;
@@ -132,4 +132,3 @@ fn criterion_benchmark(c: &mut Criterion) {
}
criterion_group!(benches, criterion_benchmark);
-criterion_main!(benches);
diff --git a/datafusion/functions/benches/factorial.rs b/datafusion/functions/benches/math_expressions/factorial.rs
similarity index 96%
rename from datafusion/functions/benches/factorial.rs
rename to datafusion/functions/benches/math_expressions/factorial.rs
index c441b50c28..f12d672d9e 100644
--- a/datafusion/functions/benches/factorial.rs
+++ b/datafusion/functions/benches/math_expressions/factorial.rs
@@ -17,7 +17,7 @@
use arrow::array::Int64Array;
use arrow::datatypes::{DataType, Field};
-use criterion::{Criterion, criterion_group, criterion_main};
+use criterion::{Criterion, criterion_group};
use datafusion_common::ScalarValue;
use datafusion_common::config::ConfigOptions;
use datafusion_expr::ScalarFunctionArgs;
@@ -62,4 +62,3 @@ fn criterion_benchmark(c: &mut Criterion) {
}
criterion_group!(benches, criterion_benchmark);
-criterion_main!(benches);
diff --git a/datafusion/functions/benches/floor_ceil.rs b/datafusion/functions/benches/math_expressions/floor_ceil.rs
similarity index 98%
rename from datafusion/functions/benches/floor_ceil.rs
rename to datafusion/functions/benches/math_expressions/floor_ceil.rs
index dc095e0152..4f13ab9eb8 100644
--- a/datafusion/functions/benches/floor_ceil.rs
+++ b/datafusion/functions/benches/math_expressions/floor_ceil.rs
@@ -17,7 +17,7 @@
use arrow::datatypes::{DataType, Field, Float64Type};
use arrow::util::bench_util::create_primitive_array;
-use criterion::{Criterion, SamplingMode, criterion_group, criterion_main};
+use criterion::{Criterion, SamplingMode, criterion_group};
use datafusion_common::ScalarValue;
use datafusion_common::config::ConfigOptions;
use datafusion_expr::{ColumnarValue, ScalarFunctionArgs};
@@ -130,4 +130,3 @@ fn criterion_benchmark(c: &mut Criterion) {
}
criterion_group!(benches, criterion_benchmark);
-criterion_main!(benches);
diff --git a/datafusion/functions/benches/gcd.rs b/datafusion/functions/benches/math_expressions/gcd.rs
similarity index 97%
rename from datafusion/functions/benches/gcd.rs
rename to datafusion/functions/benches/math_expressions/gcd.rs
index ca49415b0f..e702a6a6b0 100644
--- a/datafusion/functions/benches/gcd.rs
+++ b/datafusion/functions/benches/math_expressions/gcd.rs
@@ -20,7 +20,7 @@ use arrow::{
array::{ArrayRef, Int64Array},
datatypes::DataType,
};
-use criterion::{Criterion, criterion_group, criterion_main};
+use criterion::{Criterion, criterion_group};
use datafusion_common::ScalarValue;
use datafusion_common::config::ConfigOptions;
use datafusion_expr::{ColumnarValue, ScalarFunctionArgs};
@@ -106,4 +106,3 @@ fn criterion_benchmark(c: &mut Criterion) {
}
criterion_group!(benches, criterion_benchmark);
-criterion_main!(benches);
diff --git a/datafusion/functions/benches/isnan.rs b/datafusion/functions/benches/math_expressions/isnan.rs
similarity index 97%
rename from datafusion/functions/benches/isnan.rs
rename to datafusion/functions/benches/math_expressions/isnan.rs
index e353b9d27a..bc5340aa05 100644
--- a/datafusion/functions/benches/isnan.rs
+++ b/datafusion/functions/benches/math_expressions/isnan.rs
@@ -20,7 +20,7 @@ use arrow::{
datatypes::{Float32Type, Float64Type},
util::bench_util::create_primitive_array,
};
-use criterion::{Criterion, criterion_group, criterion_main};
+use criterion::{Criterion, criterion_group};
use datafusion_common::config::ConfigOptions;
use datafusion_expr::{ColumnarValue, ScalarFunctionArgs};
use datafusion_functions::math::isnan;
@@ -84,4 +84,3 @@ fn criterion_benchmark(c: &mut Criterion) {
}
criterion_group!(benches, criterion_benchmark);
-criterion_main!(benches);
diff --git a/datafusion/functions/benches/iszero.rs b/datafusion/functions/benches/math_expressions/iszero.rs
similarity index 98%
rename from datafusion/functions/benches/iszero.rs
rename to datafusion/functions/benches/math_expressions/iszero.rs
index c6d0aed4c6..17bff665d3 100644
--- a/datafusion/functions/benches/iszero.rs
+++ b/datafusion/functions/benches/math_expressions/iszero.rs
@@ -20,7 +20,7 @@ use arrow::{
datatypes::{Float32Type, Float64Type},
util::bench_util::create_primitive_array,
};
-use criterion::{Criterion, criterion_group, criterion_main};
+use criterion::{Criterion, criterion_group};
use datafusion_common::ScalarValue;
use datafusion_common::config::ConfigOptions;
use datafusion_expr::{ColumnarValue, ScalarFunctionArgs};
@@ -132,4 +132,3 @@ fn criterion_benchmark(c: &mut Criterion) {
}
criterion_group!(benches, criterion_benchmark);
-criterion_main!(benches);
diff --git a/datafusion/functions/benches/lcm.rs b/datafusion/functions/benches/math_expressions/lcm.rs
similarity index 96%
rename from datafusion/functions/benches/lcm.rs
rename to datafusion/functions/benches/math_expressions/lcm.rs
index 5a4e5d2bce..33f40f16a3 100644
--- a/datafusion/functions/benches/lcm.rs
+++ b/datafusion/functions/benches/math_expressions/lcm.rs
@@ -20,7 +20,7 @@ use arrow::{
array::{ArrayRef, Int64Array},
datatypes::DataType,
};
-use criterion::{Criterion, criterion_group, criterion_main};
+use criterion::{Criterion, criterion_group};
use datafusion_common::config::ConfigOptions;
use datafusion_expr::{ColumnarValue, ScalarFunctionArgs};
use datafusion_functions::math::lcm;
@@ -63,4 +63,3 @@ fn criterion_benchmark(c: &mut Criterion) {
}
criterion_group!(benches, criterion_benchmark);
-criterion_main!(benches);
diff --git a/datafusion/functions/benches/math_expressions/main.rs b/datafusion/functions/benches/math_expressions/main.rs
new file mode 100644
index 0000000000..6599ea7fca
--- /dev/null
+++ b/datafusion/functions/benches/math_expressions/main.rs
@@ -0,0 +1,61 @@
+// Licensed to the Apache Software Foundation (ASF) under one
+// or more contributor license agreements. See the NOTICE file
+// distributed with this work for additional information
+// regarding copyright ownership. The ASF licenses this file
+// to you under the Apache License, Version 2.0 (the
+// "License"); you may not use this file except in compliance
+// with the License. You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing,
+// software distributed under the License is distributed on an
+// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+// KIND, either express or implied. See the License for the
+// specific language governing permissions and limitations
+// under the License.
+
+//! Benchmarks for functions behind the `math_expressions` feature.
+//!
+//! Each benchmark beside this file is a module rather than its own `[[bench]]`
+//! target to reduce compile times and output size.
+//!
+//! Run one of them with `cargo bench --bench math_expressions -- <filter>`.
+
+use criterion::criterion_main;
+
+mod atan2;
+mod cot;
+mod factorial;
+mod floor_ceil;
+mod gcd;
+mod isnan;
+mod iszero;
+mod lcm;
+mod nanvl;
+mod power;
+mod random;
+mod round;
+mod round_dense;
+mod signum;
+mod trunc;
+mod trunc_precision;
+
+criterion_main!(
+ atan2::benches,
+ cot::benches,
+ factorial::benches,
+ floor_ceil::benches,
+ gcd::benches,
+ isnan::benches,
+ iszero::benches,
+ lcm::benches,
+ nanvl::benches,
+ power::benches,
+ random::benches,
+ round::benches,
+ round_dense::benches,
+ signum::benches,
+ trunc::benches,
+ trunc_precision::benches,
+);
diff --git a/datafusion/functions/benches/nanvl.rs b/datafusion/functions/benches/math_expressions/nanvl.rs
similarity index 98%
rename from datafusion/functions/benches/nanvl.rs
rename to datafusion/functions/benches/math_expressions/nanvl.rs
index d3d2c7ebff..c2e507ed21 100644
--- a/datafusion/functions/benches/nanvl.rs
+++ b/datafusion/functions/benches/math_expressions/nanvl.rs
@@ -15,11 +15,9 @@
// specific language governing permissions and limitations
// under the License.
-extern crate criterion;
-
use arrow::array::{ArrayRef, Float32Array, Float64Array};
use arrow::datatypes::{DataType, Field};
-use criterion::{Criterion, criterion_group, criterion_main};
+use criterion::{Criterion, criterion_group};
use datafusion_common::ScalarValue;
use datafusion_common::config::ConfigOptions;
use datafusion_expr::{ColumnarValue, ScalarFunctionArgs};
@@ -185,4 +183,3 @@ fn criterion_benchmark(c: &mut Criterion) {
}
criterion_group!(benches, criterion_benchmark);
-criterion_main!(benches);
diff --git a/datafusion/functions/benches/power.rs b/datafusion/functions/benches/math_expressions/power.rs
similarity index 97%
rename from datafusion/functions/benches/power.rs
rename to datafusion/functions/benches/math_expressions/power.rs
index 5336e42ebe..eed0e55aa3 100644
--- a/datafusion/functions/benches/power.rs
+++ b/datafusion/functions/benches/math_expressions/power.rs
@@ -23,11 +23,9 @@
//! through a Float64 round-trip, which is measurably slower than the
//! decimal kernel for the cases the kernel can handle.
-extern crate criterion;
-
use arrow::array::{Decimal128Array, Int64Array};
use arrow::datatypes::{DataType, Field, FieldRef};
-use criterion::{Criterion, criterion_group, criterion_main};
+use criterion::{Criterion, criterion_group};
use datafusion_common::ScalarValue;
use datafusion_common::config::ConfigOptions;
use datafusion_expr::{ColumnarValue, ScalarFunctionArgs, ScalarUDF};
@@ -137,4 +135,3 @@ fn criterion_benchmark(c: &mut Criterion) {
}
criterion_group!(benches, criterion_benchmark);
-criterion_main!(benches);
diff --git a/datafusion/functions/benches/random.rs b/datafusion/functions/benches/math_expressions/random.rs
similarity index 97%
rename from datafusion/functions/benches/random.rs
rename to datafusion/functions/benches/math_expressions/random.rs
index 71ded120eb..0de60954f3 100644
--- a/datafusion/functions/benches/random.rs
+++ b/datafusion/functions/benches/math_expressions/random.rs
@@ -16,7 +16,7 @@
// under the License.
use arrow::datatypes::{DataType, Field};
-use criterion::{Criterion, criterion_group, criterion_main};
+use criterion::{Criterion, criterion_group};
use datafusion_common::config::ConfigOptions;
use datafusion_expr::{ScalarFunctionArgs, ScalarUDFImpl};
use datafusion_functions::math::random::RandomFunc;
@@ -71,4 +71,3 @@ fn criterion_benchmark(c: &mut Criterion) {
}
criterion_group!(benches, criterion_benchmark);
-criterion_main!(benches);
diff --git a/datafusion/functions/benches/round.rs b/datafusion/functions/benches/math_expressions/round.rs
similarity index 98%
rename from datafusion/functions/benches/round.rs
rename to datafusion/functions/benches/math_expressions/round.rs
index 7010aa3507..11c297aa5c 100644
--- a/datafusion/functions/benches/round.rs
+++ b/datafusion/functions/benches/math_expressions/round.rs
@@ -17,7 +17,7 @@
use arrow::datatypes::{DataType, Field, Float32Type, Float64Type};
use arrow::util::bench_util::create_primitive_array;
-use criterion::{Criterion, SamplingMode, criterion_group, criterion_main};
+use criterion::{Criterion, SamplingMode, criterion_group};
use datafusion_common::ScalarValue;
use datafusion_common::config::ConfigOptions;
use datafusion_expr::{ColumnarValue, ScalarFunctionArgs};
@@ -149,4 +149,3 @@ fn criterion_benchmark(c: &mut Criterion) {
}
criterion_group!(benches, criterion_benchmark);
-criterion_main!(benches);
diff --git a/datafusion/functions/benches/round_dense.rs b/datafusion/functions/benches/math_expressions/round_dense.rs
similarity index 97%
rename from datafusion/functions/benches/round_dense.rs
rename to datafusion/functions/benches/math_expressions/round_dense.rs
index 2c37849bde..c0320eaa62 100644
--- a/datafusion/functions/benches/round_dense.rs
+++ b/datafusion/functions/benches/math_expressions/round_dense.rs
@@ -21,7 +21,7 @@
use arrow::array::ArrayRef;
use arrow::datatypes::{DataType, Field, Float32Type, Float64Type};
use arrow::util::bench_util::create_primitive_array;
-use criterion::{BenchmarkId, Criterion, criterion_group, criterion_main};
+use criterion::{BenchmarkId, Criterion, criterion_group};
use datafusion_common::ScalarValue;
use datafusion_common::config::ConfigOptions;
use datafusion_expr::{ColumnarValue, ScalarFunctionArgs, ScalarUDFImpl};
@@ -91,4 +91,3 @@ fn criterion_benchmark(c: &mut Criterion) {
}
criterion_group!(benches, criterion_benchmark);
-criterion_main!(benches);
diff --git a/datafusion/functions/benches/signum.rs b/datafusion/functions/benches/math_expressions/signum.rs
similarity index 98%
rename from datafusion/functions/benches/signum.rs
rename to datafusion/functions/benches/math_expressions/signum.rs
index e98d1b2c22..8a6289c77f 100644
--- a/datafusion/functions/benches/signum.rs
+++ b/datafusion/functions/benches/math_expressions/signum.rs
@@ -20,7 +20,7 @@ use arrow::{
datatypes::{Field, Float32Type, Float64Type},
util::bench_util::create_primitive_array,
};
-use criterion::{Criterion, criterion_group, criterion_main};
+use criterion::{Criterion, criterion_group};
use datafusion_common::ScalarValue;
use datafusion_common::config::ConfigOptions;
use datafusion_expr::{ColumnarValue, ScalarFunctionArgs};
@@ -136,4 +136,3 @@ fn criterion_benchmark(c: &mut Criterion) {
}
criterion_group!(benches, criterion_benchmark);
-criterion_main!(benches);
diff --git a/datafusion/functions/benches/trunc.rs b/datafusion/functions/benches/math_expressions/trunc.rs
similarity index 98%
rename from datafusion/functions/benches/trunc.rs
rename to datafusion/functions/benches/math_expressions/trunc.rs
index ffbedcb142..2b17f62952 100644
--- a/datafusion/functions/benches/trunc.rs
+++ b/datafusion/functions/benches/math_expressions/trunc.rs
@@ -19,7 +19,7 @@ use arrow::{
datatypes::{Field, Float32Type, Float64Type},
util::bench_util::create_primitive_array,
};
-use criterion::{Criterion, criterion_group, criterion_main};
+use criterion::{Criterion, criterion_group};
use datafusion_expr::{ColumnarValue, ScalarFunctionArgs};
use datafusion_functions::math::trunc;
use std::hint::black_box;
@@ -121,4 +121,3 @@ fn criterion_benchmark(c: &mut Criterion) {
}
criterion_group!(benches, criterion_benchmark);
-criterion_main!(benches);
diff --git a/datafusion/functions/benches/trunc_precision.rs b/datafusion/functions/benches/math_expressions/trunc_precision.rs
similarity index 97%
rename from datafusion/functions/benches/trunc_precision.rs
rename to datafusion/functions/benches/math_expressions/trunc_precision.rs
index 5d75694d6e..e9a2aa894b 100644
--- a/datafusion/functions/benches/trunc_precision.rs
+++ b/datafusion/functions/benches/math_expressions/trunc_precision.rs
@@ -20,7 +20,7 @@
use arrow::datatypes::{DataType, Field, Float32Type, Float64Type};
use arrow::util::bench_util::create_primitive_array;
-use criterion::{Criterion, criterion_group, criterion_main};
+use criterion::{Criterion, criterion_group};
use datafusion_common::ScalarValue;
use datafusion_common::config::ConfigOptions;
use datafusion_expr::{ColumnarValue, ScalarFunctionArgs};
@@ -88,4 +88,3 @@ fn criterion_benchmark(c: &mut Criterion) {
}
criterion_group!(benches, criterion_benchmark);
-criterion_main!(benches);
diff --git a/datafusion/functions/benches/get_field.rs b/datafusion/functions/benches/misc/get_field.rs
similarity index 96%
rename from datafusion/functions/benches/get_field.rs
rename to datafusion/functions/benches/misc/get_field.rs
index 8a5fd0a1e2..b405e23542 100644
--- a/datafusion/functions/benches/get_field.rs
+++ b/datafusion/functions/benches/misc/get_field.rs
@@ -15,11 +15,9 @@
// specific language governing permissions and limitations
// under the License.
-extern crate criterion;
-
use arrow::array::{ArrayRef, Int32Builder, MapBuilder, StringBuilder};
use arrow::datatypes::{DataType, Field};
-use criterion::{Criterion, criterion_group, criterion_main};
+use criterion::{Criterion, criterion_group};
use datafusion_common::ScalarValue;
use datafusion_common::config::ConfigOptions;
use datafusion_expr::{ColumnarValue, ScalarFunctionArgs};
@@ -92,4 +90,3 @@ fn criterion_benchmark(c: &mut Criterion) {
}
criterion_group!(benches, criterion_benchmark);
-criterion_main!(benches);
diff --git a/datafusion/functions/benches/misc/main.rs b/datafusion/functions/benches/misc/main.rs
new file mode 100644
index 0000000000..57a206790e
--- /dev/null
+++ b/datafusion/functions/benches/misc/main.rs
@@ -0,0 +1,39 @@
+// Licensed to the Apache Software Foundation (ASF) under one
+// or more contributor license agreements. See the NOTICE file
+// distributed with this work for additional information
+// regarding copyright ownership. The ASF licenses this file
+// to you under the Apache License, Version 2.0 (the
+// "License"); you may not use this file except in compliance
+// with the License. You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing,
+// software distributed under the License is distributed on an
+// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+// KIND, either express or implied. See the License for the
+// specific language governing permissions and limitations
+// under the License.
+
+//! Benchmarks for functions without a feature gate.
+//!
+//! Each benchmark beside this file is a module rather than its own `[[bench]]`
+//! target to reduce compile times and output size.
+//!
+//! Run one of them with `cargo bench --bench misc -- <filter>`.
+
+use criterion::criterion_main;
+
+mod get_field;
+#[path = "../helper.rs"]
+mod helper;
+mod nullif;
+mod overlay;
+mod upper;
+
+criterion_main!(
+ get_field::benches,
+ nullif::benches,
+ overlay::benches,
+ upper::benches,
+);
diff --git a/datafusion/functions/benches/nullif.rs b/datafusion/functions/benches/misc/nullif.rs
similarity index 96%
rename from datafusion/functions/benches/nullif.rs
rename to datafusion/functions/benches/misc/nullif.rs
index f9f063c52d..ad111ad25c 100644
--- a/datafusion/functions/benches/nullif.rs
+++ b/datafusion/functions/benches/misc/nullif.rs
@@ -17,7 +17,7 @@
use arrow::datatypes::{DataType, Field};
use arrow::util::bench_util::create_string_array_with_len;
-use criterion::{Criterion, criterion_group, criterion_main};
+use criterion::{Criterion, criterion_group};
use datafusion_common::ScalarValue;
use datafusion_common::config::ConfigOptions;
use datafusion_expr::{ColumnarValue, ScalarFunctionArgs};
@@ -61,4 +61,3 @@ fn criterion_benchmark(c: &mut Criterion) {
}
criterion_group!(benches, criterion_benchmark);
-criterion_main!(benches);
diff --git a/datafusion/functions/benches/overlay.rs b/datafusion/functions/benches/misc/overlay.rs
similarity index 97%
rename from datafusion/functions/benches/overlay.rs
rename to datafusion/functions/benches/misc/overlay.rs
index 0b7fff5989..f4e4a85a18 100644
--- a/datafusion/functions/benches/overlay.rs
+++ b/datafusion/functions/benches/misc/overlay.rs
@@ -15,14 +15,12 @@
// specific language governing permissions and limitations
// under the License.
-mod helper;
-
+use crate::helper::gen_string_array;
use arrow::datatypes::{DataType, Field};
-use criterion::{Criterion, criterion_group, criterion_main};
+use criterion::{Criterion, criterion_group};
use datafusion_common::ScalarValue;
use datafusion_common::config::ConfigOptions;
use datafusion_expr::{ColumnarValue, ScalarFunctionArgs, ScalarUDF};
-use helper::gen_string_array;
use std::hint::black_box;
use std::sync::Arc;
@@ -197,4 +195,3 @@ fn criterion_benchmark(c: &mut Criterion) {
}
criterion_group!(benches, criterion_benchmark);
-criterion_main!(benches);
diff --git a/datafusion/functions/benches/upper.rs b/datafusion/functions/benches/misc/upper.rs
similarity index 96%
rename from datafusion/functions/benches/upper.rs
rename to datafusion/functions/benches/misc/upper.rs
index 3f6fa36b18..1941547155 100644
--- a/datafusion/functions/benches/upper.rs
+++ b/datafusion/functions/benches/misc/upper.rs
@@ -17,7 +17,7 @@
use arrow::datatypes::{DataType, Field};
use arrow::util::bench_util::create_string_array_with_len;
-use criterion::{Criterion, criterion_group, criterion_main};
+use criterion::{Criterion, criterion_group};
use datafusion_common::config::ConfigOptions;
use datafusion_expr::{ColumnarValue, ScalarFunctionArgs};
use datafusion_functions::string;
@@ -55,4 +55,3 @@ fn criterion_benchmark(c: &mut Criterion) {
}
criterion_group!(benches, criterion_benchmark);
-criterion_main!(benches);
diff --git a/datafusion/functions/benches/regex_expressions/main.rs b/datafusion/functions/benches/regex_expressions/main.rs
new file mode 100644
index 0000000000..10868c6f4d
--- /dev/null
+++ b/datafusion/functions/benches/regex_expressions/main.rs
@@ -0,0 +1,37 @@
+// Licensed to the Apache Software Foundation (ASF) under one
+// or more contributor license agreements. See the NOTICE file
+// distributed with this work for additional information
+// regarding copyright ownership. The ASF licenses this file
+// to you under the Apache License, Version 2.0 (the
+// "License"); you may not use this file except in compliance
+// with the License. You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing,
+// software distributed under the License is distributed on an
+// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+// KIND, either express or implied. See the License for the
+// specific language governing permissions and limitations
+// under the License.
+
+//! Benchmarks for functions behind the `regex_expressions` feature.
+//!
+//! Each benchmark beside this file is a module rather than its own `[[bench]]`
+//! target to reduce compile times and output size.
+//!
+//! Run one of them with `cargo bench --bench regex_expressions -- <filter>`.
+
+use criterion::criterion_main;
+
+mod regexp_count;
+mod regexp_instr;
+mod regexp_match;
+mod regx;
+
+criterion_main!(
+ regexp_count::benches,
+ regexp_instr::benches,
+ regexp_match::benches,
+ regx::benches,
+);
diff --git a/datafusion/functions/benches/regexp_count.rs b/datafusion/functions/benches/regex_expressions/regexp_count.rs
similarity index 97%
rename from datafusion/functions/benches/regexp_count.rs
rename to datafusion/functions/benches/regex_expressions/regexp_count.rs
index bce76c0558..b489046779 100644
--- a/datafusion/functions/benches/regexp_count.rs
+++ b/datafusion/functions/benches/regex_expressions/regexp_count.rs
@@ -19,7 +19,7 @@ use arrow::array::Int64Array;
use arrow::array::OffsetSizeTrait;
use arrow::datatypes::{DataType, Field};
use arrow::util::bench_util::create_string_array_with_len;
-use criterion::{Criterion, SamplingMode, criterion_group, criterion_main};
+use criterion::{Criterion, SamplingMode, criterion_group};
use datafusion_common::config::ConfigOptions;
use datafusion_common::{DataFusionError, ScalarValue};
use datafusion_expr::{ColumnarValue, ScalarFunctionArgs};
@@ -113,4 +113,3 @@ fn criterion_benchmark(c: &mut Criterion) {
}
criterion_group!(benches, criterion_benchmark);
-criterion_main!(benches);
diff --git a/datafusion/functions/benches/regexp_instr.rs b/datafusion/functions/benches/regex_expressions/regexp_instr.rs
similarity index 97%
rename from datafusion/functions/benches/regexp_instr.rs
rename to datafusion/functions/benches/regex_expressions/regexp_instr.rs
index 9ac630d8c4..d41723f29e 100644
--- a/datafusion/functions/benches/regexp_instr.rs
+++ b/datafusion/functions/benches/regex_expressions/regexp_instr.rs
@@ -19,7 +19,7 @@ use arrow::array::Int64Array;
use arrow::array::OffsetSizeTrait;
use arrow::datatypes::{DataType, Field};
use arrow::util::bench_util::create_string_array_with_len;
-use criterion::{Criterion, criterion_group, criterion_main};
+use criterion::{Criterion, criterion_group};
use datafusion_common::config::ConfigOptions;
use datafusion_common::{DataFusionError, ScalarValue};
use datafusion_expr::{ColumnarValue, ScalarFunctionArgs};
@@ -96,4 +96,3 @@ fn criterion_benchmark(c: &mut Criterion) {
}
criterion_group!(benches, criterion_benchmark);
-criterion_main!(benches);
diff --git a/datafusion/functions/benches/regexp_match.rs b/datafusion/functions/benches/regex_expressions/regexp_match.rs
similarity index 98%
rename from datafusion/functions/benches/regexp_match.rs
rename to datafusion/functions/benches/regex_expressions/regexp_match.rs
index d5929df07c..b36fbebc92 100644
--- a/datafusion/functions/benches/regexp_match.rs
+++ b/datafusion/functions/benches/regex_expressions/regexp_match.rs
@@ -25,7 +25,7 @@ use std::sync::Arc;
use arrow::array::{ArrayRef, StringArray};
use arrow::compute::cast;
use arrow::datatypes::{DataType, Field};
-use criterion::{Criterion, criterion_group, criterion_main};
+use criterion::{Criterion, criterion_group};
use datafusion_common::ScalarValue;
use datafusion_common::config::ConfigOptions;
use datafusion_expr::{ColumnarValue, ScalarFunctionArgs, ScalarUDFImpl};
@@ -134,4 +134,3 @@ fn criterion_benchmark(c: &mut Criterion) {
}
criterion_group!(benches, criterion_benchmark);
-criterion_main!(benches);
diff --git a/datafusion/functions/benches/regx.rs b/datafusion/functions/benches/regex_expressions/regx.rs
similarity index 99%
rename from datafusion/functions/benches/regx.rs
rename to datafusion/functions/benches/regex_expressions/regx.rs
index dd263e41f6..09b7f9acb7 100644
--- a/datafusion/functions/benches/regx.rs
+++ b/datafusion/functions/benches/regex_expressions/regx.rs
@@ -23,7 +23,7 @@ use arrow::array::builder::StringBuilder;
use arrow::array::{ArrayRef, AsArray, Int64Array, StringArray, StringViewArray};
use arrow::compute::cast;
use arrow::datatypes::{DataType, Field};
-use criterion::{Criterion, criterion_group, criterion_main};
+use criterion::{Criterion, criterion_group};
use datafusion_common::ScalarValue;
use datafusion_common::config::ConfigOptions;
use datafusion_expr::{ColumnarValue, ScalarFunctionArgs, ScalarUDFImpl};
@@ -331,4 +331,3 @@ fn criterion_benchmark(c: &mut Criterion) {
}
criterion_group!(benches, criterion_benchmark);
-criterion_main!(benches);
diff --git a/datafusion/functions/benches/ascii.rs b/datafusion/functions/benches/string_expressions/ascii.rs
similarity index 98%
rename from datafusion/functions/benches/ascii.rs
rename to datafusion/functions/benches/string_expressions/ascii.rs
index a2424ed352..030ae11199 100644
--- a/datafusion/functions/benches/ascii.rs
+++ b/datafusion/functions/benches/string_expressions/ascii.rs
@@ -15,14 +15,12 @@
// specific language governing permissions and limitations
// under the License.
-mod helper;
-
+use crate::helper::gen_string_array;
use arrow::datatypes::{DataType, Field};
-use criterion::{Criterion, criterion_group, criterion_main};
+use criterion::{Criterion, criterion_group};
use datafusion_common::ScalarValue;
use datafusion_common::config::ConfigOptions;
use datafusion_expr::{ColumnarValue, ScalarFunctionArgs};
-use helper::gen_string_array;
use std::hint::black_box;
use std::sync::Arc;
@@ -165,4 +163,3 @@ fn criterion_benchmark(c: &mut Criterion) {
}
criterion_group!(benches, criterion_benchmark);
-criterion_main!(benches);
diff --git a/datafusion/functions/benches/chr.rs b/datafusion/functions/benches/string_expressions/chr.rs
similarity index 97%
rename from datafusion/functions/benches/chr.rs
rename to datafusion/functions/benches/string_expressions/chr.rs
index a702dc161a..d7968605f6 100644
--- a/datafusion/functions/benches/chr.rs
+++ b/datafusion/functions/benches/string_expressions/chr.rs
@@ -16,7 +16,7 @@
// under the License.
use arrow::{array::PrimitiveArray, datatypes::Int64Type};
-use criterion::{Criterion, criterion_group, criterion_main};
+use criterion::{Criterion, criterion_group};
use datafusion_common::ScalarValue;
use datafusion_expr::{ColumnarValue, ScalarFunctionArgs};
use datafusion_functions::string::chr;
@@ -96,4 +96,3 @@ fn criterion_benchmark(c: &mut Criterion) {
}
criterion_group!(benches, criterion_benchmark);
-criterion_main!(benches);
diff --git a/datafusion/functions/benches/concat.rs b/datafusion/functions/benches/string_expressions/concat.rs
similarity index 98%
rename from datafusion/functions/benches/concat.rs
rename to datafusion/functions/benches/string_expressions/concat.rs
index 6736625be0..4736ca1542 100644
--- a/datafusion/functions/benches/concat.rs
+++ b/datafusion/functions/benches/string_expressions/concat.rs
@@ -18,7 +18,7 @@
use arrow::array::ArrayRef;
use arrow::datatypes::{DataType, Field};
use arrow::util::bench_util::{create_string_array_with_len, create_string_view_array};
-use criterion::{BenchmarkId, Criterion, criterion_group, criterion_main};
+use criterion::{BenchmarkId, Criterion, criterion_group};
use datafusion_common::ScalarValue;
use datafusion_common::config::ConfigOptions;
use datafusion_expr::{ColumnarValue, ScalarFunctionArgs};
@@ -168,4 +168,3 @@ fn criterion_benchmark(c: &mut Criterion) {
}
criterion_group!(benches, criterion_benchmark);
-criterion_main!(benches);
diff --git a/datafusion/functions/benches/concat_ws.rs b/datafusion/functions/benches/string_expressions/concat_ws.rs
similarity index 97%
rename from datafusion/functions/benches/concat_ws.rs
rename to datafusion/functions/benches/string_expressions/concat_ws.rs
index d437f38773..c4c809a1e4 100644
--- a/datafusion/functions/benches/concat_ws.rs
+++ b/datafusion/functions/benches/string_expressions/concat_ws.rs
@@ -18,7 +18,7 @@
use arrow::array::ArrayRef;
use arrow::datatypes::{DataType, Field};
use arrow::util::bench_util::create_string_array_with_len;
-use criterion::{BenchmarkId, Criterion, criterion_group, criterion_main};
+use criterion::{BenchmarkId, Criterion, criterion_group};
use datafusion_common::ScalarValue;
use datafusion_common::config::ConfigOptions;
use datafusion_expr::{ColumnarValue, ScalarFunctionArgs};
@@ -120,4 +120,3 @@ fn criterion_benchmark(c: &mut Criterion) {
}
criterion_group!(benches, criterion_benchmark);
-criterion_main!(benches);
diff --git a/datafusion/functions/benches/contains.rs b/datafusion/functions/benches/string_expressions/contains.rs
similarity index 98%
rename from datafusion/functions/benches/contains.rs
rename to datafusion/functions/benches/string_expressions/contains.rs
index 6c39f45e14..7b7ca824c3 100644
--- a/datafusion/functions/benches/contains.rs
+++ b/datafusion/functions/benches/string_expressions/contains.rs
@@ -17,7 +17,7 @@
use arrow::array::{StringArray, StringViewArray};
use arrow::datatypes::{DataType, Field};
-use criterion::{Criterion, criterion_group, criterion_main};
+use criterion::{Criterion, criterion_group};
use datafusion_common::ScalarValue;
use datafusion_common::config::ConfigOptions;
use datafusion_expr::{ColumnarValue, ScalarFunctionArgs};
@@ -180,4 +180,3 @@ fn criterion_benchmark(c: &mut Criterion) {
}
criterion_group!(benches, criterion_benchmark);
-criterion_main!(benches);
diff --git a/datafusion/functions/benches/ends_with.rs b/datafusion/functions/benches/string_expressions/ends_with.rs
similarity index 98%
rename from datafusion/functions/benches/ends_with.rs
rename to datafusion/functions/benches/string_expressions/ends_with.rs
index 474e8a1555..35ce196149 100644
--- a/datafusion/functions/benches/ends_with.rs
+++ b/datafusion/functions/benches/string_expressions/ends_with.rs
@@ -17,7 +17,7 @@
use arrow::array::{StringArray, StringViewArray};
use arrow::datatypes::{DataType, Field};
-use criterion::{Criterion, criterion_group, criterion_main};
+use criterion::{Criterion, criterion_group};
use datafusion_common::ScalarValue;
use datafusion_common::config::ConfigOptions;
use datafusion_expr::{ColumnarValue, ScalarFunctionArgs};
@@ -180,4 +180,3 @@ fn criterion_benchmark(c: &mut Criterion) {
}
criterion_group!(benches, criterion_benchmark);
-criterion_main!(benches);
diff --git a/datafusion/functions/benches/lower.rs b/datafusion/functions/benches/string_expressions/lower.rs
similarity index 99%
rename from datafusion/functions/benches/lower.rs
rename to datafusion/functions/benches/string_expressions/lower.rs
index 2764491c69..2f73106157 100644
--- a/datafusion/functions/benches/lower.rs
+++ b/datafusion/functions/benches/string_expressions/lower.rs
@@ -20,7 +20,7 @@ use arrow::datatypes::{DataType, Field};
use arrow::util::bench_util::{
create_string_array_with_len, create_string_view_array_with_len,
};
-use criterion::{Criterion, criterion_group, criterion_main};
+use criterion::{Criterion, criterion_group};
use datafusion_common::config::ConfigOptions;
use datafusion_expr::{ColumnarValue, ScalarFunctionArgs};
use datafusion_functions::string;
@@ -301,4 +301,3 @@ fn criterion_benchmark(c: &mut Criterion) {
}
criterion_group!(benches, criterion_benchmark);
-criterion_main!(benches);
diff --git a/datafusion/functions/benches/string_expressions/main.rs b/datafusion/functions/benches/string_expressions/main.rs
new file mode 100644
index 0000000000..be0276ac90
--- /dev/null
+++ b/datafusion/functions/benches/string_expressions/main.rs
@@ -0,0 +1,63 @@
+// Licensed to the Apache Software Foundation (ASF) under one
+// or more contributor license agreements. See the NOTICE file
+// distributed with this work for additional information
+// regarding copyright ownership. The ASF licenses this file
+// to you under the Apache License, Version 2.0 (the
+// "License"); you may not use this file except in compliance
+// with the License. You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing,
+// software distributed under the License is distributed on an
+// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+// KIND, either express or implied. See the License for the
+// specific language governing permissions and limitations
+// under the License.
+
+//! Benchmarks for functions behind the `string_expressions` feature.
+//!
+//! Each benchmark beside this file is a module rather than its own `[[bench]]`
+//! target to reduce compile times and output size.
+//!
+//! Run one of them with `cargo bench --bench string_expressions -- <filter>`.
+
+use criterion::criterion_main;
+
+mod ascii;
+mod chr;
+mod concat;
+mod concat_ws;
+mod contains;
+mod ends_with;
+#[path = "../helper.rs"]
+mod helper;
+mod lower;
+mod repeat;
+mod replace;
+mod replace_scalar;
+mod split_part;
+mod starts_with;
+mod to_hex;
+mod trim;
+mod upper_unicode;
+mod uuid;
+
+criterion_main!(
+ ascii::benches,
+ chr::benches,
+ concat::benches,
+ concat_ws::benches,
+ contains::benches,
+ ends_with::benches,
+ lower::benches,
+ repeat::benches,
+ replace::benches,
+ replace_scalar::benches,
+ split_part::benches,
+ starts_with::benches,
+ to_hex::benches,
+ trim::benches,
+ upper_unicode::benches,
+ uuid::benches,
+);
diff --git a/datafusion/functions/benches/repeat.rs b/datafusion/functions/benches/string_expressions/repeat.rs
similarity index 98%
rename from datafusion/functions/benches/repeat.rs
rename to datafusion/functions/benches/string_expressions/repeat.rs
index 354812c0d2..faa4953838 100644
--- a/datafusion/functions/benches/repeat.rs
+++ b/datafusion/functions/benches/string_expressions/repeat.rs
@@ -20,7 +20,7 @@ use arrow::datatypes::{DataType, Field};
use arrow::util::bench_util::{
create_string_array_with_len, create_string_view_array_with_len,
};
-use criterion::{Criterion, SamplingMode, criterion_group, criterion_main};
+use criterion::{Criterion, SamplingMode, criterion_group};
use datafusion_common::DataFusionError;
use datafusion_common::ScalarValue;
use datafusion_common::config::ConfigOptions;
@@ -225,4 +225,3 @@ fn criterion_benchmark(c: &mut Criterion) {
}
criterion_group!(benches, criterion_benchmark);
-criterion_main!(benches);
diff --git a/datafusion/functions/benches/replace.rs b/datafusion/functions/benches/string_expressions/replace.rs
similarity index 98%
rename from datafusion/functions/benches/replace.rs
rename to datafusion/functions/benches/string_expressions/replace.rs
index 7ad198995a..71d33f99f1 100644
--- a/datafusion/functions/benches/replace.rs
+++ b/datafusion/functions/benches/string_expressions/replace.rs
@@ -20,7 +20,7 @@ use arrow::datatypes::{DataType, Field};
use arrow::util::bench_util::{
create_string_array_with_len, create_string_view_array_with_len,
};
-use criterion::{Criterion, SamplingMode, criterion_group, criterion_main};
+use criterion::{Criterion, SamplingMode, criterion_group};
use datafusion_common::DataFusionError;
use datafusion_common::config::ConfigOptions;
use datafusion_expr::{ColumnarValue, ScalarFunctionArgs};
@@ -167,4 +167,3 @@ fn criterion_benchmark(c: &mut Criterion) {
}
criterion_group!(benches, criterion_benchmark);
-criterion_main!(benches);
diff --git a/datafusion/functions/benches/replace_scalar.rs b/datafusion/functions/benches/string_expressions/replace_scalar.rs
similarity index 97%
rename from datafusion/functions/benches/replace_scalar.rs
rename to datafusion/functions/benches/string_expressions/replace_scalar.rs
index e64c12e8eb..f0d90f43be 100644
--- a/datafusion/functions/benches/replace_scalar.rs
+++ b/datafusion/functions/benches/string_expressions/replace_scalar.rs
@@ -21,7 +21,7 @@
use arrow::array::ArrayRef;
use arrow::datatypes::{DataType, Field};
use arrow::util::bench_util::create_string_array_with_len;
-use criterion::{Criterion, criterion_group, criterion_main};
+use criterion::{Criterion, criterion_group};
use datafusion_common::ScalarValue;
use datafusion_common::config::ConfigOptions;
use datafusion_expr::{ColumnarValue, ScalarFunctionArgs};
@@ -75,4 +75,3 @@ fn criterion_benchmark(c: &mut Criterion) {
}
criterion_group!(benches, criterion_benchmark);
-criterion_main!(benches);
diff --git a/datafusion/functions/benches/split_part.rs b/datafusion/functions/benches/string_expressions/split_part.rs
similarity index 98%
rename from datafusion/functions/benches/split_part.rs
rename to datafusion/functions/benches/string_expressions/split_part.rs
index d578339368..910814d8e3 100644
--- a/datafusion/functions/benches/split_part.rs
+++ b/datafusion/functions/benches/string_expressions/split_part.rs
@@ -17,7 +17,7 @@
use arrow::array::{ArrayRef, Int64Array, StringArray, StringViewArray};
use arrow::datatypes::{DataType, Field};
-use criterion::{BenchmarkId, Criterion, criterion_group, criterion_main};
+use criterion::{BenchmarkId, Criterion, criterion_group};
use datafusion_common::ScalarValue;
use datafusion_common::config::ConfigOptions;
use datafusion_expr::{ColumnarValue, ScalarFunctionArgs, ScalarUDF};
@@ -269,4 +269,3 @@ fn criterion_benchmark(c: &mut Criterion) {
}
criterion_group!(benches, criterion_benchmark);
-criterion_main!(benches);
diff --git a/datafusion/functions/benches/starts_with.rs b/datafusion/functions/benches/string_expressions/starts_with.rs
similarity index 98%
rename from datafusion/functions/benches/starts_with.rs
rename to datafusion/functions/benches/string_expressions/starts_with.rs
index 17483f0da7..24c22864fd 100644
--- a/datafusion/functions/benches/starts_with.rs
+++ b/datafusion/functions/benches/string_expressions/starts_with.rs
@@ -17,7 +17,7 @@
use arrow::array::{StringArray, StringViewArray};
use arrow::datatypes::{DataType, Field};
-use criterion::{Criterion, criterion_group, criterion_main};
+use criterion::{Criterion, criterion_group};
use datafusion_common::ScalarValue;
use datafusion_common::config::ConfigOptions;
use datafusion_expr::{ColumnarValue, ScalarFunctionArgs};
@@ -180,4 +180,3 @@ fn criterion_benchmark(c: &mut Criterion) {
}
criterion_group!(benches, criterion_benchmark);
-criterion_main!(benches);
diff --git a/datafusion/functions/benches/to_hex.rs b/datafusion/functions/benches/string_expressions/to_hex.rs
similarity index 98%
rename from datafusion/functions/benches/to_hex.rs
rename to datafusion/functions/benches/string_expressions/to_hex.rs
index 33f8d9c49e..debf915abe 100644
--- a/datafusion/functions/benches/to_hex.rs
+++ b/datafusion/functions/benches/string_expressions/to_hex.rs
@@ -18,7 +18,7 @@
use arrow::array::Int64Array;
use arrow::datatypes::{DataType, Field, Int32Type, Int64Type};
use arrow::util::bench_util::create_primitive_array;
-use criterion::{Criterion, SamplingMode, criterion_group, criterion_main};
+use criterion::{Criterion, SamplingMode, criterion_group};
use datafusion_common::ScalarValue;
use datafusion_common::config::ConfigOptions;
use datafusion_expr::{ColumnarValue, ScalarFunctionArgs};
@@ -151,4 +151,3 @@ fn criterion_benchmark(c: &mut Criterion) {
}
criterion_group!(benches, criterion_benchmark);
-criterion_main!(benches);
diff --git a/datafusion/functions/benches/trim.rs b/datafusion/functions/benches/string_expressions/trim.rs
similarity index 98%
rename from datafusion/functions/benches/trim.rs
rename to datafusion/functions/benches/string_expressions/trim.rs
index 21d99592d1..9970cf2f80 100644
--- a/datafusion/functions/benches/trim.rs
+++ b/datafusion/functions/benches/string_expressions/trim.rs
@@ -18,8 +18,7 @@
use arrow::array::{ArrayRef, LargeStringArray, StringArray, StringViewArray};
use arrow::datatypes::{DataType, Field};
use criterion::{
- BenchmarkGroup, Criterion, SamplingMode, criterion_group, criterion_main,
- measurement::Measurement,
+ BenchmarkGroup, Criterion, SamplingMode, criterion_group, measurement::Measurement,
};
use datafusion_common::ScalarValue;
use datafusion_common::config::ConfigOptions;
@@ -432,4 +431,3 @@ fn criterion_benchmark(c: &mut Criterion) {
}
criterion_group!(benches, criterion_benchmark);
-criterion_main!(benches);
diff --git a/datafusion/functions/benches/upper_unicode.rs b/datafusion/functions/benches/string_expressions/upper_unicode.rs
similarity index 97%
rename from datafusion/functions/benches/upper_unicode.rs
rename to datafusion/functions/benches/string_expressions/upper_unicode.rs
index 2748c85e74..9243da2912 100644
--- a/datafusion/functions/benches/upper_unicode.rs
+++ b/datafusion/functions/benches/string_expressions/upper_unicode.rs
@@ -23,7 +23,7 @@ use std::sync::Arc;
use arrow::array::{ArrayRef, LargeStringArray, StringArray};
use arrow::datatypes::{DataType, Field};
-use criterion::{Criterion, criterion_group, criterion_main};
+use criterion::{Criterion, criterion_group};
use datafusion_common::config::ConfigOptions;
use datafusion_expr::{ColumnarValue, ScalarFunctionArgs, ScalarUDF};
use datafusion_functions::string;
@@ -87,4 +87,3 @@ fn criterion_benchmark(c: &mut Criterion) {
}
criterion_group!(benches, criterion_benchmark);
-criterion_main!(benches);
diff --git a/datafusion/functions/benches/uuid.rs b/datafusion/functions/benches/string_expressions/uuid.rs
similarity index 94%
rename from datafusion/functions/benches/uuid.rs
rename to datafusion/functions/benches/string_expressions/uuid.rs
index 629fb950dd..47a3412a35 100644
--- a/datafusion/functions/benches/uuid.rs
+++ b/datafusion/functions/benches/string_expressions/uuid.rs
@@ -16,7 +16,7 @@
// under the License.
use arrow::datatypes::{DataType, Field};
-use criterion::{Criterion, criterion_group, criterion_main};
+use criterion::{Criterion, criterion_group};
use datafusion_common::config::ConfigOptions;
use datafusion_expr::ScalarFunctionArgs;
use datafusion_functions::string;
@@ -41,4 +41,3 @@ fn criterion_benchmark(c: &mut Criterion) {
}
criterion_group!(benches, criterion_benchmark);
-criterion_main!(benches);
diff --git a/datafusion/functions/benches/character_length.rs b/datafusion/functions/benches/unicode_expressions/character_length.rs
similarity index 97%
rename from datafusion/functions/benches/character_length.rs
rename to datafusion/functions/benches/unicode_expressions/character_length.rs
index 4927627ec2..3aac173c60 100644
--- a/datafusion/functions/benches/character_length.rs
+++ b/datafusion/functions/benches/unicode_expressions/character_length.rs
@@ -15,16 +15,14 @@
// specific language governing permissions and limitations
// under the License.
+use crate::helper::gen_string_array;
use arrow::datatypes::{DataType, Field};
-use criterion::{Criterion, criterion_group, criterion_main};
+use criterion::{Criterion, criterion_group};
use datafusion_common::config::ConfigOptions;
use datafusion_expr::ScalarFunctionArgs;
-use helper::gen_string_array;
use std::hint::black_box;
use std::sync::Arc;
-mod helper;
-
fn criterion_benchmark(c: &mut Criterion) {
// All benches are single batch run with 8192 rows
let character_length = datafusion_functions::unicode::character_length();
@@ -133,4 +131,3 @@ fn criterion_benchmark(c: &mut Criterion) {
}
criterion_group!(benches, criterion_benchmark);
-criterion_main!(benches);
diff --git a/datafusion/functions/benches/find_in_set.rs b/datafusion/functions/benches/unicode_expressions/find_in_set.rs
similarity index 98%
rename from datafusion/functions/benches/find_in_set.rs
rename to datafusion/functions/benches/unicode_expressions/find_in_set.rs
index 9ee20ecd14..9898ab5501 100644
--- a/datafusion/functions/benches/find_in_set.rs
+++ b/datafusion/functions/benches/unicode_expressions/find_in_set.rs
@@ -20,7 +20,7 @@ use arrow::datatypes::{DataType, Field};
use arrow::util::bench_util::{
create_string_array_with_len, create_string_view_array_with_len,
};
-use criterion::{Criterion, SamplingMode, criterion_group, criterion_main};
+use criterion::{Criterion, SamplingMode, criterion_group};
use datafusion_common::ScalarValue;
use datafusion_common::config::ConfigOptions;
use datafusion_expr::{ColumnarValue, ScalarFunctionArgs};
@@ -235,4 +235,3 @@ fn criterion_benchmark(c: &mut Criterion) {
}
criterion_group!(benches, criterion_benchmark);
-criterion_main!(benches);
diff --git a/datafusion/functions/benches/find_in_set_literal.rs b/datafusion/functions/benches/unicode_expressions/find_in_set_literal.rs
similarity index 97%
rename from datafusion/functions/benches/find_in_set_literal.rs
rename to datafusion/functions/benches/unicode_expressions/find_in_set_literal.rs
index 013c7c2081..96ff370889 100644
--- a/datafusion/functions/benches/find_in_set_literal.rs
+++ b/datafusion/functions/benches/unicode_expressions/find_in_set_literal.rs
@@ -21,7 +21,7 @@
use arrow::array::StringArray;
use arrow::datatypes::{DataType, Field};
-use criterion::{BenchmarkId, Criterion, criterion_group, criterion_main};
+use criterion::{BenchmarkId, Criterion, criterion_group};
use datafusion_common::ScalarValue;
use datafusion_common::config::ConfigOptions;
use datafusion_expr::{ColumnarValue, ScalarFunctionArgs};
@@ -95,4 +95,3 @@ fn criterion_benchmark(c: &mut Criterion) {
}
criterion_group!(benches, criterion_benchmark);
-criterion_main!(benches);
diff --git a/datafusion/functions/benches/initcap.rs b/datafusion/functions/benches/unicode_expressions/initcap.rs
similarity index 98%
rename from datafusion/functions/benches/initcap.rs
rename to datafusion/functions/benches/unicode_expressions/initcap.rs
index b5e653e413..81340ac150 100644
--- a/datafusion/functions/benches/initcap.rs
+++ b/datafusion/functions/benches/unicode_expressions/initcap.rs
@@ -20,7 +20,7 @@ use arrow::datatypes::{DataType, Field};
use arrow::util::bench_util::{
create_string_array_with_len, create_string_view_array_with_len,
};
-use criterion::{Criterion, SamplingMode, criterion_group, criterion_main};
+use criterion::{Criterion, SamplingMode, criterion_group};
use datafusion_common::ScalarValue;
use datafusion_common::config::ConfigOptions;
use datafusion_expr::{ColumnarValue, ScalarFunctionArgs};
@@ -206,4 +206,3 @@ fn criterion_benchmark(c: &mut Criterion) {
}
criterion_group!(benches, criterion_benchmark);
-criterion_main!(benches);
diff --git a/datafusion/functions/benches/left_right.rs b/datafusion/functions/benches/unicode_expressions/left_right.rs
similarity index 97%
rename from datafusion/functions/benches/left_right.rs
rename to datafusion/functions/benches/unicode_expressions/left_right.rs
index 8d5865acb8..01a0dcad69 100644
--- a/datafusion/functions/benches/left_right.rs
+++ b/datafusion/functions/benches/unicode_expressions/left_right.rs
@@ -24,7 +24,7 @@ use arrow::datatypes::{DataType, Field};
use arrow::util::bench_util::{
create_string_array_with_len, create_string_view_array_with_len,
};
-use criterion::{Criterion, criterion_group, criterion_main};
+use criterion::{Criterion, criterion_group};
use datafusion_common::config::ConfigOptions;
use datafusion_expr::{ColumnarValue, ScalarFunctionArgs};
use datafusion_functions::unicode::{left, right};
@@ -112,4 +112,3 @@ fn criterion_benchmark(c: &mut Criterion) {
}
criterion_group!(benches, criterion_benchmark);
-criterion_main!(benches);
diff --git a/datafusion/functions/benches/levenshtein.rs b/datafusion/functions/benches/unicode_expressions/levenshtein.rs
similarity index 96%
rename from datafusion/functions/benches/levenshtein.rs
rename to datafusion/functions/benches/unicode_expressions/levenshtein.rs
index 08733b245f..f29af186ec 100644
--- a/datafusion/functions/benches/levenshtein.rs
+++ b/datafusion/functions/benches/unicode_expressions/levenshtein.rs
@@ -18,7 +18,7 @@
use arrow::array::OffsetSizeTrait;
use arrow::datatypes::{DataType, Field};
use arrow::util::bench_util::create_string_array_with_len;
-use criterion::{Criterion, SamplingMode, criterion_group, criterion_main};
+use criterion::{Criterion, SamplingMode, criterion_group};
use datafusion_common::DataFusionError;
use datafusion_common::config::ConfigOptions;
use datafusion_expr::{ColumnarValue, ScalarFunctionArgs};
@@ -82,4 +82,3 @@ fn criterion_benchmark(c: &mut Criterion) {
}
criterion_group!(benches, criterion_benchmark);
-criterion_main!(benches);
diff --git a/datafusion/functions/benches/unicode_expressions/main.rs b/datafusion/functions/benches/unicode_expressions/main.rs
new file mode 100644
index 0000000000..1e021155ae
--- /dev/null
+++ b/datafusion/functions/benches/unicode_expressions/main.rs
@@ -0,0 +1,55 @@
+// Licensed to the Apache Software Foundation (ASF) under one
+// or more contributor license agreements. See the NOTICE file
+// distributed with this work for additional information
+// regarding copyright ownership. The ASF licenses this file
+// to you under the Apache License, Version 2.0 (the
+// "License"); you may not use this file except in compliance
+// with the License. You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing,
+// software distributed under the License is distributed on an
+// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+// KIND, either express or implied. See the License for the
+// specific language governing permissions and limitations
+// under the License.
+
+//! Benchmarks for functions behind the `unicode_expressions` feature.
+//!
+//! Each benchmark beside this file is a module rather than its own `[[bench]]`
+//! target to reduce compile times and output size.
+//!
+//! Run one of them with `cargo bench --bench unicode_expressions -- <filter>`.
+
+use criterion::criterion_main;
+
+mod character_length;
+mod find_in_set;
+mod find_in_set_literal;
+#[path = "../helper.rs"]
+mod helper;
+mod initcap;
+mod left_right;
+mod levenshtein;
+mod pad;
+mod reverse;
+mod strpos;
+mod substr;
+mod substr_index;
+mod translate;
+
+criterion_main!(
+ character_length::benches,
+ find_in_set::benches,
+ find_in_set_literal::benches,
+ initcap::benches,
+ left_right::benches,
+ levenshtein::benches,
+ pad::benches,
+ reverse::benches,
+ strpos::benches,
+ substr::benches,
+ substr_index::benches,
+ translate::benches,
+);
diff --git a/datafusion/functions/benches/pad.rs b/datafusion/functions/benches/unicode_expressions/pad.rs
similarity index 99%
rename from datafusion/functions/benches/pad.rs
rename to datafusion/functions/benches/unicode_expressions/pad.rs
index 78ebf12236..b766203383 100644
--- a/datafusion/functions/benches/pad.rs
+++ b/datafusion/functions/benches/unicode_expressions/pad.rs
@@ -23,7 +23,7 @@ use arrow::datatypes::{DataType, Field, Int64Type};
use arrow::util::bench_util::{
create_string_array_with_len, create_string_view_array_with_len,
};
-use criterion::{Criterion, SamplingMode, criterion_group, criterion_main};
+use criterion::{Criterion, SamplingMode, criterion_group};
use datafusion_common::ScalarValue;
use datafusion_common::config::ConfigOptions;
use datafusion_expr::{ColumnarValue, ScalarFunctionArgs};
@@ -758,4 +758,3 @@ fn criterion_benchmark(c: &mut Criterion) {
}
criterion_group!(benches, criterion_benchmark);
-criterion_main!(benches);
diff --git a/datafusion/functions/benches/reverse.rs b/datafusion/functions/benches/unicode_expressions/reverse.rs
similarity index 97%
rename from datafusion/functions/benches/reverse.rs
rename to datafusion/functions/benches/unicode_expressions/reverse.rs
index f2e2898bbf..8e7a5592b9 100644
--- a/datafusion/functions/benches/reverse.rs
+++ b/datafusion/functions/benches/unicode_expressions/reverse.rs
@@ -15,13 +15,11 @@
// specific language governing permissions and limitations
// under the License.
-mod helper;
-
+use crate::helper::gen_string_array;
use arrow::datatypes::{DataType, Field};
-use criterion::{Criterion, criterion_group, criterion_main};
+use criterion::{Criterion, criterion_group};
use datafusion_common::config::ConfigOptions;
use datafusion_expr::ScalarFunctionArgs;
-use helper::gen_string_array;
use std::hint::black_box;
use std::sync::Arc;
@@ -138,4 +136,3 @@ fn criterion_benchmark(c: &mut Criterion) {
}
criterion_group!(benches, criterion_benchmark);
-criterion_main!(benches);
diff --git a/datafusion/functions/benches/strpos.rs b/datafusion/functions/benches/unicode_expressions/strpos.rs
similarity index 98%
rename from datafusion/functions/benches/strpos.rs
rename to datafusion/functions/benches/unicode_expressions/strpos.rs
index 549186dbab..2902d41df6 100644
--- a/datafusion/functions/benches/strpos.rs
+++ b/datafusion/functions/benches/unicode_expressions/strpos.rs
@@ -17,7 +17,7 @@
use arrow::array::{StringArray, StringViewArray};
use arrow::datatypes::{DataType, Field};
-use criterion::{Criterion, criterion_group, criterion_main};
+use criterion::{Criterion, criterion_group};
use datafusion_common::ScalarValue;
use datafusion_common::config::ConfigOptions;
use datafusion_expr::{ColumnarValue, ScalarFunctionArgs};
@@ -232,4 +232,3 @@ fn criterion_benchmark(c: &mut Criterion) {
}
criterion_group!(benches, criterion_benchmark);
-criterion_main!(benches);
diff --git a/datafusion/functions/benches/substr.rs b/datafusion/functions/benches/unicode_expressions/substr.rs
similarity index 99%
rename from datafusion/functions/benches/substr.rs
rename to datafusion/functions/benches/unicode_expressions/substr.rs
index 3939fd100e..c98c7d99c2 100644
--- a/datafusion/functions/benches/substr.rs
+++ b/datafusion/functions/benches/unicode_expressions/substr.rs
@@ -20,7 +20,7 @@ use arrow::datatypes::{DataType, Field};
use arrow::util::bench_util::{
create_string_array_with_len, create_string_view_array_with_len,
};
-use criterion::{Criterion, SamplingMode, criterion_group, criterion_main};
+use criterion::{Criterion, SamplingMode, criterion_group};
use datafusion_common::config::ConfigOptions;
use datafusion_common::{DataFusionError, ScalarValue};
use datafusion_expr::{ColumnarValue, ScalarFunctionArgs};
@@ -291,4 +291,3 @@ fn criterion_benchmark(c: &mut Criterion) {
}
criterion_group!(benches, criterion_benchmark);
-criterion_main!(benches);
diff --git a/datafusion/functions/benches/substr_index.rs b/datafusion/functions/benches/unicode_expressions/substr_index.rs
similarity index 99%
rename from datafusion/functions/benches/substr_index.rs
rename to datafusion/functions/benches/unicode_expressions/substr_index.rs
index a0c3784dbe..fb5e77cfa0 100644
--- a/datafusion/functions/benches/substr_index.rs
+++ b/datafusion/functions/benches/unicode_expressions/substr_index.rs
@@ -20,7 +20,7 @@ use std::sync::Arc;
use arrow::array::{ArrayRef, Int64Array, StringArray, StringViewArray};
use arrow::datatypes::{DataType, Field};
-use criterion::{Criterion, criterion_group, criterion_main};
+use criterion::{Criterion, criterion_group};
use datafusion_common::{ScalarValue, config::ConfigOptions};
use datafusion_expr::{ColumnarValue, ScalarFunctionArgs};
use datafusion_functions::unicode::substr_index;
@@ -257,4 +257,3 @@ fn criterion_benchmark(c: &mut Criterion) {
}
criterion_group!(benches, criterion_benchmark);
-criterion_main!(benches);
diff --git a/datafusion/functions/benches/translate.rs b/datafusion/functions/benches/unicode_expressions/translate.rs
similarity index 98%
rename from datafusion/functions/benches/translate.rs
rename to datafusion/functions/benches/unicode_expressions/translate.rs
index adde7b4bd7..90fdf4970f 100644
--- a/datafusion/functions/benches/translate.rs
+++ b/datafusion/functions/benches/unicode_expressions/translate.rs
@@ -18,7 +18,7 @@
use arrow::array::{GenericStringArray, OffsetSizeTrait};
use arrow::datatypes::{DataType, Field};
use arrow::util::bench_util::create_string_array_with_len;
-use criterion::{Criterion, SamplingMode, criterion_group, criterion_main};
+use criterion::{Criterion, SamplingMode, criterion_group};
use datafusion_common::config::ConfigOptions;
use datafusion_common::{DataFusionError, ScalarValue};
use datafusion_expr::{ColumnarValue, ScalarFunctionArgs};
@@ -162,4 +162,3 @@ fn criterion_benchmark(c: &mut Criterion) {
}
criterion_group!(benches, criterion_benchmark);
-criterion_main!(benches);