Function arrow2::compute::arithmetics::basic::sub_scalar
source · [−]pub fn sub_scalar<T>(lhs: &PrimitiveArray<T>, rhs: &T) -> PrimitiveArray<T> where
T: NativeArithmetics + Sub<Output = T>,
Expand description
Subtract a scalar T to a primitive array of type T. Panics if the subtraction of the values overflows.
Examples
use arrow2::compute::arithmetics::basic::sub_scalar;
use arrow2::array::Int32Array;
let a = Int32Array::from(&[None, Some(6), None, Some(6)]);
let result = sub_scalar(&a, &1i32);
let expected = Int32Array::from(&[None, Some(5), None, Some(5)]);
assert_eq!(result, expected)