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/18 06:39:47 UTC

[GitHub] [arrow] jorgecarleitao opened a new pull request #8700: ARROW-10638: [Rust] Improved tests of boolean kernel.

jorgecarleitao opened a new pull request #8700:
URL: https://github.com/apache/arrow/pull/8700


   * made some tests be exhaustive
   * made most tests use the array equality, that covers more areas (null count, data type, etc.)
   


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



[GitHub] [arrow] github-actions[bot] commented on pull request #8700: ARROW-10638: [Rust] Improved tests of boolean kernel.

Posted by GitBox <gi...@apache.org>.
github-actions[bot] commented on pull request #8700:
URL: https://github.com/apache/arrow/pull/8700#issuecomment-729470754


   https://issues.apache.org/jira/browse/ARROW-10638


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



[GitHub] [arrow] jorgecarleitao commented on a change in pull request #8700: ARROW-10638: [Rust] Improved tests of boolean kernel.

Posted by GitBox <gi...@apache.org>.
jorgecarleitao commented on a change in pull request #8700:
URL: https://github.com/apache/arrow/pull/8700#discussion_r525849824



##########
File path: rust/arrow/src/compute/kernels/boolean.rs
##########
@@ -159,53 +159,113 @@ mod tests {
         let a = BooleanArray::from(vec![false, false, true, true]);
         let b = BooleanArray::from(vec![false, true, false, true]);
         let c = and(&a, &b).unwrap();
-        assert_eq!(false, c.value(0));
-        assert_eq!(false, c.value(1));
-        assert_eq!(false, c.value(2));
-        assert_eq!(true, c.value(3));
+
+        let expected = BooleanArray::from(vec![false, false, false, true]);
+
+        assert_eq!(c, expected);
     }
 
     #[test]
     fn test_bool_array_or() {
         let a = BooleanArray::from(vec![false, false, true, true]);
         let b = BooleanArray::from(vec![false, true, false, true]);
         let c = or(&a, &b).unwrap();
-        assert_eq!(false, c.value(0));
-        assert_eq!(true, c.value(1));
-        assert_eq!(true, c.value(2));
-        assert_eq!(true, c.value(3));
+
+        let expected = BooleanArray::from(vec![false, true, true, true]);
+
+        assert_eq!(c, expected);
     }
 
     #[test]
     fn test_bool_array_or_nulls() {
-        let a = BooleanArray::from(vec![None, Some(false), None, Some(false)]);
-        let b = BooleanArray::from(vec![None, None, Some(false), Some(false)]);
+        let a = BooleanArray::from(vec![
+            None,
+            None,
+            None,
+            Some(false),
+            Some(false),
+            Some(false),
+            Some(true),
+            Some(true),
+            Some(true),
+        ]);
+        let b = BooleanArray::from(vec![
+            None,
+            Some(false),
+            Some(true),
+            None,
+            Some(false),
+            Some(true),
+            None,
+            Some(false),
+            Some(true),
+        ]);
         let c = or(&a, &b).unwrap();
-        assert_eq!(true, c.is_null(0));
-        assert_eq!(true, c.is_null(1));
-        assert_eq!(true, c.is_null(2));
-        assert_eq!(false, c.is_null(3));
+
+        let expected = BooleanArray::from(vec![
+            None,
+            None,
+            None,
+            None,
+            Some(false),
+            Some(true),
+            None,
+            Some(true),
+            Some(true),
+        ]);
+
+        assert_eq!(c, expected);
     }
 
     #[test]
     fn test_bool_array_not() {
-        let a = BooleanArray::from(vec![false, false, true, true]);
+        let a = BooleanArray::from(vec![false, true]);
         let c = not(&a).unwrap();
-        assert_eq!(true, c.value(0));
-        assert_eq!(true, c.value(1));
-        assert_eq!(false, c.value(2));
-        assert_eq!(false, c.value(3));
+
+        let expected = BooleanArray::from(vec![true, false]);
+
+        assert_eq!(c, expected);
     }
 
     #[test]
     fn test_bool_array_and_nulls() {

Review comment:
       test expanded to cover all possible cases.




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



[GitHub] [arrow] jorgecarleitao commented on a change in pull request #8700: ARROW-10638: [Rust] Improved tests of boolean kernel.

Posted by GitBox <gi...@apache.org>.
jorgecarleitao commented on a change in pull request #8700:
URL: https://github.com/apache/arrow/pull/8700#discussion_r525849731



##########
File path: rust/arrow/src/compute/kernels/boolean.rs
##########
@@ -287,11 +344,36 @@ mod tests {
         let b = b.as_any().downcast_ref::<BooleanArray>().unwrap();
 
         let c = and(&a, &b).unwrap();
-        assert_eq!(4, c.len());
-        assert_eq!(false, c.value(0));
-        assert_eq!(false, c.value(1));
-        assert_eq!(false, c.value(2));
-        assert_eq!(true, c.value(3));
+
+        let expected = BooleanArray::from(vec![false, false, false, true]);
+
+        assert_eq!(expected, c);
+    }
+
+    #[test]
+    fn test_bool_array_and_nulls_offset() {

Review comment:
       This is a new test to verify slices with 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.

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



[GitHub] [arrow] nevi-me closed pull request #8700: ARROW-10638: [Rust] Improved tests of boolean kernel.

Posted by GitBox <gi...@apache.org>.
nevi-me closed pull request #8700:
URL: https://github.com/apache/arrow/pull/8700


   


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