You are viewing a plain text version of this content. The canonical link for it is here.
Posted to github@arrow.apache.org by GitBox <gi...@apache.org> on 2020/11/21 22:19:05 UTC

[GitHub] [arrow] jhorstmann commented on a change in pull request #8688: ARROW-10330: [Rust][DataFusion] Implement NULLIF() SQL function

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



##########
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:
       @velvia In the current version you could use the `bitwise_bin_op_helper`from `buffer.rs` if you make that public. That calls your bitwise operation with two `u64` as an input and takes care of the offset alignment.
   
   In our internal codebase we have similar functions also for 3 or 4 inputs, which would come in handy for you usecase, since you could calculate the result without the temporary `right_combo_buffer`. So you could also think about copying that function and modifying to take a function of 3 parameters instead.




----------------------------------------------------------------
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:
users@infra.apache.org