File tree Expand file tree Collapse file tree 6 files changed +4248
-2761
lines changed
test/parser/flink/syntax/fixtures Expand file tree Collapse file tree 6 files changed +4248
-2761
lines changed Original file line number Diff line number Diff line change @@ -738,6 +738,15 @@ predicate
738738 | KW_IS KW_JSON (KW_VALUE | KW_ARRAY | identifier)?
739739 ;
740740
741+ jsonFunctionBranch
742+ : KW_NULL
743+ | KW_EMPTY KW_ARRAY
744+ | KW_EMPTY uid
745+ | KW_TRUE
746+ | KW_FALSE
747+ | KW_UNKNOWN
748+ ;
749+
741750likePredicate
742751 : KW_NOT ? kind=KW_LIKE quantifier=(KW_ANY | KW_ALL ) (
743752 LR_BRACKET RR_BRACKET
@@ -761,6 +770,8 @@ functionCallExpression
761770 : reservedKeywordsNoParamsUsedAsFuncName
762771 | functionNameAndParams
763772 | functionNameWithParams LR_BRACKET (setQuantifier? functionParam (COMMA functionParam)*)? RR_BRACKET
773+ | KW_JSON_ARRAY LR_BRACKET (jsonArrayParams (COMMA jsonArrayParams)*)? RR_BRACKET
774+ | KW_JSON_OBJECT LR_BRACKET (jsonObjectParams (COMMA jsonObjectParams)*)? RR_BRACKET
764775 ;
765776
766777primaryExpression
@@ -824,7 +835,34 @@ functionParam
824835 : reservedKeywordsUsedAsFuncParam
825836 | timeIntervalUnit
826837 | timePointUnit
827- | expression
838+ | jsonValueParams
839+ | jsonQueryParams
840+ ;
841+
842+ jsonValueParams
843+ : expression (columnNamePath columnType)? (
844+ (uid | KW_NULL | KW_DEFAULT valueExpression) KW_ON KW_EMPTY
845+ )? ((uid | KW_NULL | KW_DEFAULT valueExpression) KW_ON uid)?
846+ ;
847+
848+ jsonQueryParams
849+ : expression columnNamePath? ((KW_WITHOUT | KW_WITH uid?) KW_ARRAY ? uid)? (
850+ jsonFunctionBranch KW_ON KW_EMPTY
851+ )? (jsonFunctionBranch KW_ON uid)?
852+ ;
853+
854+ // JSON 函数只能在 JSON_OBJECT 函数中使用
855+ jsonObjectParams
856+ : (
857+ KW_KEY ? columnNamePath KW_VALUE ? (
858+ valueExpression
859+ | KW_JSON LR_BRACKET (valueExpression)* RR_BRACKET
860+ )
861+ )* ((KW_NULL | uid) KW_ON KW_NULL )?
862+ ;
863+
864+ jsonArrayParams
865+ : valueExpression* ((KW_NULL | uid) KW_ON KW_NULL )?
828866 ;
829867
830868dereferenceDefinition
Load Diff Large diffs are not rendered by default.
You can’t perform that action at this time.
0 commit comments