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

tustvold 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 48cd0cfaae Fix FixedSizeListBuilder capacity (#4549) (#4552)
48cd0cfaae is described below

commit 48cd0cfaae66dc8316b89179d5d1ec7ddca91cfb
Author: Raphael Taylor-Davies <[email protected]>
AuthorDate: Sat Jul 22 00:03:44 2023 -0400

    Fix FixedSizeListBuilder capacity (#4549) (#4552)
---
 arrow-array/src/builder/fixed_size_list_builder.rs | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/arrow-array/src/builder/fixed_size_list_builder.rs 
b/arrow-array/src/builder/fixed_size_list_builder.rs
index f7e8999099..0fe779d5c1 100644
--- a/arrow-array/src/builder/fixed_size_list_builder.rs
+++ b/arrow-array/src/builder/fixed_size_list_builder.rs
@@ -73,7 +73,11 @@ impl<T: ArrayBuilder> FixedSizeListBuilder<T> {
     /// Creates a new [`FixedSizeListBuilder`] from a given values array 
builder
     /// `value_length` is the number of values within each array
     pub fn new(values_builder: T, value_length: i32) -> Self {
-        let capacity = values_builder.len();
+        let capacity = values_builder
+            .len()
+            .checked_div(value_length as _)
+            .unwrap_or_default();
+
         Self::with_capacity(values_builder, value_length, capacity)
     }
 

Reply via email to