@@ -890,15 +890,21 @@ fn dictionary_coercion(
890
890
/// 2. Data type of the other side should be able to cast to string type
891
891
fn string_concat_coercion ( lhs_type : & DataType , rhs_type : & DataType ) -> Option < DataType > {
892
892
use arrow:: datatypes:: DataType :: * ;
893
- string_coercion_duplicate ( lhs_type, rhs_type) . or ( match ( lhs_type, rhs_type) {
894
- ( Utf8 , from_type) | ( from_type, Utf8 ) => {
895
- string_concat_internal_coercion ( from_type, & Utf8 )
896
- }
897
- ( LargeUtf8 , from_type) | ( from_type, LargeUtf8 ) => {
898
- string_concat_internal_coercion ( from_type, & LargeUtf8 )
893
+ match ( lhs_type, rhs_type) {
894
+ // If Utf8View is in any side, we coerce to Utf8.
895
+ ( Utf8View , Utf8View | Utf8 | LargeUtf8 ) | ( Utf8 | LargeUtf8 , Utf8View ) => {
896
+ Some ( Utf8 )
899
897
}
900
- _ => None ,
901
- } )
898
+ _ => string_coercion ( lhs_type, rhs_type) . or ( match ( lhs_type, rhs_type) {
899
+ ( Utf8 , from_type) | ( from_type, Utf8 ) => {
900
+ string_concat_internal_coercion ( from_type, & Utf8 )
901
+ }
902
+ ( LargeUtf8 , from_type) | ( from_type, LargeUtf8 ) => {
903
+ string_concat_internal_coercion ( from_type, & LargeUtf8 )
904
+ }
905
+ _ => None ,
906
+ } ) ,
907
+ }
902
908
}
903
909
904
910
fn array_coercion ( lhs_type : & DataType , rhs_type : & DataType ) -> Option < DataType > {
@@ -939,20 +945,6 @@ fn string_coercion(lhs_type: &DataType, rhs_type: &DataType) -> Option<DataType>
939
945
}
940
946
}
941
947
942
- fn string_coercion_duplicate ( lhs_type : & DataType , rhs_type : & DataType ) -> Option < DataType > {
943
- use arrow:: datatypes:: DataType :: * ;
944
- match ( lhs_type, rhs_type) {
945
- // If Utf8View is in any side, we coerce to Utf8.
946
- ( Utf8View , Utf8View | Utf8 | LargeUtf8 ) | ( Utf8 | LargeUtf8 , Utf8View ) => {
947
- Some ( Utf8 )
948
- }
949
- // Then, if LargeUtf8 is in any side, we coerce to LargeUtf8.
950
- ( LargeUtf8 , Utf8 | LargeUtf8 ) | ( Utf8 , LargeUtf8 ) => Some ( LargeUtf8 ) ,
951
- ( Utf8 , Utf8 ) => Some ( Utf8 ) ,
952
- _ => None ,
953
- }
954
- }
955
-
956
948
fn numeric_string_coercion ( lhs_type : & DataType , rhs_type : & DataType ) -> Option < DataType > {
957
949
use arrow:: datatypes:: DataType :: * ;
958
950
match ( lhs_type, rhs_type) {
0 commit comments