tustvold commented on a change in pull request #7076:
URL: https://github.com/apache/arrow/pull/7076#discussion_r418650048



##########
File path: rust/arrow/src/array/builder.rs
##########
@@ -527,11 +527,18 @@ pub struct ListBuilder<T: ArrayBuilder> {
 impl<T: ArrayBuilder> ListBuilder<T> {
     /// Creates a new `ListArrayBuilder` from a given values array builder
     pub fn new(values_builder: T) -> Self {
-        let mut offsets_builder = Int32BufferBuilder::new(values_builder.len() 
+ 1);
+        let capacity = values_builder.len();
+        Self::with_capacity(values_builder, capacity)
+    }
+
+    /// Creates a new `ListArrayBuilder` from a given values array builder
+    /// `append` may be called up to `capacity` times without triggering 
reallocation

Review comment:
       I went with something I hope was in the spirit of what you wanted, as 
technically it allocates for an extra offset and also pre-allocates the bitmap 
builder. Let me know if you'd prefer I stuck with your exact wording




----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


Reply via email to