@@ -27,7 +27,7 @@ use arrow::{
2727        IntervalMonthDayNanoType ,  IntervalUnit ,  IntervalYearMonthType ,  TimeUnit , 
2828        TimestampMicrosecondType ,  TimestampMillisecondType ,  TimestampNanosecondType , 
2929        TimestampSecondType ,  UInt16Type ,  UInt32Type ,  UInt64Type ,  UInt8Type , 
30-         DECIMAL_MAX_PRECISION , 
30+         DECIMAL128_MAX_PRECISION , 
3131    } , 
3232    util:: decimal:: { BasicDecimal ,  Decimal128 } , 
3333} ; 
@@ -611,7 +611,7 @@ impl ScalarValue {
611611        scale :  usize , 
612612    )  -> Result < Self >  { 
613613        // make sure the precision and scale is valid 
614-         if  precision <= DECIMAL_MAX_PRECISION  && scale <= precision { 
614+         if  precision <= DECIMAL128_MAX_PRECISION  && scale <= precision { 
615615            return  Ok ( ScalarValue :: Decimal128 ( Some ( value) ,  precision,  scale) ) ; 
616616        } 
617617        Err ( DataFusionError :: Internal ( format ! ( 
@@ -654,7 +654,7 @@ impl ScalarValue {
654654            ScalarValue :: Int32 ( _)  => DataType :: Int32 , 
655655            ScalarValue :: Int64 ( _)  => DataType :: Int64 , 
656656            ScalarValue :: Decimal128 ( _,  precision,  scale)  => { 
657-                 DataType :: Decimal ( * precision,  * scale) 
657+                 DataType :: Decimal128 ( * precision,  * scale) 
658658            } 
659659            ScalarValue :: TimestampSecond ( _,  tz_opt)  => { 
660660                DataType :: Timestamp ( TimeUnit :: Second ,  tz_opt. clone ( ) ) 
@@ -935,7 +935,7 @@ impl ScalarValue {
935935        } 
936936
937937        let  array:  ArrayRef  = match  & data_type { 
938-             DataType :: Decimal ( precision,  scale)  => { 
938+             DataType :: Decimal128 ( precision,  scale)  => { 
939939                let  decimal_array =
940940                    ScalarValue :: iter_to_decimal_array ( scalars,  precision,  scale) ?; 
941941                Arc :: new ( decimal_array) 
@@ -1448,7 +1448,7 @@ impl ScalarValue {
14481448
14491449        Ok ( match  array. data_type ( )  { 
14501450            DataType :: Null  => ScalarValue :: Null , 
1451-             DataType :: Decimal ( precision,  scale)  => { 
1451+             DataType :: Decimal128 ( precision,  scale)  => { 
14521452                ScalarValue :: get_decimal_value_from_array ( array,  index,  precision,  scale) 
14531453            } 
14541454            DataType :: Boolean  => typed_cast ! ( array,  index,  BooleanArray ,  Boolean ) , 
@@ -1899,7 +1899,7 @@ impl TryFrom<&DataType> for ScalarValue {
18991899            DataType :: UInt16  => ScalarValue :: UInt16 ( None ) , 
19001900            DataType :: UInt32  => ScalarValue :: UInt32 ( None ) , 
19011901            DataType :: UInt64  => ScalarValue :: UInt64 ( None ) , 
1902-             DataType :: Decimal ( precision,  scale)  => { 
1902+             DataType :: Decimal128 ( precision,  scale)  => { 
19031903                ScalarValue :: Decimal128 ( None ,  * precision,  * scale) 
19041904            } 
19051905            DataType :: Utf8  => ScalarValue :: Utf8 ( None ) , 
@@ -2145,7 +2145,7 @@ mod tests {
21452145    #[ test]  
21462146    fn  scalar_decimal_test ( )  { 
21472147        let  decimal_value = ScalarValue :: Decimal128 ( Some ( 123 ) ,  10 ,  1 ) ; 
2148-         assert_eq ! ( DataType :: Decimal ( 10 ,  1 ) ,  decimal_value. get_datatype( ) ) ; 
2148+         assert_eq ! ( DataType :: Decimal128 ( 10 ,  1 ) ,  decimal_value. get_datatype( ) ) ; 
21492149        let  try_into_value:  i128  = decimal_value. clone ( ) . try_into ( ) . unwrap ( ) ; 
21502150        assert_eq ! ( 123_i128 ,  try_into_value) ; 
21512151        assert ! ( !decimal_value. is_null( ) ) ; 
@@ -2163,14 +2163,14 @@ mod tests {
21632163        let  array = decimal_value. to_array ( ) ; 
21642164        let  array = array. as_any ( ) . downcast_ref :: < Decimal128Array > ( ) . unwrap ( ) ; 
21652165        assert_eq ! ( 1 ,  array. len( ) ) ; 
2166-         assert_eq ! ( DataType :: Decimal ( 10 ,  1 ) ,  array. data_type( ) . clone( ) ) ; 
2166+         assert_eq ! ( DataType :: Decimal128 ( 10 ,  1 ) ,  array. data_type( ) . clone( ) ) ; 
21672167        assert_eq ! ( 123i128 ,  array. value( 0 ) . as_i128( ) ) ; 
21682168
21692169        // decimal scalar to array with size 
21702170        let  array = decimal_value. to_array_of_size ( 10 ) ; 
21712171        let  array_decimal = array. as_any ( ) . downcast_ref :: < Decimal128Array > ( ) . unwrap ( ) ; 
21722172        assert_eq ! ( 10 ,  array. len( ) ) ; 
2173-         assert_eq ! ( DataType :: Decimal ( 10 ,  1 ) ,  array. data_type( ) . clone( ) ) ; 
2173+         assert_eq ! ( DataType :: Decimal128 ( 10 ,  1 ) ,  array. data_type( ) . clone( ) ) ; 
21742174        assert_eq ! ( 123i128 ,  array_decimal. value( 0 ) . as_i128( ) ) ; 
21752175        assert_eq ! ( 123i128 ,  array_decimal. value( 9 ) . as_i128( ) ) ; 
21762176        // test eq array 
@@ -2208,7 +2208,7 @@ mod tests {
22082208        // convert the vec to decimal array and check the result 
22092209        let  array = ScalarValue :: iter_to_array ( decimal_vec. into_iter ( ) ) . unwrap ( ) ; 
22102210        assert_eq ! ( 3 ,  array. len( ) ) ; 
2211-         assert_eq ! ( DataType :: Decimal ( 10 ,  2 ) ,  array. data_type( ) . clone( ) ) ; 
2211+         assert_eq ! ( DataType :: Decimal128 ( 10 ,  2 ) ,  array. data_type( ) . clone( ) ) ; 
22122212
22132213        let  decimal_vec = vec ! [ 
22142214            ScalarValue :: Decimal128 ( Some ( 1 ) ,  10 ,  2 ) , 
@@ -2218,7 +2218,7 @@ mod tests {
22182218        ] ; 
22192219        let  array = ScalarValue :: iter_to_array ( decimal_vec. into_iter ( ) ) . unwrap ( ) ; 
22202220        assert_eq ! ( 4 ,  array. len( ) ) ; 
2221-         assert_eq ! ( DataType :: Decimal ( 10 ,  2 ) ,  array. data_type( ) . clone( ) ) ; 
2221+         assert_eq ! ( DataType :: Decimal128 ( 10 ,  2 ) ,  array. data_type( ) . clone( ) ) ; 
22222222
22232223        assert ! ( ScalarValue :: try_new_decimal128( 1 ,  10 ,  2 ) 
22242224            . unwrap( ) 
0 commit comments