velvia commented on a change in pull request #8688:
URL: https://github.com/apache/arrow/pull/8688#discussion_r526508679



##########
File path: rust/arrow/src/compute/kernels/boolean.rs
##########
@@ -457,4 +517,42 @@ mod tests {
         assert_eq!(true, res.value(2));
         assert_eq!(false, res.value(3));
     }
+
+    fn assert_array_eq<T: ArrowNumericType>(
+        expected: PrimitiveArray<T>,
+        actual: ArrayRef,
+    ) {
+        let actual = actual
+            .as_any()
+            .downcast_ref::<PrimitiveArray<T>>()
+            .expect("Actual array should unwrap to type of expected array");
+
+        for i in 0..expected.len() {
+            if expected.is_null(i) {
+                assert!(actual.is_null(i));
+            } else {
+                assert_eq!(expected.value(i), actual.value(i));
+            }
+        }
+    }
+

Review comment:
       To give more details on the issue:  we have basically a left_bitmap and 
a right_bitmap.  The left_bitmap is at left_offset_bits bits, and the right 
bitmap is at right_offset_bits.
   
   If left_offset_bits == right_offset_bits, then everything is easy, the 
resulting bitmap in fact does not need to be shifted.
   
   If left_offset_bits != right_offset_bits, one can do:
   * Use bit_slice() on left_bitmap and on right_bitmap, the result is 0-based 
and can be operated on
   * After the operation, "right shift" the resulting bitmap so it is based on 
left_offset again (since the resulting data is based on left array)
   
   An optimization of the above is to shift right_bitmap so it lines up with 
left_bitmap.
   
   I see `bit_slice()`, but I don't see anything in the Buffer API to "right 
shift".....
   
   @vertexclique @alamb any ideas?  Thanks.




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

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


Reply via email to