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

Checked subtraction of a scalar T to a primitive array of type T. If the result from the subtraction overflows, then the validity for that index is changed to None

Examples

use arrow2::compute::arithmetics::basic::checked_sub_scalar;
use arrow2::array::Int8Array;

let a = Int8Array::from(&[None, Some(-100), None, Some(-100)]);
let result = checked_sub_scalar(&a, &100i8);
let expected = Int8Array::from(&[None, None, None, None]);
assert_eq!(result, expected);