mbutrovich commented on code in PR #17195:
URL: https://github.com/apache/datafusion/pull/17195#discussion_r2282955561


##########
datafusion/functions/src/regex/regexpreplace.rs:
##########
@@ -94,14 +98,30 @@ impl Default for RegexpReplaceFunc {
 
 impl RegexpReplaceFunc {
     pub fn new() -> Self {
-        use DataType::*;
+        use TypeSignature::*;
+        use TypeSignatureClass::*;
         Self {
             signature: Signature::one_of(
                 vec![
-                    TypeSignature::Exact(vec![Utf8, Utf8, Utf8]),

Review Comment:
   Actually, if I reorder them into the precedence that I want...
   ```
               signature: Signature::one_of(
                   vec![
                       Exact(vec![Utf8View, Utf8View, Utf8View]),
                       Exact(vec![LargeUtf8, LargeUtf8, LargeUtf8]),
                       Exact(vec![Utf8, Utf8, Utf8]),
                       Exact(vec![Utf8View, Utf8View, Utf8View, Utf8View]),
                       Exact(vec![LargeUtf8, LargeUtf8, LargeUtf8, LargeUtf8]),
                       Exact(vec![Utf8, Utf8, Utf8, Utf8]),
                   ],
                   Volatility::Immutable,
               ),
   ```
   I get...
   ```
   External error: 1 errors in file 
/Users/matt/git/datafusion/datafusion/sqllogictest/test_files/string/string_view.slt
   
   1. query result mismatch:
   [SQL] EXPLAIN SELECT
     REGEXP_REPLACE(column1_utf8view, '^https?://(?:www\.)?([^/]+)/.*$', '\1') 
AS k
   FROM test;
   [Diff] (-expected|+actual)
       logical_plan
   -   01)Projection: regexp_replace(test.column1_utf8view, 
Utf8("^https?://(?:www\.)?([^/]+)/.*$"), Utf8("\1")) AS k
   +   01)Projection: regexp_replace(test.column1_utf8view, 
Utf8View("^https?://(?:www\.)?([^/]+)/.*$"), Utf8View("\1")) AS k
       02)--TableScan: test projection=[column1_utf8view]
   at 
/Users/matt/git/datafusion/datafusion/sqllogictest/test_files/string/string_view.slt:801
   ```
   Which might be okay? Defining the literals as `Utf8View` is pretty harmless.
   
   edit: nope that bombs out for:
   ```
   External error: 1 errors in file 
/Users/matt/git/datafusion/datafusion/sqllogictest/test_files/regexp/regexp_replace.slt
   
   1. query failed: DataFusion error: Arrow error: Invalid argument error: 
column types must match schema types, expected Utf8View but found Utf8 at 
column index 0
   [SQL] select
       regexp_replace(col, NULL, 'c'),
       regexp_replace(col, 'a', NULL),
       regexp_replace(col, 'a', 'c', NULL)
   from (values ('a'), ('b')) as tbl(col);
   at 
/Users/matt/git/datafusion/datafusion/sqllogictest/test_files/regexp/regexp_replace.slt:121
   ```



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: github-unsubscr...@datafusion.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: github-unsubscr...@datafusion.apache.org
For additional commands, e-mail: github-h...@datafusion.apache.org

Reply via email to