tustvold commented on code in PR #2064:
URL: https://github.com/apache/arrow-rs/pull/2064#discussion_r922422377
##########
arrow/src/compute/kernels/take.rs:
##########
@@ -599,76 +599,68 @@ where
Ok(PrimitiveArray::<T>::from(data))
}
-/// `take` implementation for boolean arrays
-fn take_boolean<IndexType>(
- values: &BooleanArray,
+fn take_bits<IndexType>(
+ values: &Buffer,
+ values_offset: usize,
indices: &PrimitiveArray<IndexType>,
-) -> Result<BooleanArray>
+) -> Result<Buffer>
where
IndexType: ArrowNumericType,
IndexType::Native: ToPrimitive,
{
- let data_len = indices.len();
+ let len = indices.len();
+ let values_slice = values.as_slice();
+ let mut output_buffer = MutableBuffer::new_null(len);
+ let output_slice = output_buffer.as_slice_mut();
- let num_byte = bit_util::ceil(data_len, 8);
- let mut val_buf = MutableBuffer::from_len_zeroed(num_byte);
-
- let val_slice = val_buf.as_slice_mut();
-
- let null_count = values.null_count();
-
- let nulls = if null_count == 0 {
- (0..data_len).try_for_each::<_, Result<()>>(|i| {
- let index = ToPrimitive::to_usize(&indices.value(i)).ok_or_else(||
{
- ArrowError::ComputeError("Cast to usize failed".to_string())
- })?;
+ indices
Review Comment:
Yeah, I basically wonder if it isn't showing up as a regression as
separating out the null mask handling makes up for it. However, perhaps we can
make it even faster by adding the special case back :smile:
--
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]