tustvold commented on code in PR #2064:
URL: https://github.com/apache/arrow-rs/pull/2064#discussion_r922269054


##########
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:
   This seems to lose the special case of no null values, I would have naively 
thought this would make a non-trivial performance difference for the very 
common case where there aren't any nulls?



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