alamb commented on code in PR #12336:
URL: https://github.com/apache/arrow-rs/pull/12336#discussion_r4652332025


##########
arrow-select/src/coalesce/boolean.rs:
##########
@@ -203,6 +205,28 @@ impl InProgressArray for InProgressBooleanArray {
         Ok(())
     }
 
+    unsafe fn copy_rows_by_indices(
+        &mut self,
+        source: &ArrayRef,
+        indices: &UInt32Array,
+    ) -> Result<(), ArrowError> {
+        if indices.is_empty() {
+            return Ok(());
+        }
+        let source = source.as_boolean();
+        let values = take_bits::<UInt32Type, false>(source.values(), indices);

Review Comment:
   this still allocates a new `BooleanBuffer` which is unfortunate 
   
   One potential improvement would be to move this function
   ```rust
   #[inline(never)]
   pub(crate) fn take_bits<I: ArrowPrimitiveType, const VALIDATE_INDICES: bool>(
       values: &BooleanBuffer,
       indices: &PrimitiveArray<I>,
   ) -> BooleanBuffer {
   ```
   
   On to a method in BooleanBufferBuilder so it would be like 
   ```rust
   impl BooleanBufferBuilder {
   
   /// Appends values at indices to the builder
   pub(crate) fn take_bits<I: ArrowPrimitiveType, const VALIDATE_INDICES: bool>(
       &mut self BooleanBuffer,
       values: &BooleanBuffer,
       indices: &PrimitiveArray<I>,
   )  {
   ...
   }
   ...
   }
   ```



##########
arrow-select/src/coalesce/boolean.rs:
##########
@@ -203,6 +205,28 @@ impl InProgressArray for InProgressBooleanArray {
         Ok(())
     }
 
+    unsafe fn copy_rows_by_indices(
+        &mut self,
+        source: &ArrayRef,
+        indices: &UInt32Array,
+    ) -> Result<(), ArrowError> {
+        if indices.is_empty() {
+            return Ok(());
+        }
+        let source = source.as_boolean();
+        let values = take_bits::<UInt32Type, false>(source.values(), indices);

Review Comment:
   As a follow on PR perhaps



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