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

Overflowing addition of a scalar T to a primitive array of type T. If the result from the sum is larger 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_add_scalar;
use arrow2::array::PrimitiveArray;

let a = PrimitiveArray::from([Some(1i8), Some(100i8)]);
let (result, overflow) = overflowing_add_scalar(&a, &100i8);
let expected = PrimitiveArray::from([Some(101i8), Some(-56i8)]);
assert_eq!(result, expected);