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

[jira] [Comment Edited] (CALCITE-5029) Babel parser support identifier starting with number

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

Xurenhe edited comment on CALCITE-5029 at 3/11/22, 3:17 AM:
------------------------------------------------------------

Define a custom identifier token in the basic {*}Parser.jj{*}, and expand it in the babel's {*}config.fmpp{*}{*}{*}

Hi all
PR is ready, please review it. Thanks

PR: [https://github.com/apache/calcite/pull/2737/files]


was (Author: wojustme):
Hi all
PR is ready, please review it. Thanks

PR: https://github.com/apache/calcite/pull/2737/files

> Babel parser support identifier starting with number
> ----------------------------------------------------
>
>                 Key: CALCITE-5029
>                 URL: https://issues.apache.org/jira/browse/CALCITE-5029
>             Project: Calcite
>          Issue Type: Improvement
>          Components: babel
>            Reporter: Xurenhe
>            Assignee: Xurenhe
>            Priority: Major
>              Labels: pull-request-available
>          Time Spent: 20m
>  Remaining Estimate: 0h
>
> MySQL support identifier starting with number, which is without any quoting.
>  * test case
> {code:java}
> @Test void testIdentifierStartWithNumber() {
> final String sql =
> "select 1_c1 from (select deptno as 1_c1 from emp)";
> sql(sql).ok();
> } {code}
>  * Exception
> {code:java}
> java.lang.RuntimeException:
> org.apache.calcite.sql.parser.SqlParseException: Encountered "1" at line 1,
> column 36.
> Was expecting one of:
> <QUOTED_STRING> ...
> <BRACKET_QUOTED_IDENTIFIER> ...
> <QUOTED_IDENTIFIER> ...
> <BACK_QUOTED_IDENTIFIER> ...
> <BIG_QUERY_BACK_QUOTED_IDENTIFIER> ...
> <HYPHENATED_IDENTIFIER> ...
> <IDENTIFIER> ...
> <UNICODE_QUOTED_IDENTIFIER> ...
> at
> org.apache.calcite.sql.parser.SqlParseException.writeReplace(SqlParseException.java:171) {code}
> ----
> As discuss of email's group: [https://lists.apache.org/thread/yj905ht2t2gwnndgyw5ks8nh0nftlyoo]
> We could support it in babel's parser.



--
This message was sent by Atlassian Jira
(v8.20.1#820001)