This is an automated email from the ASF dual-hosted git repository.

alamb 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 cdf387e4de fix: dont try to coerce list for regex match (#11646)
cdf387e4de is described below

commit cdf387e4de562d5c8bde7af30dcc153acfa0dfce
Author: Trent Hauck <[email protected]>
AuthorDate: Fri Jul 26 07:59:34 2024 -0700

    fix: dont try to coerce list for regex match (#11646)
    
    * fix: dont try to coerce list for regex
    
    * feat: add test for regex planning error
    
    * fix: add error to prove during planning
---
 datafusion/expr/src/type_coercion/binary.rs   | 1 -
 datafusion/functions/src/regex/regexpmatch.rs | 1 +
 datafusion/sqllogictest/test_files/regexp.slt | 5 +++++
 3 files changed, 6 insertions(+), 1 deletion(-)

diff --git a/datafusion/expr/src/type_coercion/binary.rs 
b/datafusion/expr/src/type_coercion/binary.rs
index 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 rules
 pub 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.rs
index 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.slt
index 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 B
 SELECT 'foo\nbar\nbaz' LIKE '%bar%';
 ----


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to