Apache DataFusion SQL Query Engine
fix: dont try to coerce list for regex match (#11646)
Trent Hauckcdf387e4de56
diff --git a/datafusion/expr/src/type_coercion/binary.rs b/datafusion/expr/src/type_coercion/binary.rsindex e1765b5c3e..ae5bdc88b1 100644--- a/datafusion/expr/src/type_coercion/binary.rs+++ b/datafusion/expr/src/type_coercion/binary.rs@@ -1018,7 +1018,6 @@ pub fn like_coercion(lhs_type: &DataType, rhs_type: &DataType) -> Option<DataTyp/// This is a union of string coercion rules and dictionary coercion rulespub fn regex_coercion(lhs_type: &DataType, rhs_type: &DataType) -> Option<DataType> {string_coercion(lhs_type, rhs_type)- .or_else(|| list_coercion(lhs_type, rhs_type)).or_else(|| dictionary_coercion(lhs_type, rhs_type, false))}diff --git a/datafusion/functions/src/regex/regexpmatch.rs b/datafusion/functions/src/regex/regexpmatch.rsindex 73228e6081..f57d3c17bd 100644--- a/datafusion/functions/src/regex/regexpmatch.rs+++ b/datafusion/functions/src/regex/regexpmatch.rs@@ -36,6 +36,7 @@ use std::sync::Arc;pub struct RegexpMatchFunc {signature: Signature,}+impl Default for RegexpMatchFunc {fn default() -> Self {Self::new()diff --git a/datafusion/sqllogictest/test_files/regexp.slt b/datafusion/sqllogictest/test_files/regexp.sltindex f5349fc659..aa99a54c26 100644--- a/datafusion/sqllogictest/test_files/regexp.slt+++ b/datafusion/sqllogictest/test_files/regexp.slt@@ -325,6 +325,11 @@ SELECT 'foo\nbar\nbaz' ~ 'bar';----true+statement error+Error during planning: Cannot infer common argument type for regex operation List(Field { name: "item", data_type: Int64, nullable: true, dict_id: 0, dict_is_ordered: false, metadata+: {} }) ~ List(Field { name: "item", data_type: Int64, nullable: true, dict_id: 0, dict_is_ordered: false, metadata: {} })+select [1,2] ~ [3];+query BSELECT 'foo\nbar\nbaz' LIKE '%bar%';----