Jefffrey commented on code in PR #22497:
URL: https://github.com/apache/datafusion/pull/22497#discussion_r3334873248


##########
datafusion/functions/src/string/replace.rs:
##########
@@ -268,14 +268,8 @@ fn apply_replace<B: BulkNullStringArrayBuilder>(
     }
 
     if from.is_empty() {
-        // Empty `from`: insert `to` before each character and at both ends.
-        builder.append_with(|w| {
-            w.write_str(to);
-            for ch in string.chars() {
-                w.write_char(ch);
-                w.write_str(to);
-            }
-        });
+        // PostgreSQL returns the input unchanged when `from` is empty 
(#22253).
+        builder.append_with(|w| w.write_str(string));

Review Comment:
   could we follow the approach from #22357 to use
   
   ```suggestion
           builder.append_value(string);
   ```
   
   instead?



-- 
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: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


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

Reply via email to