This is an automated email from the ASF dual-hosted git repository.
dheres 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 58075e2329 Fix: support NULL input for like operations (#12025)
58075e2329 is described below
commit 58075e2329e989ebe3cede1088ea8849f9eb25bd
Author: HuSen <[email protected]>
AuthorDate: Fri Aug 16 16:43:13 2024 +0800
Fix: support NULL input for like operations (#12025)
---
datafusion/expr-common/src/type_coercion/binary.rs | 1 +
datafusion/sqllogictest/test_files/regexp.slt | 20 ++++++++++++++++++++
2 files changed, 21 insertions(+)
diff --git a/datafusion/expr-common/src/type_coercion/binary.rs
b/datafusion/expr-common/src/type_coercion/binary.rs
index fd97f9af13..6d2fb660f6 100644
--- a/datafusion/expr-common/src/type_coercion/binary.rs
+++ b/datafusion/expr-common/src/type_coercion/binary.rs
@@ -1045,6 +1045,7 @@ pub fn like_coercion(lhs_type: &DataType, rhs_type:
&DataType) -> Option<DataTyp
.or_else(|| list_coercion(lhs_type, rhs_type))
.or_else(|| binary_to_string_coercion(lhs_type, rhs_type))
.or_else(|| dictionary_coercion(lhs_type, rhs_type, false))
+ .or_else(|| regex_null_coercion(lhs_type, rhs_type))
.or_else(|| null_coercion(lhs_type, rhs_type))
}
diff --git a/datafusion/sqllogictest/test_files/regexp.slt
b/datafusion/sqllogictest/test_files/regexp.slt
index 22322d79cc..c04021651a 100644
--- a/datafusion/sqllogictest/test_files/regexp.slt
+++ b/datafusion/sqllogictest/test_files/regexp.slt
@@ -395,6 +395,26 @@ SELECT 'foo\nbar\nbaz' LIKE '%bar%';
----
true
+query B
+SELECT NULL LIKE NULL;
+----
+NULL
+
+query B
+SELECT NULL iLIKE NULL;
+----
+NULL
+
+query B
+SELECT NULL not LIKE NULL;
+----
+NULL
+
+query B
+SELECT NULL not iLIKE NULL;
+----
+NULL
+
statement ok
drop table t;
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]