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/20 02:23:18 UTC
(datafusion) branch gh-readonly-queue/main/pr-22183-7738f74a13c409779bb9fbc2db52e71358314516 created (now b35738181e)
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-22183-7738f74a13c409779bb9fbc2db52e71358314516
in repository https://gitbox.apache.org/repos/asf/datafusion.git
at b35738181e chore: Replace stray old-style string builder in `substr` (#22183)
This branch includes the following new commits:
new b35738181e chore: Replace stray old-style string builder in `substr` (#22183)
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: chore: Replace stray old-style string builder in `substr` (#22183)
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-22183-7738f74a13c409779bb9fbc2db52e71358314516
in repository https://gitbox.apache.org/repos/asf/datafusion.git
commit b35738181e97d41e366b2106322a6893d34e16fb
Author: Neil Conway <ne...@gmail.com>
AuthorDate: Tue May 19 22:22:52 2026 -0400
chore: Replace stray old-style string builder in `substr` (#22183)
## Which issue does this PR close?
- N/A
## Rationale for this change
In #21519, we optimized `substr` to use the new bulk-NULL string
builders. That PR neglected to convert over one corner-case code path
(for handling `Utf8` / `LargeUtf8` values larger than 2GB). For
consistency (and a small perf win), this PR converts that case as well.
## What changes are included in this PR?
* Swap Arrow's `StringViewBuilder` for the new `StringViewArrayBuilder`
in `generic_string_substr_copy`
## Are these changes tested?
Yes, covered by existing tests.
## Are there any user-facing changes?
No.
---
datafusion/functions/src/unicode/substr.rs | 13 +++++++------
1 file changed, 7 insertions(+), 6 deletions(-)
diff --git a/datafusion/functions/src/unicode/substr.rs b/datafusion/functions/src/unicode/substr.rs
index 951fc4c6cd..903c03857e 100644
--- a/datafusion/functions/src/unicode/substr.rs
+++ b/datafusion/functions/src/unicode/substr.rs
@@ -17,11 +17,11 @@
use std::sync::Arc;
-use crate::strings::append_view;
+use crate::strings::{StringViewArrayBuilder, append_view};
use crate::utils::make_scalar_function;
use arrow::array::{
Array, ArrayRef, AsArray, GenericStringArray, Int64Array, OffsetSizeTrait,
- StringArrayType, StringViewArray, StringViewBuilder, make_view,
+ StringArrayType, StringViewArray, make_view,
};
use arrow::buffer::{NullBuffer, ScalarBuffer};
use arrow::datatypes::DataType;
@@ -426,11 +426,12 @@ fn generic_string_substr_copy<T: OffsetSizeTrait>(
count_array_opt.and_then(|a| a.nulls()),
]);
- let mut result_builder = StringViewBuilder::new();
+ let len = string_array.len();
+ let mut result_builder = StringViewArrayBuilder::with_capacity(len);
- for i in 0..string_array.len() {
+ for i in 0..len {
if nulls.as_ref().is_some_and(|n| n.is_null(i)) {
- result_builder.append_null();
+ result_builder.append_placeholder();
continue;
}
@@ -442,7 +443,7 @@ fn generic_string_substr_copy<T: OffsetSizeTrait>(
result_builder.append_value(&string[byte_start..byte_end]);
}
- Ok(Arc::new(result_builder.finish()) as ArrayRef)
+ Ok(Arc::new(result_builder.finish(nulls)?) as ArrayRef)
}
#[cfg(test)]
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@datafusion.apache.org
For additional commands, e-mail: commits-help@datafusion.apache.org