@@ -27,7 +27,6 @@ use arrow::datatypes::{
27
27
use datafusion_common:: Result ;
28
28
use datafusion_common:: { plan_err, DataFusionError } ;
29
29
30
- use crate :: type_coercion:: is_numeric;
31
30
use crate :: Operator ;
32
31
33
32
/// The type signature of an instantiation of binary expression
@@ -310,10 +309,10 @@ pub fn comparison_coercion(lhs_type: &DataType, rhs_type: &DataType) -> Option<D
310
309
fn string_numeric_coercion ( lhs_type : & DataType , rhs_type : & DataType ) -> Option < DataType > {
311
310
use arrow:: datatypes:: DataType :: * ;
312
311
match ( lhs_type, rhs_type) {
313
- ( Utf8 , _) if is_numeric ( rhs_type ) => Some ( Utf8 ) ,
314
- ( LargeUtf8 , _) if is_numeric ( rhs_type ) => Some ( LargeUtf8 ) ,
315
- ( _, Utf8 ) if is_numeric ( lhs_type ) => Some ( Utf8 ) ,
316
- ( _, LargeUtf8 ) if is_numeric ( lhs_type ) => Some ( LargeUtf8 ) ,
312
+ ( Utf8 , _) if rhs_type . is_numeric ( ) => Some ( Utf8 ) ,
313
+ ( LargeUtf8 , _) if rhs_type . is_numeric ( ) => Some ( LargeUtf8 ) ,
314
+ ( _, Utf8 ) if lhs_type . is_numeric ( ) => Some ( Utf8 ) ,
315
+ ( _, LargeUtf8 ) if lhs_type . is_numeric ( ) => Some ( LargeUtf8 ) ,
317
316
_ => None ,
318
317
}
319
318
}
@@ -365,7 +364,7 @@ fn comparison_binary_numeric_coercion(
365
364
rhs_type : & DataType ,
366
365
) -> Option < DataType > {
367
366
use arrow:: datatypes:: DataType :: * ;
368
- if !is_numeric ( lhs_type ) || !is_numeric ( rhs_type ) {
367
+ if !lhs_type . is_numeric ( ) || !rhs_type . is_numeric ( ) {
369
368
return None ;
370
369
} ;
371
370
@@ -563,14 +562,18 @@ fn create_decimal256_type(precision: u8, scale: i8) -> DataType {
563
562
fn both_numeric_or_null_and_numeric ( lhs_type : & DataType , rhs_type : & DataType ) -> bool {
564
563
use arrow:: datatypes:: DataType :: * ;
565
564
match ( lhs_type, rhs_type) {
566
- ( _, Null ) => is_numeric ( lhs_type ) ,
567
- ( Null , _) => is_numeric ( rhs_type ) ,
565
+ ( _, Null ) => lhs_type . is_numeric ( ) ,
566
+ ( Null , _) => rhs_type . is_numeric ( ) ,
568
567
( Dictionary ( _, lhs_value_type) , Dictionary ( _, rhs_value_type) ) => {
569
- is_numeric ( lhs_value_type ) && is_numeric ( rhs_value_type )
568
+ lhs_value_type . is_numeric ( ) && rhs_value_type . is_numeric ( )
570
569
}
571
- ( Dictionary ( _, value_type) , _) => is_numeric ( value_type) && is_numeric ( rhs_type) ,
572
- ( _, Dictionary ( _, value_type) ) => is_numeric ( lhs_type) && is_numeric ( value_type) ,
573
- _ => is_numeric ( lhs_type) && is_numeric ( rhs_type) ,
570
+ ( Dictionary ( _, value_type) , _) => {
571
+ value_type. is_numeric ( ) && rhs_type. is_numeric ( )
572
+ }
573
+ ( _, Dictionary ( _, value_type) ) => {
574
+ lhs_type. is_numeric ( ) && value_type. is_numeric ( )
575
+ }
576
+ _ => lhs_type. is_numeric ( ) && rhs_type. is_numeric ( ) ,
574
577
}
575
578
}
576
579
0 commit comments