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


##########
arrow-ord/src/comparison.rs:
##########
@@ -2643,122 +2646,103 @@ mod tests {
         );
     }
 
-    fn test_primitive_dyn_scalar<T: ArrowPrimitiveType>(array: 
PrimitiveArray<T>) {

Review Comment:
   I much prefer generics to macros, they are easier to read, debug and 
maintain...



##########
arrow-ord/src/comparison.rs:
##########
@@ -1641,403 +1789,242 @@ mod tests {
 
     #[test]
     fn test_primitive_array_neq() {
-        cmp_i64!(
-            neq,
-            neq_dyn,
-            vec![8, 8, 8, 8, 8, 8, 8, 8, 8, 8],
-            vec![6, 7, 8, 9, 10, 6, 7, 8, 9, 10],
-            vec![true, true, false, true, true, true, true, false, true, true]
-        );
-
-        cmp_vec!(
-            neq,
-            neq_dyn,
-            TimestampMillisecondArray,
-            vec![8, 8, 8, 8, 8, 8, 8, 8, 8, 8],
-            vec![6, 7, 8, 9, 10, 6, 7, 8, 9, 10],
-            vec![true, true, false, true, true, true, true, false, true, true]
-        );
+        test_array_array_op!(crate::cmp::neq, "neq", Int64Array);
+        test_array_array_op!(crate::cmp::neq, "neq", 
TimestampMillisecondArray);
     }
 
     #[test]
     fn test_primitive_array_neq_scalar() {
-        cmp_i64_scalar!(
-            neq_scalar,
-            vec![6, 7, 8, 9, 10, 6, 7, 8, 9, 10],
-            8,
-            vec![true, true, false, true, true, true, true, false, true, true]
-        );
+        test_array_scalar_op!(crate::cmp::neq, "neq", Int64Array);
     }
 
     #[test]
     fn test_boolean_array_eq() {
-        let a: BooleanArray =
-            vec![Some(true), Some(false), Some(false), Some(true), Some(true), 
None]
-                .into();
-        let b: BooleanArray =
-            vec![Some(true), Some(true), Some(false), Some(false), None, 
Some(false)]
-                .into();
-
-        let res: Vec<Option<bool>> = eq_bool(&a, &b).unwrap().iter().collect();
-
-        assert_eq!(
-            res,
-            vec![Some(true), Some(false), Some(true), Some(false), None, None]
-        )
+        test_boolean_array_array_op!(crate::cmp::eq, "eq")
     }
 
     #[test]
     fn test_boolean_array_neq() {
-        let a: BooleanArray =
-            vec![Some(true), Some(false), Some(false), Some(true), Some(true), 
None]
-                .into();
-        let b: BooleanArray =
-            vec![Some(true), Some(true), Some(false), Some(false), None, 
Some(false)]
-                .into();
-
-        let res: Vec<Option<bool>> = neq_bool(&a, 
&b).unwrap().iter().collect();
-
-        assert_eq!(
-            res,
-            vec![Some(false), Some(true), Some(false), Some(true), None, None]
-        )
+        test_boolean_array_array_op!(crate::cmp::neq, "neq")
     }
 
     #[test]
     fn test_boolean_array_lt() {
-        let a: BooleanArray =
-            vec![Some(true), Some(false), Some(false), Some(true), Some(true), 
None]
-                .into();
-        let b: BooleanArray =
-            vec![Some(true), Some(true), Some(false), Some(false), None, 
Some(false)]
-                .into();
-
-        let res: Vec<Option<bool>> = lt_bool(&a, &b).unwrap().iter().collect();
-
-        assert_eq!(
-            res,
-            vec![Some(false), Some(true), Some(false), Some(false), None, None]
-        )
+        test_boolean_array_array_op!(crate::cmp::lt, "lt")

Review Comment:
   I think it would be much easier to follow this if it simply was something 
like
   
   
   
   ```
   let a = BooleanArray::from(vec![...]);
   let b = BooleanArray::from(vec![...]);
   let expected = BooleanArray::from(vec![...]);
   assert_eq(lt(&a, &b).unwrap(), expected);
   ```



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