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

Overflowing subtraction of a scalar T to a primitive array of type T. If the result from the sub is smaller than the possible number for this type, then the result will be an array with overflowed values and a validity array indicating the overflowing elements from the array

Examples

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

let a = Int8Array::from(&[Some(1i8), Some(-100i8)]);
let (result, overflow) = overflowing_sub_scalar(&a, &100i8);
let expected = Int8Array::from(&[Some(-99i8), Some(56i8)]);
assert_eq!(result, expected);