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

Danny Chan edited comment on CALCITE-2282 at 4/25/19 12:56 PM:
---------------------------------------------------------------

[~julianhyde]

I did more tests and i make sure we can remove the operator table in sql 
parser, but there are still some problems need to fix:
 # The SqlPrettyWriter has a flag [1][2] to control if we will force to add 
quotes to all identifiers when unparsing, with a default value *true*, if i 
make it false, there wound be about 300 test errors, most of them are caused by 
the quotes.
 # Few tests fail cause some reserved word is not recognized as builtin 
function now without quoting, but i think this is expected behavior.[3]
 # The builtin operators would be quoted for un-validated SqlNode tree if  i 
make SqlPrettyWriter#isQuoteAllIdentifiers return *true,* this behavior is 
different with before

So should we make SqlPrettyWriter#isQuoteAllIdentifiers default true or false ?

if we make it false, we would have the ability to unparse the SqlNode to just 
what the original sql statement like, only for some adaptors the quoted info is 
lost, and we may add a flag in SqlNode#toString to control the quoting behavior.

If we still make it true, we will have un-compatible behavior as 3.

[1] 
[https://github.com/apache/calcite/blob/986a2d579c8f9b9f08aa9bbbfe11efc4e7bb0809/core/src/main/java/org/apache/calcite/sql/pretty/SqlPrettyWriter.java#L234]

[2] 
[https://github.com/apache/calcite/blob/986a2d579c8f9b9f08aa9bbbfe11efc4e7bb0809/core/src/main/java/org/apache/calcite/sql/pretty/SqlFormatOptions.java#L28]

[3] 
[https://github.com/apache/calcite/blob/986a2d579c8f9b9f08aa9bbbfe11efc4e7bb0809/core/src/test/java/org/apache/calcite/test/SqlValidatorTest.java#L1240]


was (Author: danny0405):
[~julianhyde]

I did more tests and i make sure we can remove the operator table in sql 
parser, but there are still some problems need to fix:
 # The SqlPrettyWriter has a flag [1][2] to control if we will force to add 
quotes to all identifiers when unparsing, with a default value *true*, if i 
make it false, there wound be about 300 test errors, most of them are caused by 
the quotes.
 # Few test fail cause some reserved word is not recognized as builtin function 
now without quoting, but i think this is expected behavior.[3]
 # The builtin operators would be quoted for un-validated SqlNode tree if a 
make SqlPrettyWriter#isQuoteAllIdentifiers return *true,* this behavior is 
different with before

So should we make SqlPrettyWriter#isQuoteAllIdentifiers default true or false ? 
Now we have the ability to unparse the SqlNode to sql just as original sql 
statement, Only for some Adaptors the quoted info is lost, and we may add a 
flag in SqlNode#toString to control the quotes behavior.

If we still make it true, 

 

[1] 
[https://github.com/apache/calcite/blob/986a2d579c8f9b9f08aa9bbbfe11efc4e7bb0809/core/src/main/java/org/apache/calcite/sql/pretty/SqlPrettyWriter.java#L234]

[2] 
[https://github.com/apache/calcite/blob/986a2d579c8f9b9f08aa9bbbfe11efc4e7bb0809/core/src/main/java/org/apache/calcite/sql/pretty/SqlFormatOptions.java#L28]

[3] 
https://github.com/apache/calcite/blob/986a2d579c8f9b9f08aa9bbbfe11efc4e7bb0809/core/src/test/java/org/apache/calcite/test/SqlValidatorTest.java#L1240

> 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