Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
简介
重新整理 FlinkSQL 关键字
主要变更
reservedKeywords
规则和columnAlias
规则,因为它们没有被使用;关于关键字重新整理的说明
为什么要重新整理关键字?
在实际运行中发现,目前已有的关键字规则与FlinkSQL 实际运行情况有差异,当前正在使用的关键字规则都来源于 FlinkSQL 官方文档 但是实际上不准。
新的关键字集合以什么为参考?
Flink 官方使用 calcite 作为 SQL 解析器,新的关键字列表是从 Calcite 官方文档与Flink 源码中汇总而来。
具体汇总逻辑如下:
nonReservedKeywords
规则相关说明有一部分关键字在 parser rule 中有应用,比如使用频率很高的
CATALOG
、VIEW
,但是在上述集合中不存在,这些关键字也都作为非保留关键字被添加到关键字集合中,这些关键字可以作为普通的标识符使用(已经在 Flink 引擎中验证过了)reservedKeywordsUsedAsFuncName
规则相关说明Flink 内置了很多函数(Flink Built-in Functions),这些函数的函数名和Flink的关键字有相当一部分相同,所以必须声明一条规则,使这些冲突的关键字也能作为函数名。
reservedKeywordsUsedAsFuncParam
也同理。