[
https://issues.apache.org/jira/browse/CALCITE-6774?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]
ZheHu resolved CALCITE-6774.
----------------------------
Fix Version/s: 1.39.0
Resolution: Fixed
Fixed via
[a549f35|https://github.com/apache/calcite/commit/a549f3591e5ff1fa10d3417bd030d60b358dc448].
Thanks for your review [~nobigo] [~mbudiu]
> REPLACE function returns wrong result when search pattern is an empty string
> ----------------------------------------------------------------------------
>
> Key: CALCITE-6774
> URL: https://issues.apache.org/jira/browse/CALCITE-6774
> Project: Calcite
> Issue Type: Bug
> Components: core
> Affects Versions: 1.38.0
> Reporter: ZheHu
> Assignee: ZheHu
> Priority: Major
> Labels: pull-request-available
> Fix For: 1.39.0
>
>
> Run the following test in SqlOperatorTest:
> {code:java}
> f.checkString("REPLACE('ciao', '', 'ciao')", "ciao", "VARCHAR NOT NULL");
> {code}
> we will get "ciaocciaoiciaoaciaoociao", however the right result should be
> "ciao".
> Replace function should return unchanged string when search is an empty
> string ('').
> {code:java}
> REPLACE(string, search, replace)
> {code}
> I've tested this behavior in Oracle, PostgreSQL and SQL Server.
--
This message was sent by Atlassian Jira
(v8.20.10#820010)