Skip to content

fix(flink): #415 fix supporting json function's different type #416

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
May 8, 2025

Conversation

Cythia828
Copy link
Collaborator

@Cythia828 Cythia828 commented Apr 30, 2025

修复问题

#415

描述

发现的问题是在flinkSQL里使用JSON_VALUE 方法会飘红,在g4文件中之前归类过方法的使用类型,但发现JSON_VALUE 作为保留字关键字的方法名,并没有添加到保留字关键字方法名的枚举里去。
改动点:
1、顺着上面思路去检查同为保留字关键字在lexer文件中声明过的keyword 是否 都在parser文件中的保留字关键字方法名rule里枚举到了,必须保持两边是一致,顺着这条思路检查到了以下几个JSON方法名:

KW_JSON_VALUE
    | KW_JSON_EXISTS
    | KW_JSON_QUERY
    | KW_JSON_OBJECT
    | KW_JSON_OBJECTAGG
    | KW_JSON_ARRAY
    | KW_JSON_ARRAYAGG

2、但在JSON Functions里面,还有个特殊使用,就是xx IS JSON [ { VALUE | SCALAR | ARRAY | OBJECT } ],这种使用是之前没有声明过的,所以补全了这种用法
3、补全了以上语法变动的单测SQL

参考

  1. flinkSQL关键字:https://calcite.apache.org/docs/reference.html#keywords
  2. flinkSQL内置方法-JSON Functions: https://nightlies.apache.org/flink/flink-docs-release-1.16/docs/dev/table/functions/systemfunctions/#json-functions

Copy link
Collaborator

@LuckyFBB LuckyFBB left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

+1

@Cythia828 Cythia828 added bug Something isn't working Next Version labels May 8, 2025
@mumiao mumiao merged commit 03a53d3 into DTStack:main May 8, 2025
6 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working Next Version
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants