This is an automated email from the ASF dual-hosted git repository.
Jefffrey pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/arrow-rs.git
The following commit(s) were added to refs/heads/main by this push:
new aca75aeb79 bench(arrow): add array/array LIKE pattern benchmarks
(#11195)
aca75aeb79 is described below
commit aca75aeb799281a87c52059bb6bb02f845b1e292
Author: yongster <[email protected]>
AuthorDate: Thu Sep 24 17:30:32 2026 +0800
bench(arrow): add array/array LIKE pattern benchmarks (#11195)
# Which issue does this PR close?
- Related to #11084. Does not close it. The predicate cache stays in
#11137.
# Rationale for this change
`comparison_kernels` covers scalar LIKE / ILIKE, not array/array
patterns. Without these cases on `main`, a pattern-cache change has no
baseline for the benchmark bot to compare.
This PR adds only the benchmarks. #11137 keeps the cache and drops these
benches, so once this is merged a later run can show the
alternating-pattern delta.
# What changes are included in this PR?
Five `comparison_kernels` cases, 1,024 rows of `"xxxxxxxx"`:
- `like_utf8 array complex consecutive` (`%x_x%x`)
- `like_utf8 array complex alternating` (`%x_x%x` / `x%_x%`)
- `ilike_utf8 array complex alternating`
- `like_utf8 array simple alternating` (`x%` / `%x`)
- `like_utf8 array complex unique` (one distinct complex pattern per
row)
No kernel changes.
# Are these changes tested?
Benchmark-only. Behavior is unchanged, so there are no new tests.
# Are there any user-facing changes?
No.
Co-authored-by: yang3.xie <[email protected]>
---
arrow/benches/comparison_kernels.rs | 36 ++++++++++++++++++++++++++++++++++++
1 file changed, 36 insertions(+)
diff --git a/arrow/benches/comparison_kernels.rs
b/arrow/benches/comparison_kernels.rs
index 69523026e4..77614ddf5d 100644
--- a/arrow/benches/comparison_kernels.rs
+++ b/arrow/benches/comparison_kernels.rs
@@ -459,6 +459,42 @@ fn add_benchmark(c: &mut Criterion) {
b.iter(|| bench_nilike_utf8_scalar(&arr_string, "%xx_xX%xXX"))
});
+ // Array/array LIKE: low-cardinality pattern reuse vs unique patterns.
+ const LIKE_ARRAY_SIZE: usize = 1024;
+ let like_haystack = StringArray::from(vec!["xxxxxxxx"; LIKE_ARRAY_SIZE]);
+ let like_complex_consecutive = StringArray::from(vec!["%x_x%x";
LIKE_ARRAY_SIZE]);
+ let like_complex_alternating = StringArray::from(
+ (0..LIKE_ARRAY_SIZE)
+ .map(|i| if i % 2 == 0 { "%x_x%x" } else { "x%_x%" })
+ .collect::<Vec<_>>(),
+ );
+ let like_simple_alternating = StringArray::from(
+ (0..LIKE_ARRAY_SIZE)
+ .map(|i| if i % 2 == 0 { "x%" } else { "%x" })
+ .collect::<Vec<_>>(),
+ );
+ let like_complex_unique = StringArray::from(
+ (0..LIKE_ARRAY_SIZE)
+ .map(|i| format!("%x_{i}x%"))
+ .collect::<Vec<_>>(),
+ );
+
+ c.bench_function("like_utf8 array complex consecutive", |b| {
+ b.iter(|| like(&like_haystack, &like_complex_consecutive).unwrap())
+ });
+ c.bench_function("like_utf8 array complex alternating", |b| {
+ b.iter(|| like(&like_haystack, &like_complex_alternating).unwrap())
+ });
+ c.bench_function("ilike_utf8 array complex alternating", |b| {
+ b.iter(|| ilike(&like_haystack, &like_complex_alternating).unwrap())
+ });
+ c.bench_function("like_utf8 array simple alternating", |b| {
+ b.iter(|| like(&like_haystack, &like_simple_alternating).unwrap())
+ });
+ c.bench_function("like_utf8 array complex unique", |b| {
+ b.iter(|| like(&like_haystack, &like_complex_unique).unwrap())
+ });
+
// StringArray: regexp_matches_utf8 scalar benchmarks
let mut group =
c.benchmark_group("StringArray: regexp_matches_utf8 scalar
benchmarks".to_string());