Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Nullif with incorrect valid_count #3031

Closed
YjyJeff opened this issue Nov 6, 2022 · 1 comment · Fixed by #3034
Closed

Nullif with incorrect valid_count #3031

YjyJeff opened this issue Nov 6, 2022 · 1 comment · Fixed by #3034
Labels
arrow Changes to the arrow crate bug

Comments

@YjyJeff
Copy link

YjyJeff commented Nov 6, 2022

Describe the bug
The nullif function in compute/kernels/boolean.rs has incorrect valid_count when the left's null_buffer is None.

To Reproduce

let a = Int32Array::from(vec![Some(15), Some(7), Some(8), Some(1), Some(9)]);
let comp = BooleanArray::from(vec![Some(false), None, Some(true), Some(false), None]);
let res = nullif(&a, &comp).unwrap(); // panic here

Why it happens
bitwise_unary_op_helper will apply the op to the remainder bytes, the problem happens here. valid_count will take the ones that should be ignored into consideration.

Solution

let left = Bitmap::new(len);
bitwise_bin_op_helper(left.buffer(), 0, &right, right_offset, len, |l, r| {
    let t = l & !r;
    valid_count += t.count_ones() as usize;
    t
})
@YjyJeff YjyJeff added the bug label Nov 6, 2022
@alamb alamb added the arrow Changes to the arrow crate label Nov 11, 2022
@alamb
Copy link
Contributor

alamb commented Nov 11, 2022

label_issue.py automatically added labels {'arrow'} from #3034

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
arrow Changes to the arrow crate bug
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants