jonahgao commented on code in PR #11459:
URL: https://github.com/apache/datafusion/pull/11459#discussion_r1677508054


##########
datafusion/sqllogictest/test_files/regexp.slt:
##########
@@ -309,6 +309,12 @@ SELECT regexp_replace(arrow_cast('foobar', 
'Dictionary(Int32, Utf8)'), 'bar', 'x
 ----
 fooxx
 
+query TT
+select regexp_replace(col, NULL, 'c'), regexp_replace(col, 'a', NULL) from 
(values ('a'), ('b')) as tbl(col);

Review Comment:
   Maybe we also need a test with flags is null



##########
datafusion/functions/src/regex/regexpreplace.rs:
##########
@@ -282,22 +282,23 @@ pub fn regexp_replace<T: OffsetSizeTrait>(args: 
&[ArrayRef]) -> Result<ArrayRef>
 
 fn _regexp_replace_early_abort<T: OffsetSizeTrait>(
     input_array: &GenericStringArray<T>,
+    sz: &usize,

Review Comment:
   I think passing `sz` by value would be more efficient.
   
   See: 
https://rust-lang.github.io/rust-clippy/master/index.html#/trivially_copy_pass_by_ref
   
   ```sh
   $ cargo clippy -- -W clippy::trivially_copy_pass_by_ref
   warning: this argument (8 byte) is passed by reference, but would be more 
efficient if passed by value (limit: 8 byte)
      --> datafusion/functions/src/regex/regexpreplace.rs:285:9
       |
   285 |     sz: &usize,
       |         ^^^^^^ help: consider passing by value instead: `usize`
   
   ```
   



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