pub fn decimal_to_integer<T>(from: &PrimitiveArray<i128>) -> PrimitiveArray<T>
where
    T: NativeType + NumCast,
{
    let (_, from_scale) = if let DataType::Decimal(p, s) = from.data_type().to_logical_type() {
        (*p, *s)
    } else {
        panic!("internal error: i128 is always a decimal")
    };

    let factor = 10_i128.pow(from_scale as u32);
    let values = from.iter().map(|x| x.and_then(|x| T::from(*x / factor)));

    PrimitiveArray::from_trusted_len_iter(values)
}
/// Returns a [`PrimitiveArray<i128>`] with the casted values. Values are `None` on overflow
Returns a [`PrimitiveArray`] with the casted values. Values are `None` on overflow
Returns a [ ` PrimitiveArray ` ] with the casted values . Values are ` None ` on overflow
pub fn decimal_to_integer<T>(from: &PrimitiveArray<i128>) -> PrimitiveArray<T>
where
    T: NativeType + NumCast,
{
    let (_, from_scale) = if let DataType::Decimal(p, s) = from.data_type().to_logical_type() {
        (*p, *s)
    } else {
        panic!("internal error: i128 is always a decimal")
    };
    let factor = 10_i128.pow(from_scale as u32);
    let values = from.iter().map(|x| x.and_then(|x| T::from(*x / factor)));
    PrimitiveArray::from_trusted_len_iter(values)
}
pub fn decimal_to_integer < T > ( from : & PrimitiveArray < i128 > ) -> PrimitiveArray < T > where T : NativeType + NumCast , { let ( _ , from_scale ) = if let DataType :: Decimal ( p , s ) = from . data_type ( ) . to_logical_type ( ) { ( * p , * s ) } else { panic ! ( " " ) } ; let factor = 10_i128 . pow ( from_scale as u32 ) ; let values = from . iter ( ) . map ( | x | x . and_then ( | x | T :: from ( * x / factor ) ) ) ; PrimitiveArray :: from_trusted_len_iter ( values ) }
Returns a [`PrimitiveArray<i128>`] with the casted values.
Returns a [ ` PrimitiveArray<i128 > ` ] with the casted values .
from
&PrimitiveArray<i128>
from
&PrimitiveArray<i128>