You are viewing a plain text version of this content. The canonical link for it is here.
Posted to github@datafusion.apache.org by "Jefffrey (via GitHub)" <gi...@apache.org> on 2026/06/01 14:26:40 UTC
Re: [PR] fix: replace with empty search string should be a no-op [datafusion]
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: github-unsubscribe@datafusion.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: github-unsubscribe@datafusion.apache.org
For additional commands, e-mail: github-help@datafusion.apache.org