viirya commented on code in PR #2579:
URL: https://github.com/apache/arrow-rs/pull/2579#discussion_r954544083
##########
arrow/src/compute/kernels/comparison.rs:
##########
@@ -56,20 +56,25 @@ where
));
}
+ let len = left.len();
+
let null_bit_buffer =
combine_option_bitmap(&[left.data_ref(), right.data_ref()],
left.len())?;
- // Safety:
- // `i < $left.len()` and $left.len() == $right.len()
- let comparison = (0..left.len())
- .map(|i| unsafe { op(left.value_unchecked(i),
right.value_unchecked(i)) });
- // same size as $left.len() and $right.len()
+ let comparison =
+ ValuesIter::new(left)
+ .zip(ValuesIter::new(right))
+ .map(|(a, b)| match (a, b) {
+ (Some(a), Some(b)) => op(a, b),
+ _ => false,
+ });
+ // SAFETY: ValuesIter is a trusted length iterator
Review Comment:
Not sure how much this impacts performance.
--
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]