alamb commented on code in PR #9294:
URL: https://github.com/apache/arrow-rs/pull/9294#discussion_r2741364810


##########
arrow-array/src/array/primitive_array.rs:
##########
@@ -1467,13 +1468,14 @@ impl<T: ArrowPrimitiveType, Ptr: 
Into<NativeAdapter<T>>> FromIterator<Ptr> for P
             .collect();
 
         let len = null_builder.len();
+        let maybe_nulls = null_builder.finish().map(|x| 
x.into_inner().into_inner());
 
         let data = unsafe {
             ArrayData::new_unchecked(
                 T::DATA_TYPE,
                 len,
                 None,
-                Some(null_builder.into()),
+                maybe_nulls,

Review Comment:
   I think you can make this even faster (avoid another allocation) by directly 
constructing the PrimitiveArray
   
   ```suggestion
   
           let maybe_nulls = null_builder.finish();
   
           PrimitiveArray::new(ScalarBuffer::from(buffer), maybe_nulls)
       }
   ```



-- 
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.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to