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 2022/05/24 22:47:01 UTC

[GitHub] [arrow-rs] HaoYang670 commented on a diff in pull request #1725: support `min_max_binary`

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: github-unsubscribe@arrow.apache.org

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