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


##########
arrow-string/src/regexp.rs:
##########
@@ -180,6 +180,11 @@ pub fn regexp_is_match_scalar<'a, S>(
 where
     &'a S: StringArrayType<'a>,
 {
+    let null_bit_buffer = array
+        .nulls()
+        .map(|n| n.inner().sliced())
+        .and_then(|b| NullBuffer::from_unsliced_buffer(b, array.len()))
+        .map(|nb| nb.into_inner().into_inner());

Review Comment:
   We don't need a new `null_bit_buffer`, let's refactor line 208 to 212 at the 
end of this func instead



##########
arrow-string/src/substring.rs:
##########
@@ -356,15 +355,13 @@ fn fixed_size_binary_substring(
     let mut nulls = array
         .nulls()
         .map(|n| n.inner().sliced())
-        .map(|b| NullBuffer::new(BooleanBuffer::new(b, 0, num_of_elements)))
-        .filter(|n| n.null_count() > 0);
+        .and_then(|b| NullBuffer::from_unsliced_buffer(b, num_of_elements));
+
+    // FixedSizeBinaryArray with size 0 requires a validity bitmap
     if new_len == 0 && nulls.is_none() {
-        // FixedSizeBinaryArray::new takes length from the values buffer, 
except when size == 0.
-        // In that case it uses the null buffer length, so preserve the 
original length here.
-        // Example: ["", "", ""] -> substring(..., 1, Some(2)) should keep 
len=3;
-        // otherwise it collapses to an empty array (len=0).

Review Comment:
   We should keep the existing comment here and avoid adding the new comment on 
line 360, as it is unrelated to this PR.



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