This is an automated email from the ASF dual-hosted git repository.
alamb 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 dfe907f652 Minor: Support BinaryView and StringView builders in
`make_builder` (#7931)
dfe907f652 is described below
commit dfe907f652f2668c77bc97afea1b810f06edc39d
Author: Kyle Barron <[email protected]>
AuthorDate: Thu Jul 17 11:24:27 2025 -0400
Minor: Support BinaryView and StringView builders in `make_builder` (#7931)
# Which issue does this PR close?
- Closes #NNN.
This is minor but I can create an issue if needed.
# Rationale for this change
`make_builder` currently errors with `Data type Utf8View is not
currently supported`.
# What changes are included in this PR?
Support `DataType::Utf8View` and `DataType::BinaryView` in
`make_builder`.
# Are these changes tested?
Only via the exhaustive enum match. It doesn't look like there are any
tests for `make_builder` in that file?
# Are there any user-facing changes?
No
---
arrow-array/src/builder/mod.rs | 2 ++
1 file changed, 2 insertions(+)
diff --git a/arrow-array/src/builder/mod.rs b/arrow-array/src/builder/mod.rs
index cbbf423467..ea9c98f9b6 100644
--- a/arrow-array/src/builder/mod.rs
+++ b/arrow-array/src/builder/mod.rs
@@ -447,6 +447,7 @@ pub fn make_builder(datatype: &DataType, capacity: usize)
-> Box<dyn ArrayBuilde
DataType::Float64 => Box::new(Float64Builder::with_capacity(capacity)),
DataType::Binary => Box::new(BinaryBuilder::with_capacity(capacity,
1024)),
DataType::LargeBinary =>
Box::new(LargeBinaryBuilder::with_capacity(capacity, 1024)),
+ DataType::BinaryView =>
Box::new(BinaryViewBuilder::with_capacity(capacity)),
DataType::FixedSizeBinary(len) => {
Box::new(FixedSizeBinaryBuilder::with_capacity(capacity, *len))
}
@@ -464,6 +465,7 @@ pub fn make_builder(datatype: &DataType, capacity: usize)
-> Box<dyn ArrayBuilde
),
DataType::Utf8 => Box::new(StringBuilder::with_capacity(capacity,
1024)),
DataType::LargeUtf8 =>
Box::new(LargeStringBuilder::with_capacity(capacity, 1024)),
+ DataType::Utf8View =>
Box::new(StringViewBuilder::with_capacity(capacity)),
DataType::Date32 => Box::new(Date32Builder::with_capacity(capacity)),
DataType::Date64 => Box::new(Date64Builder::with_capacity(capacity)),
DataType::Time32(TimeUnit::Second) => {