You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@arrow.apache.org by al...@apache.org on 2021/06/09 18:10:47 UTC
[arrow-rs] branch active_release updated: Fix bug with null buffer
offset in boolean not kernel (#418) (#434)
This is an automated email from the ASF dual-hosted git repository.
alamb pushed a commit to branch active_release
in repository https://gitbox.apache.org/repos/asf/arrow-rs.git
The following commit(s) were added to refs/heads/active_release by this push:
new e64c9eb Fix bug with null buffer offset in boolean not kernel (#418) (#434)
e64c9eb is described below
commit e64c9eb0eec3744655ce166146f3ee1930ff542e
Author: Andrew Lamb <an...@nerdnetworks.org>
AuthorDate: Wed Jun 9 14:10:42 2021 -0400
Fix bug with null buffer offset in boolean not kernel (#418) (#434)
Co-authored-by: Jörn Horstmann <gi...@jhorstmann.net>
---
arrow/src/compute/kernels/boolean.rs | 15 ++++++++++++++-
1 file changed, 14 insertions(+), 1 deletion(-)
diff --git a/arrow/src/compute/kernels/boolean.rs b/arrow/src/compute/kernels/boolean.rs
index e1d5592..c9c0bc3 100644
--- a/arrow/src/compute/kernels/boolean.rs
+++ b/arrow/src/compute/kernels/boolean.rs
@@ -376,7 +376,7 @@ pub fn not(left: &BooleanArray) -> Result<BooleanArray> {
let null_bit_buffer = data
.null_bitmap()
.as_ref()
- .map(|b| b.bits.slice(left_offset));
+ .map(|b| b.bits.bit_slice(left_offset, len));
let values = buffer_unary_not(&data.buffers()[0], left_offset, len);
@@ -814,6 +814,19 @@ mod tests {
}
#[test]
+ fn test_bool_array_not_sliced() {
+ let a = BooleanArray::from(vec![None, Some(true), Some(false), None, Some(true)]);
+ let a = a.slice(1, 4);
+ let a = a.as_any().downcast_ref::<BooleanArray>().unwrap();
+ let c = not(&a).unwrap();
+
+ let expected =
+ BooleanArray::from(vec![Some(false), Some(true), None, Some(false)]);
+
+ assert_eq!(c, expected);
+ }
+
+ #[test]
fn test_bool_array_and_nulls() {
let a = BooleanArray::from(vec![
None,