Skip to content

Commit ff10937

Browse files
authored
Enhance string concat coercion to support castable types (#27)
* Allow any stringle types for concatination * Fix fmt
1 parent 6218c31 commit ff10937

1 file changed

Lines changed: 11 additions & 1 deletion

File tree

  • datafusion/expr-common/src/type_coercion

datafusion/expr-common/src/type_coercion/binary.rs

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1151,7 +1151,17 @@ fn string_concat_coercion(lhs_type: &DataType, rhs_type: &DataType) -> Option<Da
11511151
(Dictionary(_, lhs_value_type), Dictionary(_, rhs_value_type)) => {
11521152
string_coercion(lhs_value_type, rhs_value_type).or(None)
11531153
}
1154-
_ => None,
1154+
_ => {
1155+
if can_cast_types(lhs_type, &Utf8) && can_cast_types(rhs_type, &Utf8) {
1156+
Some(Utf8)
1157+
} else if can_cast_types(lhs_type, &LargeUtf8)
1158+
&& can_cast_types(rhs_type, &LargeUtf8)
1159+
{
1160+
Some(LargeUtf8)
1161+
} else {
1162+
None
1163+
}
1164+
}
11551165
})
11561166
}
11571167

0 commit comments

Comments
 (0)