[ 
https://issues.apache.org/jira/browse/CALCITE-7063?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17983863#comment-17983863
 ] 

Yu Xu edited comment on CALCITE-7063 at 6/20/25 2:48 AM:
---------------------------------------------------------

You are right, we can refer the doc(which indicate support binary type): 
[https://dev.mysql.com/doc/refman/8.4/en/string-functions.html#function_concat]

I also test it in MySQL which as expected:
{code:java}
mysql> select concat(binary('a'),binary('b'),binary('c'),binary('2'));
+------------------------------------------------------------------------------------------------------------------+
| concat(binary('a'),binary('b'),binary('c'),binary('2'))                       
                                   |
+------------------------------------------------------------------------------------------------------------------+
| 0x61626332                                                                    
                                   |
+------------------------------------------------------------------------------------------------------------------+
1 row in set, 4 warnings (0.00 sec)
 {code}
and current implement only just for String type in Calcite, should extend for 
binary type IMO.


was (Author: JIRAUSER307770):
You are right, we can refer the doc(which indicate support binary type): 
[https://dev.mysql.com/doc/refman/8.4/en/string-functions.html#function_concat]

I also test it in MySQL which as expected:
{code:java}
mysql> select concat(binary('a'),binary('b'),binary('c'),binary('2'));
+------------------------------------------------------------------------------------------------------------------+
| concat(binary('a'),binary('b'),binary('c'),binary('2'))                       
                                   |
+------------------------------------------------------------------------------------------------------------------+
| 0x61626332                                                                    
                                   |
+------------------------------------------------------------------------------------------------------------------+
1 row in set, 4 warnings (0.00 sec)
 {code}
and current implement only just for String type, should extend for binary type 
IMO.

> Result type inferred for CONCAT_FUNCTION is incorrect for BINARY arguments
> --------------------------------------------------------------------------
>
>                 Key: CALCITE-7063
>                 URL: https://issues.apache.org/jira/browse/CALCITE-7063
>             Project: Calcite
>          Issue Type: Bug
>          Components: core
>    Affects Versions: 1.40.0
>            Reporter: Mihai Budiu
>            Priority: Minor
>
> Calcite supports the MySQL CONCAT function.
> This function can have either VAR/CHAR or VAR/BINARY arguments. This holds 
> true for the Calcite implementation. However, the Calcite implementation 
> always infers a VAR/CHAR return type. 
> Moreover, there are no tests for BINARY arguments, so I suspect that this has 
> not been considered. Either the function should reject such arguments, or it 
> should correctly infer the return type.
> Note that OperandTypes.STRING for the operandTypeChecker can be misleading, 
> since the STRING type family includes BINARY.
>  



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

Reply via email to