pub fn add<T>(
    lhs: &PrimitiveArray<T>,
    rhs: &PrimitiveArray<T>
) -> PrimitiveArray<T> where
    T: NativeArithmetics + Add<Output = T>, 
Available on crate feature compute_arithmetics only.
Expand description

Adds two primitive arrays with the same type. Panics if the sum of one pair of values overflows.

Examples

use arrow2::compute::arithmetics::basic::add;
use arrow2::array::PrimitiveArray;

let a = PrimitiveArray::from([None, Some(6), None, Some(6)]);
let b = PrimitiveArray::from([Some(5), None, None, Some(6)]);
let result = add(&a, &b);
let expected = PrimitiveArray::from([None, None, None, Some(12)]);
assert_eq!(result, expected)