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

Danny Chan edited comment on CALCITE-2282 at 4/23/19 8:43 AM:
--------------------------------------------------------------

[~julianhyde] After i remove the code snippet, the unparsed sql identifier is 
changed and are all quoted, like:
{code:java}
select a, sum(b) from tbl group by a
{code}
is unparsed to:
{code:java}
select `a`, `sum`(`b`) from `tbl` group by `a`
{code}
For most of the builtin functions, this is correct, but for builtin functions 
without arguments, this semantics would change, for example, these 2 sqls are 
not equal:
{code:java}
select current_time from tbl;
select `current_time` from tbl;{code}
I think maybe we should tell users not to unparse a non-validated SqlNode, 
cause if there is a udf without any arguments, the semantics still changes, and 
we have no way to control this. Unless like the talking above, make the 
SqlOperatorTable in the parser pluggable.

 

 


was (Author: danny0405):
[~julianhyde] After i remove the code snippet, the unparsed sql identifier is 
changed and are all quoted, like:
{code:java}
select a, sum(b) from tbl group by a
{code}
is unparsed to:
{code:java}
select `a`, `sum`(`b`) from `tbl` group by `a`
{code}
For most of the builtin functions, this is correct, but for builtin functions 
without arguments, this semantics would change, for example, these 2 sqls are 
not equal:
{code:java}
select current_time from tbl;
select `current_time` from tbl;{code}
I think maybe we should tell users not to unparse a non-validated SqlNode, 
cause if there is a udf without any arguments, the semantics still changes, and 
we have no way to control this. Unless like the talking about, make the 
SqlOperatorTable in the parser pluggable.

 

 

> Allow OperatorTable to be pluggable in the parser
> -------------------------------------------------
>
>                 Key: CALCITE-2282
>                 URL: https://issues.apache.org/jira/browse/CALCITE-2282
>             Project: Calcite
>          Issue Type: Bug
>          Components: core
>            Reporter: Sudheesh Katkam
>            Priority: Major
>         Attachments: CALCITE-2282.patch.txt
>
>
> SqlAbstractParserImpl [hardcodes OperatorTable to 
> SqlStdOperatorTable|https://github.com/apache/calcite/blob/8327e674e7f0a768d124fa37fd75cda4b8a35bb6/core/src/main/java/org/apache/calcite/sql/parser/SqlAbstractParserImpl.java#L334|https://github.com/apache/calcite/blob/8327e674e7f0a768d124fa37fd75cda4b8a35bb6/core/src/main/java/org/apache/calcite/sql/parser/SqlAbstractParserImpl.java#L334].
>  Make this pluggable via a protected method.



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)

Reply via email to