liamzwbao commented on code in PR #9411:
URL: https://github.com/apache/arrow-rs/pull/9411#discussion_r2834898347
##########
arrow-string/src/substring.rs:
##########
@@ -356,15 +355,16 @@ 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::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).
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:
nit: can we move the comment to its original place?
--
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]