nvphungdev opened a new pull request, #22275:
URL: https://github.com/apache/datafusion/pull/22275
## Which issue does this PR close?
- Closes #22253.
## Rationale for this change
PostgreSQL treats `replace(str, '', replacement)` as a no-op. DataFusion
currently inserts the replacement before every character and at both ends, so
`replace('abc', '', 'x')` returns `xaxbxcx` instead of `abc`.
## What changes are included in this PR?
- Updates the string `replace` implementation so an empty search substring
returns the original input string unchanged.
- Adds regression coverage for Utf8, LargeUtf8, Utf8View, and SQL execution.
## Are these changes tested?
Yes:
- `cargo fmt --all`
- `cargo test -p datafusion-functions string::replace::tests::test_functions`
- `cargo test -p datafusion-sqllogictest --test sqllogictests --
expr.slt:637`
- `cargo clippy --all-targets --all-features -- -D warnings`
- `git diff --check`
## Are there any user-facing changes?
Yes. `replace` now matches PostgreSQL-compatible behavior for an empty
search substring.
--
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]