Create a [`BooleanArray`] by evaluating the binary operation for each element of the provided arrays ``` # use arrow_array::{BooleanArray, Int32Array}; let a = Int32Array::from(vec![1, 2, 3, 4, 5]); let b = Int32Array::from(vec![1, 2, 0, 2, 5]); let r = BooleanArray::from_binary(&a, &b, |a, b| a == b); assert_eq!(&r, &BooleanArray::from(vec![true, true, false, false, true])); ``` # Panics This
(left: T, right: S, mut op: F)
| 300 | /// This function panics if left and right are not the same length |
| 301 | /// |
| 302 | pub fn from_binary<T: ArrayAccessor, S: ArrayAccessor, F>(left: T, right: S, mut op: F) -> Self |
| 303 | where |
| 304 | F: FnMut(T::Item, S::Item) -> bool, |
| 305 | { |
| 306 | assert_eq!(left.len(), right.len()); |
| 307 | |
| 308 | let nulls = NullBuffer::union( |
| 309 | left.logical_nulls().as_ref(), |
| 310 | right.logical_nulls().as_ref(), |
| 311 | ); |
| 312 | let values = BooleanBuffer::collect_bool(left.len(), |i| unsafe { |
| 313 | // SAFETY: i in range 0..len |
| 314 | op(left.value_unchecked(i), right.value_unchecked(i)) |
| 315 | }); |
| 316 | Self::new(values, nulls) |
| 317 | } |
| 318 | |
| 319 | /// Apply a bitwise operation to this array's values using u64 operations, |
| 320 | /// returning a new [`BooleanArray`]. |
nothing calls this directly
no test coverage detected