pub fn mul(
lhs: &PrimitiveArray<i128>,
rhs: &PrimitiveArray<i128>
) -> PrimitiveArray<i128>
Expand description
Multiply two decimal primitive arrays with the same precision and scale. If the precision and scale is different, then an InvalidArgumentError is returned. This function panics if the multiplied numbers result in a number larger than the possible number for the selected precision.
Examples
use arrow2::compute::arithmetics::decimal::mul;
use arrow2::array::PrimitiveArray;
use arrow2::datatypes::DataType;
let a = PrimitiveArray::from([Some(1_00i128), Some(1_00i128), None, Some(2_00i128)]).to(DataType::Decimal(5, 2));
let b = PrimitiveArray::from([Some(1_00i128), Some(2_00i128), None, Some(2_00i128)]).to(DataType::Decimal(5, 2));
let result = mul(&a, &b);
let expected = PrimitiveArray::from([Some(1_00i128), Some(2_00i128), None, Some(4_00i128)]).to(DataType::Decimal(5, 2));
assert_eq!(result, expected);