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


##########
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:
   Yup binary coercion does not work with that signature:
   ```
   External error: 1 errors in file 
/Users/matt/git/datafusion/datafusion/sqllogictest/test_files/binary.slt
   
   1. query failed: DataFusion error: Error during planning: Internal error: 
Function 'regexp_replace' failed to match any signature, errors: Error during 
planning: Function 'regexp_replace' expects NativeType::String but received 
NativeType::Binary,Error during planning: Function 'regexp_replace' expects 4 
arguments but received 3.
   This issue was likely caused by a bug in DataFusion's code. Please help us 
to resolve this by filing a bug report in our issue tracker: 
https://github.com/apache/datafusion/issues No function matches the given name 
and argument types 'regexp_replace(Binary, Utf8, Utf8)'. You might need to add 
explicit type casts.
        Candidate functions:
        regexp_replace(String(3))
        regexp_replace(String(4))
   [SQL] SELECT
     cast(binary as varchar) as str,
     regexp_replace(binary, 'F', 'f') as binary_replaced,
     cast(largebinary as varchar) as large_str,
     regexp_replace(largebinary, 'F', 'f') as large_binary_replaced
   from t;
   at 
/Users/matt/git/datafusion/datafusion/sqllogictest/test_files/binary.slt:302
   ```
   If I put it back to coercible then we need to put codepaths to handle all 
the wonky combinations people might come up with.



-- 
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