You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@datafusion.apache.org by gi...@apache.org on 2026/05/04 05:35:45 UTC
(datafusion) branch gh-readonly-queue/main/pr-22007-1601ba3c9264e4b6895b6d2e8d236986937132e2 created (now b2fd2d32b0)
This is an automated email from the ASF dual-hosted git repository.
github-merge-queue[bot] pushed a change to branch gh-readonly-queue/main/pr-22007-1601ba3c9264e4b6895b6d2e8d236986937132e2
in repository https://gitbox.apache.org/repos/asf/datafusion.git
at b2fd2d32b0 bench: add to_char_array_date32 (#22007)
This branch includes the following new commits:
new b2fd2d32b0 bench: add to_char_array_date32 (#22007)
The 1 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails. The revisions
listed as "add" were already present in the repository and have only
been added to this reference.
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@datafusion.apache.org
For additional commands, e-mail: commits-help@datafusion.apache.org
(datafusion) 01/01: bench: add to_char_array_date32 (#22007)
Posted by gi...@apache.org.
This is an automated email from the ASF dual-hosted git repository.
github-merge-queue[bot] pushed a commit to branch gh-readonly-queue/main/pr-22007-1601ba3c9264e4b6895b6d2e8d236986937132e2
in repository https://gitbox.apache.org/repos/asf/datafusion.git
commit b2fd2d32b053f15632b9fa6941b363d67fd6844e
Author: Huy Mac <57...@users.noreply.github.com>
AuthorDate: Mon May 4 14:35:22 2026 +0900
bench: add to_char_array_date32 (#22007)
## Which issue does this PR close?
<!--
We generally require a GitHub issue to be filed for all bug fixes and
enhancements and this helps us generate change logs for our releases.
You can link an issue to this PR using the GitHub syntax. For example
`Closes #123` indicates that this PR will close issue #123.
-->
- Closes #.
## Rationale for this change
<!--
Why are you proposing this change? If this is already explained clearly
in the issue then this section is not needed.
Explaining clearly why changes are proposed helps reviewers understand
your changes and offer better suggestions for fixes.
-->
## What changes are included in this PR?
<!--
There is no need to duplicate the description in the issue here but it
is sometimes worth providing a summary of the individual changes in this
PR.
-->
Benchmark for https://github.com/apache/datafusion/pull/21948
## Are these changes tested?
<!--
We typically require tests for all PRs in order to:
1. Prevent the code from being accidentally broken by subsequent changes
2. Serve as another way to document the expected behavior of the code
If tests are not included in your PR, please explain why (for example,
are they covered by existing tests)?
-->
## Are there any user-facing changes?
<!--
If there are user-facing changes then we may require documentation to be
updated before approving the PR.
-->
<!--
If there are any breaking changes to public APIs, please add the `api
change` label.
-->
---
datafusion/functions/benches/to_char.rs | 60 +++++++++++++++++++++++++++++++++
1 file changed, 60 insertions(+)
diff --git a/datafusion/functions/benches/to_char.rs b/datafusion/functions/benches/to_char.rs
index 4d866570b7..350a55a371 100644
--- a/datafusion/functions/benches/to_char.rs
+++ b/datafusion/functions/benches/to_char.rs
@@ -278,6 +278,66 @@ fn criterion_benchmark(c: &mut Criterion) {
)
})
});
+
+ // These bellow 02 benchmarks use Date32 data with format strings that contain
+ // time specifiers (%H, %M, %S, ...). Arrow's Date32 formatter cannot
+ // handle time specifiers and falls back to a Date64 cast.
+
+ // Covers full fallback (every row triggers the cast)
+ c.bench_function("to_char_array_date32_datetime_patterns_1000", |b| {
+ let mut rng = rand::rng();
+ let data_arr = generate_date32_array(&mut rng);
+ let batch_len = data_arr.len();
+ let data = ColumnarValue::Array(Arc::new(data_arr) as ArrayRef);
+ let patterns = ColumnarValue::Array(Arc::new(generate_datetime_pattern_array(
+ &mut rng,
+ )) as ArrayRef);
+
+ b.iter(|| {
+ black_box(
+ to_char()
+ .invoke_with_args(ScalarFunctionArgs {
+ args: vec![data.clone(), patterns.clone()],
+ arg_fields: vec![
+ Field::new("a", data.data_type(), true).into(),
+ Field::new("b", patterns.data_type(), true).into(),
+ ],
+ number_rows: batch_len,
+ return_field: Field::new("f", DataType::Utf8, true).into(),
+ config_options: Arc::clone(&config_options),
+ })
+ .expect("to_char should work on valid values"),
+ )
+ })
+ });
+
+ // Covers partial fallback (roughly half the rows trigger it)
+ c.bench_function("to_char_array_date32_mixed_patterns_1000", |b| {
+ let mut rng = rand::rng();
+ let data_arr = generate_date32_array(&mut rng);
+ let batch_len = data_arr.len();
+ let data = ColumnarValue::Array(Arc::new(data_arr) as ArrayRef);
+ let patterns = ColumnarValue::Array(Arc::new(generate_mixed_pattern_array(
+ &mut rng,
+ )) as ArrayRef);
+
+ b.iter(|| {
+ black_box(
+ to_char()
+ .invoke_with_args(ScalarFunctionArgs {
+ args: vec![data.clone(), patterns.clone()],
+ arg_fields: vec![
+ Field::new("a", data.data_type(), true).into(),
+ Field::new("b", patterns.data_type(), true).into(),
+ ],
+ number_rows: batch_len,
+ return_field: Field::new("f", DataType::Utf8, true).into(),
+ config_options: Arc::clone(&config_options),
+ })
+ .expect("to_char should work on valid values"),
+ )
+ })
+ });
}
criterion_group!(benches, criterion_benchmark);
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@datafusion.apache.org
For additional commands, e-mail: commits-help@datafusion.apache.org