This is an automated email from the ASF dual-hosted git repository.
jayzhan pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/datafusion.git
The following commit(s) were added to refs/heads/main by this push:
new ccf6258a1e Add Utf8View to `TypeCategory::Unknown` (#13350)
ccf6258a1e is described below
commit ccf6258a1e02eb01af436f78c7f6430be19fa59c
Author: Jay Zhan <[email protected]>
AuthorDate: Thu Nov 14 07:31:49 2024 +0800
Add Utf8View to `TypeCategory::Unknown` (#13350)
* add utf8view
Signed-off-by: jayzhan211 <[email protected]>
* add test
Signed-off-by: jayzhan211 <[email protected]>
* fix comment
Signed-off-by: Jay Zhan <[email protected]>
---------
Signed-off-by: jayzhan211 <[email protected]>
Signed-off-by: Jay Zhan <[email protected]>
---
datafusion/expr-common/src/type_coercion/binary.rs | 8 +++++---
datafusion/sqllogictest/test_files/coalesce.slt | 8 ++++++++
2 files changed, 13 insertions(+), 3 deletions(-)
diff --git a/datafusion/expr-common/src/type_coercion/binary.rs
b/datafusion/expr-common/src/type_coercion/binary.rs
index 31fe6a59ba..c32b4951db 100644
--- a/datafusion/expr-common/src/type_coercion/binary.rs
+++ b/datafusion/expr-common/src/type_coercion/binary.rs
@@ -330,11 +330,13 @@ impl From<&DataType> for TypeCategory {
return TypeCategory::Array;
}
- // String literal is possible to cast to many other types like
numeric or datetime,
- // therefore, it is categorized as a unknown type
+ // It is categorized as unknown type because the type will be
resolved later on
if matches!(
data_type,
- DataType::Utf8 | DataType::LargeUtf8 | DataType::Null
+ DataType::Utf8
+ | DataType::LargeUtf8
+ | DataType::Utf8View
+ | DataType::Null
) {
return TypeCategory::Unknown;
}
diff --git a/datafusion/sqllogictest/test_files/coalesce.slt
b/datafusion/sqllogictest/test_files/coalesce.slt
index 97e77d0feb..06460a005c 100644
--- a/datafusion/sqllogictest/test_files/coalesce.slt
+++ b/datafusion/sqllogictest/test_files/coalesce.slt
@@ -242,6 +242,14 @@ none_set
statement ok
drop table test1
+# coalesce with utf8view
+query TTT
+select coalesce(arrow_cast(null, 'Utf8View'), arrow_cast('t', 'Utf8')),
+ arrow_typeof(coalesce(arrow_cast(null, 'Utf8View'), arrow_cast('t',
'Utf8'))),
+ arrow_typeof(coalesce(arrow_cast(null, 'Utf8'), arrow_cast('t',
'Utf8View')));
+----
+t Utf8View Utf8View
+
# test dict coercion with value
statement ok
create table t(c varchar) as values ('a'), (null);
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]