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


##########
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:
   I do wonder if there is a way to filter in advance, before the `into()` 🤔
   
   Might be a minor optimization but worth thinking about perhaps?



##########
arrow-string/src/regexp.rs:
##########
@@ -180,7 +180,6 @@ pub fn regexp_is_match_scalar<'a, S>(
 where
     &'a S: StringArrayType<'a>,
 {
-    let null_bit_buffer = array.nulls().map(|x| x.inner().sliced());

Review Comment:
   I think `sliced` was needed because when using `ArrayData` we must pass in a 
`Buffer` for nulls; if we don't do `sliced` then the potential offset which is 
stored at the `BooleanBuffer` level gets lost in translation. If we are moving 
away from `ArrayData` here we can simply pass the nulls as is as the slice 
becomes unnecessary.



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