This is an automated email from the ASF dual-hosted git repository.

viirya pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/arrow-rs.git


The following commit(s) were added to refs/heads/master by this push:
     new 5e2350a98 Minor: support new types in struct_builder.rs (#4177)
5e2350a98 is described below

commit 5e2350a9804201407c33d9ecd5fa90d598b52cfb
Author: Igor Izvekov <[email protected]>
AuthorDate: Mon May 8 18:53:24 2023 +0300

    Minor: support new types in struct_builder.rs (#4177)
---
 arrow-array/src/builder/primitive_builder.rs |  4 +++-
 arrow-array/src/builder/struct_builder.rs    | 11 +++++++++++
 2 files changed, 14 insertions(+), 1 deletion(-)

diff --git a/arrow-array/src/builder/primitive_builder.rs 
b/arrow-array/src/builder/primitive_builder.rs
index 6688d07b7..8721004d2 100644
--- a/arrow-array/src/builder/primitive_builder.rs
+++ b/arrow-array/src/builder/primitive_builder.rs
@@ -41,6 +41,8 @@ pub type UInt16Builder = PrimitiveBuilder<UInt16Type>;
 pub type UInt32Builder = PrimitiveBuilder<UInt32Type>;
 /// An usigned 64-bit integer array builder.
 pub type UInt64Builder = PrimitiveBuilder<UInt64Type>;
+/// A 16-bit floating point array builder.
+pub type Float16Builder = PrimitiveBuilder<Float16Type>;
 /// A 32-bit floating point array builder.
 pub type Float32Builder = PrimitiveBuilder<Float32Type>;
 /// A 64-bit floating point array builder.
@@ -180,7 +182,7 @@ impl<T: ArrowPrimitiveType> PrimitiveBuilder<T> {
     /// data type of the generated array.
     ///
     /// This method allows overriding the data type, to allow specifying 
timezones
-    /// for [`DataType::Timestamp`] or precision and scale for 
[`DataType::Decimal128`]
+    /// for [`DataType::Timestamp`] or precision and scale for 
[`DataType::Decimal128`] and [`DataType::Decimal256`]
     ///
     /// # Panics
     ///
diff --git a/arrow-array/src/builder/struct_builder.rs 
b/arrow-array/src/builder/struct_builder.rs
index ebffeafcf..4702bb734 100644
--- a/arrow-array/src/builder/struct_builder.rs
+++ b/arrow-array/src/builder/struct_builder.rs
@@ -109,9 +109,13 @@ pub fn make_builder(datatype: &DataType, capacity: usize) 
-> Box<dyn ArrayBuilde
         DataType::UInt16 => Box::new(UInt16Builder::with_capacity(capacity)),
         DataType::UInt32 => Box::new(UInt32Builder::with_capacity(capacity)),
         DataType::UInt64 => Box::new(UInt64Builder::with_capacity(capacity)),
+        DataType::Float16 => Box::new(Float16Builder::with_capacity(capacity)),
         DataType::Float32 => Box::new(Float32Builder::with_capacity(capacity)),
         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::FixedSizeBinary(len) => {
             Box::new(FixedSizeBinaryBuilder::with_capacity(capacity, *len))
         }
@@ -119,7 +123,14 @@ pub fn make_builder(datatype: &DataType, capacity: usize) 
-> Box<dyn ArrayBuilde
             Decimal128Builder::with_capacity(capacity)
                 .with_data_type(DataType::Decimal128(*p, *s)),
         ),
+        DataType::Decimal256(p, s) => Box::new(
+            Decimal256Builder::with_capacity(capacity)
+                .with_data_type(DataType::Decimal256(*p, *s)),
+        ),
         DataType::Utf8 => Box::new(StringBuilder::with_capacity(capacity, 
1024)),
+        DataType::LargeUtf8 => {
+            Box::new(LargeStringBuilder::with_capacity(capacity, 1024))
+        }
         DataType::Date32 => Box::new(Date32Builder::with_capacity(capacity)),
         DataType::Date64 => Box::new(Date64Builder::with_capacity(capacity)),
         DataType::Time32(TimeUnit::Second) => {

Reply via email to