pub fn mul_scalar(lhs: &PrimitiveArray<i128>, rhs: &PrimitiveScalar<i128>) -> PrimitiveArray<i128> {
    let (precision, scale) = get_parameters(lhs.data_type(), rhs.data_type()).unwrap();

    let rhs = if let Some(rhs) = rhs.value() {
        rhs
    } else {
        return PrimitiveArray::<i128>::new_null(lhs.data_type().clone(), lhs.len());
    };

    let scale = 10i128.pow(scale as u32);
    let max = max_value(precision);

    let op = move |a: i128| {
        // The multiplication between i128 can overflow if they are
        // very large numbers. For that reason a checked
        // multiplication is used.
        let res: i128 = a
            .checked_mul(rhs)
            .expect("Mayor overflow for multiplication");

        // The multiplication is done using the numbers without scale.
        // The resulting scale of the value has to be corrected by
        // dividing by (10^scale)

        //   111.111 -->      111111
        //   222.222 -->      222222
        // --------          -------
        // 24691.308 <-- 24691308642
        let res = res / scale;

        assert!(
            res.abs() <= max,
            "Overflow in multiplication presented for precision {}",
            precision
        );

        res
    };

    unary(lhs, op, lhs.data_type().clone())
}
/// Multiply a decimal [`PrimitiveArray`] with a [`PrimitiveScalar`] 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.
Multiply a decimal [`PrimitiveArray`] with a [`PrimitiveScalar`] 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.
Multiply a decimal [ ` PrimitiveArray ` ] with a [ ` PrimitiveScalar ` ] 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 .
pub fn mul_scalar(lhs: &PrimitiveArray<i128>, rhs: &PrimitiveScalar<i128>) -> PrimitiveArray<i128> {
    let (precision, scale) = get_parameters(lhs.data_type(), rhs.data_type()).unwrap();
    let rhs = if let Some(rhs) = rhs.value() {
        rhs
    } else {
        return PrimitiveArray::<i128>::new_null(lhs.data_type().clone(), lhs.len());
    };
    let scale = 10i128.pow(scale as u32);
    let max = max_value(precision);
    let op = move |a: i128| {
        // The multiplication between i128 can overflow if they are
        // very large numbers. For that reason a checked
        // multiplication is used.
        let res: i128 = a
            .checked_mul(rhs)
            .expect("Mayor overflow for multiplication");
        // The multiplication is done using the numbers without scale.
        // The resulting scale of the value has to be corrected by
        // dividing by (10^scale)
        //   111.111 -->      111111
        //   222.222 -->      222222
        // --------          -------
        // 24691.308 <-- 24691308642
        let res = res / scale;
        assert!(
            res.abs() <= max,
            "Overflow in multiplication presented for precision {}",
            precision
        );
        res
    };
    unary(lhs, op, lhs.data_type().clone())
}
pub fn mul_scalar ( lhs : & PrimitiveArray < i128 > , rhs : & PrimitiveScalar < i128 > ) -> PrimitiveArray < i128 > { let ( precision , scale ) = get_parameters ( lhs . data_type ( ) , rhs . data_type ( ) ) . unwrap ( ) ; let rhs = if let Some ( rhs ) = rhs . value ( ) { rhs } else { return PrimitiveArray :: < i128 > :: new_null ( lhs . data_type ( ) . clone ( ) , lhs . len ( ) ) ; } ; let scale = 10i128 . pow ( scale as u32 ) ; let max = max_value ( precision ) ; let op = move | a : i128 | { // The multiplication between i128 can overflow if they are // very large numbers. For that reason a checked // multiplication is used. let res : i128 = a . checked_mul ( rhs ) . expect ( " " ) ; // The multiplication is done using the numbers without scale. // The resulting scale of the value has to be corrected by // dividing by (10^scale) //   111.111 -->      111111 //   222.222 -->      222222 // --------          ------- // 24691.308 <-- 24691308642 let res = res / scale ; assert ! ( res abs ( ) max " " precision ) ; res } ; unary ( lhs , op , lhs . data_type ( ) . clone ( ) ) }
Multiply a decimal [`PrimitiveArray`] with a [`PrimitiveScalar`] with the same precision and scale.
Multiply a decimal [ ` PrimitiveArray ` ] with a [ ` PrimitiveScalar ` ] with the same precision and scale .
lhs
&PrimitiveArray<i128>
rhs
&PrimitiveScalar<i128>
lhs
&PrimitiveArray<i128>
rhs
&PrimitiveScalar<i128>