xuzifu666 commented on code in PR #4431:
URL: https://github.com/apache/calcite/pull/4431#discussion_r2160367416
##########
core/src/main/java/org/apache/calcite/runtime/SqlFunctions.java:
##########
@@ -1651,8 +1651,31 @@ public static ByteString concat(ByteString s0,
ByteString s1) {
}
/** SQL {@code CONCAT(arg0, arg1, arg2, ...)} function. */
- public static String concatMulti(String... args) {
Review Comment:
According to the
documentation(https://dev.mysql.com/doc/refman/8.4/en/string-functions.html#function_concat),
the concat function should be able to use both string and bytestring, so the
previous definition is wrong and should be directly replaced with Object...
instead of String...
case refer cases in MySQL as follow:
```
mysql> select concat(binary('a'),null);
+----------------------------------------------------+
| concat(binary('a'),null) |
+----------------------------------------------------+
| NULL |
+----------------------------------------------------+
1 row in set, 1 warning (0.00 sec)
mysql> select concat(binary('a'),'b');
+--------------------------------------------------+
| concat(binary('a'),'b') |
+--------------------------------------------------+
| 0x6162 |
+--------------------------------------------------+
1 row in set, 1 warning (0.00 sec)
mysql> select concat('a',binary('b'));
+--------------------------------------------------+
| concat('a',binary('b')) |
+--------------------------------------------------+
| 0x6162 |
+--------------------------------------------------+
1 row in set, 1 warning (0.00 sec)
mysql> select concat('a',binary('b'),null);
+------------------------------------------------------------+
| concat('a',binary('b'),null) |
+------------------------------------------------------------+
| NULL |
+------------------------------------------------------------+
1 row in set, 1 warning (0.00 sec)
mysql> select concat('a','b');
+-----------------+
| concat('a','b') |
+-----------------+
| ab |
+-----------------+
1 row in set (0.00 sec)
```
```
mysql> select concat(binary('a'), 1);
+------------------------------------------------+
| concat(binary('a'), 1) |
+------------------------------------------------+
| 0x6131 |
+------------------------------------------------+
1 row in set, 1 warning (0.00 sec)
```
--
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]