Function arrow::compute::kernels::arity::binary_mut

source ·
pub fn binary_mut<T, F>(
    a: PrimitiveArray<T>,
    b: &PrimitiveArray<T>,
    op: F,
) -> Result<Result<PrimitiveArray<T>, ArrowError>, PrimitiveArray<T>>
Expand description

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

Mutable primitive array means that the buffer is not shared with other arrays. As a result, this mutates the buffer directly without allocating new buffer.

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. This function gives error of original PrimitiveArray a if it is not a mutable primitive array.