HaoYang670 commented on code in PR #1725:
URL: https://github.com/apache/arrow-rs/pull/1725#discussion_r881036282


##########
arrow/src/compute/kernels/aggregate.rs:
##########
@@ -885,11 +893,45 @@ mod tests {
         assert!(max(&a).unwrap().is_nan());
     }
 
+    #[test]
+    fn test_binary_min_max_with_nulls() {
+        let a = BinaryArray::from(vec![
+            Some("b".as_bytes()),
+            None,
+            None,
+            Some(b"a"),
+            Some(b"c"),
+        ]);
+        assert_eq!(Some("a".as_bytes()), min_binary(&a));
+        assert_eq!(Some("c".as_bytes()), max_binary(&a));
+    }
+
+    #[test]
+    fn test_binary_min_max_no_null() {
+        let a = BinaryArray::from(vec![Some("b".as_bytes()), Some(b"a"), 
Some(b"c")]);
+        assert_eq!(Some("a".as_bytes()), min_binary(&a));
+        assert_eq!(Some("c".as_bytes()), max_binary(&a));
+    }
+
+    #[test]
+    fn test_binary_min_max_all_nulls() {
+        let a = BinaryArray::from(vec![None, None]);
+        assert_eq!(None, min_binary(&a));
+        assert_eq!(None, max_binary(&a));
+    }
+
+    #[test]
+    fn test_binary_min_max_1() {

Review Comment:
   We have a similar test for string:
   
https://github.com/apache/arrow-rs/blob/master/arrow/src/compute/kernels/aggregate.rs#L902-L907
   
   Actually, I don't know why it is named `_1`, just copy from it.



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