Helper function to implement binary kernels
(
left: &BooleanArray,
right: &BooleanArray,
op: F,
)
| 222 | |
| 223 | /// Helper function to implement binary kernels |
| 224 | pub(crate) fn binary_boolean_kernel<F>( |
| 225 | left: &BooleanArray, |
| 226 | right: &BooleanArray, |
| 227 | op: F, |
| 228 | ) -> Result<BooleanArray, ArrowError> |
| 229 | where |
| 230 | F: Fn(&BooleanBuffer, &BooleanBuffer) -> BooleanBuffer, |
| 231 | { |
| 232 | if left.len() != right.len() { |
| 233 | return Err(ArrowError::ComputeError( |
| 234 | "Cannot perform bitwise operation on arrays of different length".to_string(), |
| 235 | )); |
| 236 | } |
| 237 | |
| 238 | let nulls = NullBuffer::union(left.nulls(), right.nulls()); |
| 239 | let values = op(left.values(), right.values()); |
| 240 | Ok(BooleanArray::new(values, nulls)) |
| 241 | } |
| 242 | |
| 243 | /// Performs `AND` operation on two arrays. If either left or right value is null then the |
| 244 | /// result is also null. |