MCPcopy Create free account
hub / github.com/apache/arrow-rs / binary_boolean_kernel

Function binary_boolean_kernel

arrow-arith/src/boolean.rs:224–241  ·  view source on GitHub ↗

Helper function to implement binary kernels

(
    left: &BooleanArray,
    right: &BooleanArray,
    op: F,
)

Source from the content-addressed store, hash-verified

222
223/// Helper function to implement binary kernels
224pub(crate) fn binary_boolean_kernel<F>(
225 left: &BooleanArray,
226 right: &BooleanArray,
227 op: F,
228) -> Result<BooleanArray, ArrowError>
229where
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.

Callers 3

andFunction · 0.85
orFunction · 0.85
and_notFunction · 0.85

Calls 3

lenMethod · 0.45
nullsMethod · 0.45
valuesMethod · 0.45

Tested by

no test coverage detected