You are viewing a plain text version of this content. The canonical link for it is here.
Posted to jira@arrow.apache.org by "meng qingyou (Jira)" <ji...@apache.org> on 2021/01/07 08:59:00 UTC
[jira] [Created] (ARROW-11160) [Rust] pitfall in xxx_equal
functions
meng qingyou created ARROW-11160:
------------------------------------
Summary: [Rust] pitfall in xxx_equal functions
Key: ARROW-11160
URL: https://issues.apache.org/jira/browse/ARROW-11160
Project: Apache Arrow
Issue Type: Improvement
Reporter: meng qingyou
Functions `pub(super) fn xxxx_equal` in rust/src/array/equal/ MUST fail if called directly instead of from `equal`. boolean.rs as example:
```
lhs_is_null
|| (lhs_is_null == rhs_is_null)
&& equal_bits(...)
```
The bug is not seen in tests at present because `equal` shortcuts the condition: zero null s v.s. nulls
To verify this problem , adds a new test in `mod.rs`:
```
#[test]
fntest_boolean_equal_bug() {
leta=BooleanArray::from(vec![None]).data();
letb=BooleanArray::from(vec![Some(false)]).data();
letlhs=a.as_ref();
letrhs=b.as_ref();
letlhs_nulls=lhs.null_buffer();
letrhs_nulls=rhs.null_buffer();
assert_eq!(boolean::boolean_equal(lhs, rhs, lhs_nulls, rhs_nulls, 0, 0, lhs.len()), false);
}
```
--
This message was sent by Atlassian Jira
(v8.3.4#803005)