You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@calcite.apache.org by "Julian Hyde (Jira)" <ji...@apache.org> on 2021/03/22 19:19:00 UTC

[jira] [Commented] (CALCITE-4545) Unparse a new function of FUNCTION_ID syntax will be quoted

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

Julian Hyde commented on CALCITE-4545:
--------------------------------------

This is tricky. We do not want to introduce operator tables into parsing and unparsing. (We use them for a limited amount, but it must not increase. Parsing needs to stay separate from types and semantics.)

Just a thought, but why is {{SqlIdentifier.unparse}} being called? Shouldn't it be a {{SqlCall}} with no arguments?

> Unparse a new function of FUNCTION_ID syntax will be quoted
> -----------------------------------------------------------
>
>                 Key: CALCITE-4545
>                 URL: https://issues.apache.org/jira/browse/CALCITE-4545
>             Project: Calcite
>          Issue Type: Bug
>          Components: core
>            Reporter: Jark Wu
>            Priority: Major
>             Fix For: 1.26.0, 1.27.0
>
>
> In Flink, we would like to introduce some new functions of FUNCTION_ID syntax, e.g. {{CURRENT_ROW_TIMESTAMP}}. However, when unparsing this new function, we will get the quoted string {{`CURRENT_ROW_TIMESTAMP`}} which can't be executed anymore, because Calcite think it is a column reference. 
> The root cause of it is {{org.apache.calcite.sql.SqlIdentifier#unparse}} calls {{org.apache.calcite.sql.SqlUtil#unparseSqlIdentifierSyntax}} where it uses a static Calcite {{SqlStdOperatorTable.instance()}} instead of a user-defined operator table. Therefore, it thinks it's not a sql function and unparse it with quotes. 



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