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

Xurenhe commented on CALCITE-5029:
----------------------------------

[~nobigo] Thanks for your reply.

It need be a numeric SQL literal, when this token's characters are only numeric.

If you want 123 to be identifier, you should wrap it with quoting.
{code:java}
select 1 as 123;{code}
Mysql's parser will parse this sql fail. Because 123 couldn't be an identifier.

> 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)

Reply via email to