Apache DataFusion SQL Query Engine
Fill in missing utf8view support in function type coercion (#23916)
Jeffrey Vo1727b7d70963
diff --git a/datafusion/expr/src/type_coercion/functions.rs b/datafusion/expr/src/type_coercion/functions.rsindex 37a1c10159..ec3ab6f441 100644--- a/datafusion/expr/src/type_coercion/functions.rs+++ b/datafusion/expr/src/type_coercion/functions.rs@@ -1198,13 +1198,11 @@ fn coerced_from<'a>() => Some(type_into.clone()),(Timestamp(TimeUnit::Nanosecond, None),- Null | Timestamp(_, None) | Date32 | Utf8 | LargeUtf8,+ Null | Timestamp(_, None) | Date32 | Date64 | Utf8 | LargeUtf8 | Utf8View,) => Some(type_into.clone()),- (Interval(_), Null | Utf8 | LargeUtf8) => Some(type_into.clone()),- // We can go into a Utf8View from a Utf8 or LargeUtf8- (Utf8View, Utf8 | LargeUtf8 | Null) => Some(type_into.clone()),+ (Interval(_), Null | Utf8 | LargeUtf8 | Utf8View) => Some(type_into.clone()),// Any type can be coerced into strings- (Utf8 | LargeUtf8, _) => Some(type_into.clone()),+ (Utf8 | LargeUtf8 | Utf8View, _) => Some(type_into.clone()),// We can go into a BinaryView from a Binary or LargeBinary(BinaryView, Binary | LargeBinary | Null) => Some(type_into.clone()),(Null, _) if can_cast_types(type_from, type_into) => Some(type_into.clone()),diff --git a/datafusion/sqllogictest/test_files/datetime/timestamps.slt b/datafusion/sqllogictest/test_files/datetime/timestamps.sltindex 9ac00e72b4..002111d3f2 100644--- a/datafusion/sqllogictest/test_files/datetime/timestamps.slt+++ b/datafusion/sqllogictest/test_files/datetime/timestamps.slt@@ -1264,6 +1264,12 @@ SELECT DATE_BIN('5 month', '2022-01-01T00:00:00Z');----2021-09-01T00:00:00+# test with utf8view+query P+SELECT DATE_BIN(arrow_cast('5 month', 'Utf8View'), '2022-01-01T00:00:00Z');+----+2021-09-01T00:00:00+# month interval with default start timequery PSELECT DATE_BIN('1 month', '2022-01-01 00:00:00Z');