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/11/06 21:20:59 UTC

[GitHub] [arrow-rs] viirya commented on a diff in pull request #3034: Fix nullif when existing array has no nulls

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


##########
arrow/src/compute/kernels/boolean.rs:
##########
@@ -522,11 +522,19 @@ pub fn nullif(left: &dyn Array, right: &BooleanArray) -> Result<ArrayRef> {
                 t
             })
         }
-        None => bitwise_unary_op_helper(&right, right_offset, len, |b| {
-            let t = !b;
-            valid_count += t.count_ones() as usize;
-            t
-        }),
+        None => {
+            let buffer = bitwise_unary_op_helper(&right, right_offset, len, |b| {
+                let t = !b;
+                valid_count += t.count_ones() as usize;
+                t
+            });
+            // We need to compensate for the additional bits read from the end
+            let remainder_len = len % 64;
+            if remainder_len != 0 {
+                valid_count -= 64 - remainder_len
+            }
+            buffer

Review Comment:
   Should we also compensate valid_count for left_data.null_buffer() is Some case?



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