You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@calcite.apache.org by "Andrei Sereda (Jira)" <ji...@apache.org> on 2020/08/22 18:49:03 UTC
[jira] [Closed] (CALCITE-4115) Improve the prompt of using SQL
keywords for sql parser
[ https://issues.apache.org/jira/browse/CALCITE-4115?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Andrei Sereda closed CALCITE-4115.
----------------------------------
Released as part of 1.25 ([68b02dfd4af15bc|https://github.com/apache/calcite/commit/68b02dfd4af15bc94a91a0cd2a30655d04439555])
> Improve the prompt of using SQL keywords for sql parser
> -------------------------------------------------------
>
> Key: CALCITE-4115
> URL: https://issues.apache.org/jira/browse/CALCITE-4115
> Project: Calcite
> Issue Type: Improvement
> Components: core
> Affects Versions: 1.23.0
> Reporter: Danny Chen
> Assignee: Danny Chen
> Priority: Major
> Labels: pull-request-available
> Fix For: 1.25.0
>
> Time Spent: 1h 50m
> Remaining Estimate: 0h
>
> Current when a user uses a reserved-keyword in the SQL, for example:
> {code:sql}
> select DEFAULT from emp;
> {code}
> the parser would report with error message:
> {noformat}
> Encountered "DEFAULT" at line 1, column 8.
> Was expecting one of:
> "ABS" ...
> "ALL" ...
> "ARRAY" ...
> "AVG" ...
> "CARDINALITY" ...
> "CASE" ...
> "CAST" ...
> "CEIL" ...
> "CEILING" ...
> "CHAR_LENGTH" ...
> "CHARACTER_LENGTH" ...
> {noformat}
> It is hard to infer that the DEFAULT is actually a reserved-keyword, we can promote the message to make it more clear.
> For example, in SQL-SERVER, if you use such a keyword, the server reports "Incorrect syntax near the keyword 'DEFAULT'", which is very clear that the DEFAULT is a keyword.
> Based on the SQL-SERVER message, i would suggest to also report the position with a suggested fix solution, the template is like this:
> {code:java}
> Incorrect syntax near the keyword {keyword} at line {line_number},
> column {column_number}.\n
> Either uses a non-reserved keyword or quotes the keyword with
> character: {quoting_character}.
> {code}
> We would tell user that the mistake is a keyword and its position, also how to fix it.
--
This message was sent by Atlassian Jira
(v8.3.4#803005)