liamzwbao commented on code in PR #9338:
URL: https://github.com/apache/arrow-rs/pull/9338#discussion_r2761877712


##########
arrow-array/src/array/boolean_array.rs:
##########
@@ -533,18 +533,14 @@ impl BooleanArray {
             }
         });
 
-        let data = unsafe {
-            ArrayData::new_unchecked(
-                DataType::Boolean,
-                data_len,
-                None,
-                Some(null_builder.into()),
-                0,
-                vec![val_builder.into()],
-                vec![],
-            )
-        };
-        BooleanArray::from(data)
+        let values = BooleanBuffer::new(val_builder.into(), 0, data_len);
+        let nulls = Some(NullBuffer::new(BooleanBuffer::new(
+            null_builder.into(),
+            0,
+            data_len,
+        )))
+        .filter(|n| n.null_count() > 0);

Review Comment:
   Good point! We can track number of `non_nulls` to see if we need to create a 
`NullBuffer`



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