Function arrow_arith::arity::binary

source ·
pub fn binary<A, B, F, O>(
    a: &PrimitiveArray<A>,
    b: &PrimitiveArray<B>,
    op: F,
) -> Result<PrimitiveArray<O>, ArrowError>
Expand description

Given two arrays of length len, calls op(a[i], b[i]) for i in 0..len, collecting the results in a PrimitiveArray. If any index is null in either a or b, the corresponding index in the result will also be null

Like unary the provided function is evaluated for every index, ignoring validity. This is beneficial when the cost of the operation is low compared to the cost of branching, and especially when the operation can be vectorised, however, requires op to be infallible for all possible values of its inputs

§Error

This function gives error if the arrays have different lengths