@@ -890,7 +890,7 @@ 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 ( lhs_type, rhs_type) . or ( match ( lhs_type, rhs_type) {
893
+ string_coercion_duplicate ( lhs_type, rhs_type) . or ( match ( lhs_type, rhs_type) {
894
894
( Utf8 , from_type) | ( from_type, Utf8 ) => {
895
895
string_concat_internal_coercion ( from_type, & Utf8 )
896
896
}
@@ -939,6 +939,20 @@ fn string_coercion(lhs_type: &DataType, rhs_type: &DataType) -> Option<DataType>
939
939
}
940
940
}
941
941
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
+
942
956
fn numeric_string_coercion ( lhs_type : & DataType , rhs_type : & DataType ) -> Option < DataType > {
943
957
use arrow:: datatypes:: DataType :: * ;
944
958
match ( lhs_type, rhs_type) {
0 commit comments