You are viewing a plain text version of this content. The canonical link for it is here.
Posted to github@arrow.apache.org by "viirya (via GitHub)" <gi...@apache.org> on 2023/01/23 20:38:57 UTC

[GitHub] [arrow-rs] viirya commented on a diff in pull request #3590: Fix nullif null count (#3579)

viirya commented on code in PR #3590:
URL: https://github.com/apache/arrow-rs/pull/3590#discussion_r1084521625


##########
arrow-select/src/nullif.rs:
##########
@@ -68,43 +68,41 @@ pub fn nullif(left: &dyn Array, right: &BooleanArray) -> Result<ArrayRef, ArrowE
     };
 
     // Compute left null bitmap & !right
-    let mut valid_count = 0;
-    let combined = match left_data.null_buffer() {
+
+    let (combined, null_count) = match left_data.null_buffer() {
         Some(left) => {
-            bitwise_bin_op_helper(left, left_offset, &right, right_offset, len, |l, r| {
-                let t = l & !r;
-                valid_count += t.count_ones() as usize;
-                t
-            })
+            let mut valid_count = 0;
+            let b =
+                bitwise_bin_op_helper(left, l_offset, &right, r_offset, len, |l, r| {
+                    let t = l & !r;
+                    valid_count += t.count_ones() as usize;
+                    t
+                });
+            (b, len - valid_count)
         }
         None => {
-            let buffer = bitwise_unary_op_helper(&right, right_offset, len, |b| {
+            let mut null_count = 0;
+            let buffer = bitwise_unary_op_helper(&right, r_offset, len, |b| {
                 let t = !b;
-                valid_count += t.count_ones() as usize;
+                null_count += t.count_zeros() as usize;

Review Comment:
   Don't need to compensate remainder bits?



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