[
https://issues.apache.org/jira/browse/CALCITE-1241?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15289779#comment-15289779
]
Julian Hyde commented on CALCITE-1241:
--------------------------------------
SQL syntax unfortunately allows expressions and queries in the same context and
there is no fixed lookahead that can distinguish which it is going to be. For
example, {{x IN (((((((select 1 union ...) minus ... ) ... )))}}
I don't know whether JavaCC has a performance difference depending on how you
order the alternatives. If you can change the parser such that it performs
better and gives the same results, have at it! Feel free to devise (or
generate) queries where parser performance sucks.
Your comments underscore the value of reserved keywords. I agree. They make the
parser's life much easier (and error messages easier to understand).
Unfortunately it is hard to justify adding reserved keywords. Generally we just
take the list that comes with the SQL standard.
> Add a freemarker variable for adding non reserved keywords to Parser.jj
> template
> --------------------------------------------------------------------------------
>
> Key: CALCITE-1241
> URL: https://issues.apache.org/jira/browse/CALCITE-1241
> Project: Calcite
> Issue Type: Improvement
> Components: core
> Reporter: Venki Korukanti
> Assignee: Julian Hyde
> Fix For: 1.8.0
>
>
> Currently Calcite parser allows customizing parser grammar for supporting new
> Sql constructs (ex. {{SHOW TABLES}} or {{CREATE TABLE ... AS QUERY}}) through
> freemarker template variables. There is a freemarker template variable to
> allow new keywords, but all these keywords are added as reserved keywords
> which are not allowed as identifiers unless escaped with {{`}} (or configured
> casing character).
> This JIRA is to add a freemarker template variable for adding non reserved
> keywords list.
--
This message was sent by Atlassian JIRA
(v6.3.4#6332)