pub fn div_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 division is done using the numbers without scale.
        // The dividend is scaled up to maintain precision after the
        // division

        //   222.222 -->  222222000
        //   123.456 -->     123456
        // --------       ---------
        //     1.800 <--       1800
        let numeral: i128 = a * scale;

        // The division can overflow if the dividend is divided
        // by zero.
        let res: i128 = numeral.checked_div(rhs).expect("Found division by zero");

        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 div_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 division is done using the numbers without scale.
        // The dividend is scaled up to maintain precision after the
        // division
        //   222.222 -->  222222000
        //   123.456 -->     123456
        // --------       ---------
        //     1.800 <--       1800
        let numeral: i128 = a * scale;
        // The division can overflow if the dividend is divided
        // by zero.
        let res: i128 = numeral.checked_div(rhs).expect("Found division by zero");
        assert!(
            res.abs() <= max,
            "Overflow in multiplication presented for precision {}",
            precision
        );
        res
    };
    unary(lhs, op, lhs.data_type().clone())
}
pub fn div_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 division is done using the numbers without scale. // The dividend is scaled up to maintain precision after the // division //   222.222 -->  222222000 //   123.456 -->     123456 // --------       --------- //     1.800 <--       1800 let numeral : i128 = a * scale ; // The division can overflow if the dividend is divided // by zero. let res : i128 = numeral . checked_div ( rhs ) . expect ( " " ) ; 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>