rluvaton commented on code in PR #11324:
URL: https://github.com/apache/arrow-rs/pull/11324#discussion_r4178194214
##########
arrow-ord/src/partition.rs:
##########
@@ -166,6 +169,46 @@ fn find_boundaries(v: &dyn Array) -> Result<BooleanBuffer,
ArrowError> {
Ok((0..slice_len).map(|i| !cmp(i, i).is_eq()).collect())
}
+fn convert_boolean_buffer_to_builder(buffer: BooleanBuffer) ->
BooleanBufferBuilder {
+ let len = buffer.len();
+
+ // This should be 0, but in case it doesn't simplify the code by doing a
copy to a new buffer
+ let buffer = if buffer.offset() != 0 {
+ // Recreate
+ BooleanBuffer::from_iter(buffer.iter())
+ } else {
+ buffer
+ };
+ assert_eq!(buffer.offset(), 0);
+
+ let buffer = buffer.into_inner();
+
+ let mutable = buffer
+ .into_mutable()
+ // This should not happen but just in case copy to owned mutable buffer
+ .unwrap_or_else(|buffer| {
+ let mut mutable = MutableBuffer::new(buffer.len());
+ // SAFETY: We just allocated a buffer of the same length as the
original buffer, so it is safe to set the length to the original buffer's
length.
+ unsafe { mutable.set_len(buffer.len()) };
+ mutable.as_slice_mut().copy_from_slice(buffer.as_slice());
+
+ mutable
+ });
+
+ BooleanBufferBuilder::new_from_buffer(mutable, len)
+}
+
+fn or(lhs: &mut BooleanBufferBuilder, rhs: BooleanBuffer) {
+ apply_bitwise_binary_op(
+ lhs.as_slice_mut(),
+ 0,
Review Comment:
This is zero since we made sure that the input start at zero
--
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]