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

zoucao commented on FLINK-26401:
--------------------------------

Hi [~luoyuxia], I just pick 'date' at random, If we just want to provide 
compatibility for hive syntax, it really shouldn't be considered. But there 
exist other keywords which are marked reserved in flink but not in hive, for 
example, 'YEAR', 'MONTH', 'HOUR' etc...

> improve the compatibility for hive catalogView
> ----------------------------------------------
>
>                 Key: FLINK-26401
>                 URL: https://issues.apache.org/jira/browse/FLINK-26401
>             Project: Flink
>          Issue Type: Improvement
>          Components: Connectors / Hive
>            Reporter: zoucao
>            Priority: Major
>
> For now, many reserved keywords were kept for FlinkSQL[1], and some of them 
> are different from other bigdata systems, like spark[2], hive[3]. In this 
> context, users may be affected by the compatibility of various systems. 
> For example, the keyword 'DATE' is marked as reserved by Flink and Hive, but 
> not in spark. If the hive view is defined as 
> {code:java}
> select a, b, date from hive_tb where date = '2022-02-28' 
> {code}
> It will work well in spark, but in flink, the SqlParserException about ' SQL 
> parse failed. Encountered "date" at line xxx, column xxx ' will be thrown. 
> IIUC, If we do nothing to improve the compatibility, users must change the 
> query about the hive view to 
> {code:java}
> select a, b, `date` from hive_tb where `date` = '2022-02-28' 
> {code}
> , to make Flink work.
> I think we can add a converter to surround reserved keywords with backticks 
> before parsing.
> [1] 
> https://nightlies.apache.org/flink/flink-docs-master/docs/dev/table/sql/overview/
> [2] 
> https://spark.apache.org/docs/3.2.1/sql-ref-ansi-compliance.html#sql-keywords
> [3] 
> https://cwiki.apache.org/confluence/display/Hive/LanguageManual+DDL#LanguageManualDDL-Keywords,Non-reservedKeywordsandReservedKeywords



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

Reply via email to