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

Julian Hyde edited comment on CALCITE-4014 at 5/26/20, 8:16 PM:
----------------------------------------------------------------

Thanks, [~groobyming] for reporting this ~

I saw the syntax we support from the parser:
{noformat}
        <CONVERT> { s = span(); }
        <LPAREN>
        e = Expression(ExprContext.ACCEPT_SUB_QUERY) {
            args = startList(e);
        }
        <USING> name = SimpleIdentifier() {
            args.add(name);
        }
        <RPAREN> {
            return SqlStdOperatorTable.CONVERT.createCall(s.end(this), args);
        }
{noformat}
That means we did support CONVERT( ... USING ...) clause. But you are right, we 
do not translate the charSet correctly, there needs more effort in the convert 
table [1], we need to translate the charSet as a constant instead of a column 
name.

[1] 
https://github.com/apache/calcite/blob/05376d6bff11ccef690addb4f9c40ab16dd20bec/core/src/main/java/org/apache/calcite/rex/RexSqlStandardConvertletTable.java#L103


was (Author: danny0405):
Thanks, [~groobyming] for reporting this ~

I saw the syntax we support from the parser:
```sql
        <CONVERT> { s = span(); }
        <LPAREN>
        e = Expression(ExprContext.ACCEPT_SUB_QUERY) {
            args = startList(e);
        }
        <USING> name = SimpleIdentifier() {
            args.add(name);
        }
        <RPAREN> {
            return SqlStdOperatorTable.CONVERT.createCall(s.end(this), args);
        }
```
That means we did support CONVERT( ... USING ...) clause. But you are right, we 
do not translate the charSet correctly, there needs more effort in the convert 
table [1], we need to translate the charSet as a constant instead of a column 
name.

[1] 
https://github.com/apache/calcite/blob/05376d6bff11ccef690addb4f9c40ab16dd20bec/core/src/main/java/org/apache/calcite/rex/RexSqlStandardConvertletTable.java#L103

> calcite convert(column using utf8mb4) throws exception
> ------------------------------------------------------
>
>                 Key: CALCITE-4014
>                 URL: https://issues.apache.org/jira/browse/CALCITE-4014
>             Project: Calcite
>          Issue Type: Bug
>          Components: core
>    Affects Versions: 1.21.0
>            Reporter: groobyming
>            Priority: Major
>         Attachments: image-2020-05-20-17-00-28-611.png
>
>
>     Hello everyone, I found that when performing the following sql 
> verification, I will be prompted that the UTF8MB4 field cannot be found in 
> the table, but after reading the source code calcite is built-in to support 
> this convert function, is it not fully implemented yet?
>  
> SQL is as follows:
> select convert(name using utf8mb4) from test b where name = '4'
>  
> Error Message:
>    !image-2020-05-20-17-00-28-611.png!



--
This message was sent by Atlassian Jira
(v8.3.4#803005)

Reply via email to