@@ -37,7 +37,7 @@ use datafusion_common::{
3737} ;
3838
3939macro_rules! get_extreme_value {
40- ( $extreme: ident, $value: expr) => {
40+ ( $extreme: ident, $DECIMAL128_ARRAY : ident , $DECIMAL256_ARRAY : ident , $ value: expr) => {
4141 match $value {
4242 DataType :: UInt8 => ScalarValue :: UInt8 ( Some ( u8 :: $extreme) ) ,
4343 DataType :: UInt16 => ScalarValue :: UInt16 ( Some ( u16 :: $extreme) ) ,
@@ -83,18 +83,12 @@ macro_rules! get_extreme_value {
8383 ScalarValue :: IntervalMonthDayNano ( Some ( IntervalMonthDayNano :: $extreme) )
8484 }
8585 DataType :: Decimal128 ( precision, scale) => ScalarValue :: Decimal128 (
86- Some (
87- paste:: paste! { [ <$extreme _DECIMAL128_FOR_EACH_PRECISION>] }
88- [ * precision as usize ] ,
89- ) ,
86+ Some ( $DECIMAL128_ARRAY[ * precision as usize ] ) ,
9087 * precision,
9188 * scale,
9289 ) ,
9390 DataType :: Decimal256 ( precision, scale) => ScalarValue :: Decimal256 (
94- Some (
95- paste:: paste! { [ <$extreme _DECIMAL256_FOR_EACH_PRECISION>] }
96- [ * precision as usize ] ,
97- ) ,
91+ Some ( $DECIMAL256_ARRAY[ * precision as usize ] ) ,
9892 * precision,
9993 * scale,
10094 ) ,
@@ -1162,10 +1156,20 @@ fn handle_overflow<const UPPER: bool>(
11621156 match ( UPPER , positive_sign) {
11631157 ( true , true ) | ( false , false ) => ScalarValue :: try_from ( dt) . unwrap ( ) ,
11641158 ( true , false ) => {
1165- get_extreme_value ! ( MIN , dt)
1159+ get_extreme_value ! (
1160+ MIN ,
1161+ MIN_DECIMAL128_FOR_EACH_PRECISION ,
1162+ MIN_DECIMAL256_FOR_EACH_PRECISION ,
1163+ dt
1164+ )
11661165 }
11671166 ( false , true ) => {
1168- get_extreme_value ! ( MAX , dt)
1167+ get_extreme_value ! (
1168+ MAX ,
1169+ MAX_DECIMAL128_FOR_EACH_PRECISION ,
1170+ MAX_DECIMAL256_FOR_EACH_PRECISION ,
1171+ dt
1172+ )
11691173 }
11701174 }
11711175}
@@ -4218,12 +4222,8 @@ mod tests {
42184222 }
42194223
42204224 macro_rules! capture_mode_change {
4221- ( $TYPE: ty) => {
4222- paste:: item! {
4223- capture_mode_change_helper!( [ <capture_mode_change_ $TYPE>] ,
4224- [ <create_interval_ $TYPE>] ,
4225- $TYPE) ;
4226- }
4225+ ( $TYPE: ty, $TEST_FN_NAME: ident, $CREATE_FN_NAME: ident) => {
4226+ capture_mode_change_helper!( $TEST_FN_NAME, $CREATE_FN_NAME, $TYPE) ;
42274227 } ;
42284228 }
42294229
@@ -4251,8 +4251,8 @@ mod tests {
42514251 } ;
42524252 }
42534253
4254- capture_mode_change ! ( f32 ) ;
4255- capture_mode_change ! ( f64 ) ;
4254+ capture_mode_change ! ( f32 , capture_mode_change_f32 , create_interval_f32 ) ;
4255+ capture_mode_change ! ( f64 , capture_mode_change_f64 , create_interval_f64 ) ;
42564256
42574257 #[ cfg( all(
42584258 any( target_arch = "x86_64" , target_arch = "aarch64" ) ,
0 commit comments