From b6c3e23c75c05b729ff117ebe145c9dd26d93c03 Mon Sep 17 00:00:00 2001 From: osipovartem Date: Mon, 23 Jun 2025 13:50:37 +0300 Subject: [PATCH 1/2] Allow any stringle types for concatination --- datafusion/expr-common/src/type_coercion/binary.rs | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/datafusion/expr-common/src/type_coercion/binary.rs b/datafusion/expr-common/src/type_coercion/binary.rs index fdee00f81b1e..a250e2356044 100644 --- a/datafusion/expr-common/src/type_coercion/binary.rs +++ b/datafusion/expr-common/src/type_coercion/binary.rs @@ -1151,7 +1151,14 @@ fn string_concat_coercion(lhs_type: &DataType, rhs_type: &DataType) -> Option { string_coercion(lhs_value_type, rhs_value_type).or(None) } - _ => None, + _ => + if can_cast_types(lhs_type, &Utf8) && can_cast_types(rhs_type, &Utf8) { + Some(Utf8) + } else if can_cast_types(lhs_type, &LargeUtf8) && can_cast_types(rhs_type, &LargeUtf8) { + Some(LargeUtf8) + } else { + None + } }) } From 48aa8abf0bafe227b122fc6f9e9a6c6a587c139c Mon Sep 17 00:00:00 2001 From: osipovartem Date: Wed, 25 Jun 2025 11:06:45 +0300 Subject: [PATCH 2/2] Fix fmt --- datafusion/expr-common/src/type_coercion/binary.rs | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/datafusion/expr-common/src/type_coercion/binary.rs b/datafusion/expr-common/src/type_coercion/binary.rs index a250e2356044..3f9429bff71d 100644 --- a/datafusion/expr-common/src/type_coercion/binary.rs +++ b/datafusion/expr-common/src/type_coercion/binary.rs @@ -1151,14 +1151,17 @@ fn string_concat_coercion(lhs_type: &DataType, rhs_type: &DataType) -> Option { string_coercion(lhs_value_type, rhs_value_type).or(None) } - _ => + _ => { if can_cast_types(lhs_type, &Utf8) && can_cast_types(rhs_type, &Utf8) { Some(Utf8) - } else if can_cast_types(lhs_type, &LargeUtf8) && can_cast_types(rhs_type, &LargeUtf8) { + } else if can_cast_types(lhs_type, &LargeUtf8) + && can_cast_types(rhs_type, &LargeUtf8) + { Some(LargeUtf8) } else { None } + } }) }