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