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/12/17 00:48:05 UTC

[GitHub] [arrow] Dandandan commented on a change in pull request #8946: ARROW-10944: [Rust] Implement min/max aggregate kernels for BooleanArray

Dandandan commented on a change in pull request #8946:
URL: https://github.com/apache/arrow/pull/8946#discussion_r544728199



##########
File path: rust/arrow/src/compute/kernels/aggregate.rs
##########
@@ -135,6 +137,40 @@ where
     Some(n)
 }
 
+/// Helper function to perform min/max lambda function on values from a `BooleanArray`
+fn min_max_boolean<F>(array: &BooleanArray, cmp: F) -> Option<bool>
+where
+    F: Fn(bool, bool) -> bool,
+{
+    let null_count = array.null_count();
+
+    // Includes case array.len() == 0
+    if null_count == array.len() {
+        return None;
+    }
+
+    let m0: Option<bool> = array.iter().next().unwrap();
+
+    array.iter().fold(m0, |max, item| match (max, item) {

Review comment:
       Would it make sense to return early here when seeing the highest or lowest value? 




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