[
https://issues.apache.org/jira/browse/FLINK-26401?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17500454#comment-17500454
]
luoyuxia commented on FLINK-26401:
----------------------------------
[~zoucao] In such confict case, you should use the hive parse. But anyway, I
think it's a special case, in normal case, use default parser or hive parser
depends on your need. If you want to use the feature of hive dialect, you
should use hive parser, and vice versa.
It's unavoidable that the reserved keywords in flink dialect are different
from the keywords in hive dialect.
> 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)