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/10/27 21:02:09 UTC

[GitHub] [arrow-rs] tustvold commented on a diff in pull request #2957: Add BooleanArray::true_count and BooleanArray::false_count

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


##########
arrow-array/src/array/boolean_array.rs:
##########
@@ -103,6 +103,53 @@ impl BooleanArray {
         &self.data.buffers()[0]
     }
 
+    /// Returns the number of true values within this buffer
+    pub fn true_count(&self) -> usize {
+        match self.data.null_buffer() {
+            Some(nulls) => {
+                let null_chunks = nulls.bit_chunks(self.offset(), self.len());

Review Comment:
   The duplication is a bit annoying, but any attempt I made to eliminate it just resulted in more code



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