morningman opened a new pull request, #36283:
URL: https://github.com/apache/doris/pull/36283
## Proposed changes
Add new function `replace_empty()`.
It acts all like `replace()`, instead for the search string(the second
param) is empty.
If the search string is empty, it will insert the third string in front of
all characters
of the first string, as well as the end of the first string.
eg:
```
mysql> select replace("abc", '', 'xyz');
+---------------------------+
| replace('abc', '', 'xyz') |
+---------------------------+
| abc |
+---------------------------+
1 row in set (0.01 sec)
mysql> select replace_empty("abc", '', 'xyz');
+---------------------------------+
| replace_empty('abc', '', 'xyz') |
+---------------------------------+
| xyzaxyzbxyzcxyz |
+---------------------------------+
1 row in set (0.00 sec)
```
This function is for compatibility of Presto/Trino, it behave exactly same
as `replace()` function in Presto/Trino.
--
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]