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

Checked multiplication of two primitive arrays. If the result from the multiplications overflows, the validity for that index is changed returned.

Examples

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

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