Skip to content

Commit

Permalink
Fix bitmask creation in chunked part of simd comparison (#1286)
Browse files Browse the repository at this point in the history
  • Loading branch information
jhorstmann committed Feb 7, 2022
1 parent 3e7b6c4 commit 936ed5e
Showing 1 changed file with 15 additions and 1 deletion.
16 changes: 15 additions & 1 deletion arrow/src/compute/kernels/comparison.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1708,7 +1708,7 @@ where
let simd_result = simd_op(simd_left, simd_right);

let m = T::mask_to_u64(&simd_result);
bitmask |= m << (i / lanes);
bitmask |= m << i;

i += lanes;
}
Expand Down Expand Up @@ -2442,6 +2442,20 @@ mod tests {
let b = b.slice(0, b.len());
let c = $DYN_KERNEL(a.as_ref(), b.as_ref()).unwrap();
assert_eq!(BooleanArray::from($EXPECTED), c);

// test with a larger version of the same data to ensure we cover the chunked part of the comparison
let mut a = vec![];
let mut b = vec![];
let mut e = vec![];
for _i in 0..10 {
a.extend($A_VEC);
b.extend($B_VEC);
e.extend($EXPECTED);
}
let a = $ARRAY::from(a);
let b = $ARRAY::from(b);
let c = $KERNEL(&a, &b).unwrap();
assert_eq!(BooleanArray::from(e), c);
};
}

Expand Down

0 comments on commit 936ed5e

Please sign in to comment.