jacktengg opened a new pull request, #18878:
URL: https://github.com/apache/doris/pull/18878
# Proposed changes
Issue Number: close #xxx
## Problem summary
Support function `VARCHAR char(INT,..., [USING charset_name])`.
Interprets each argument as an integer and returns a string consisting of
the characters given by the code values of those integers. `NULL` values are
skipped.
If the result string is illegal for the given character set, the result from
`CHAR()` becomes `NULL`.
Arguments larger than `255` are converted into multiple result bytes. For
example, `char(15049882)` is equivalent to `char(229, 164, 154)`.
Currently only `utf8` is supported for `charset_name`.
```
mysql> select char(68, 111, 114, 105, 115);
+--------------------------------------+
| char('utf8', 68, 111, 114, 105, 115) |
+--------------------------------------+
| Doris |
+--------------------------------------+
mysql> select char(15049882, 15179199, 14989469);
+--------------------------------------------+
| char('utf8', 15049882, 15179199, 14989469) |
+--------------------------------------------+
| 多睿丝 |
+--------------------------------------------+
mysql> select char(255);
+-------------------+
| char('utf8', 255) |
+-------------------+
| NULL |
+-------------------+
```
## Checklist(Required)
* [ ] Does it affect the original behavior
* [ ] Has unit tests been added
* [ ] Has document been added or modified
* [ ] Does it need to update dependencies
* [ ] Is this PR support rollback (If NO, please explain WHY)
## Further comments
If this is a relatively large or complex change, kick off the discussion at
[[email protected]](mailto:[email protected]) by explaining why you
chose the solution you did and what alternatives you considered, etc...
--
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]