feat(flink): add queryStatement
This commit is contained in:
parent
9fc91a572a
commit
ba29949359
@ -129,20 +129,25 @@ dropFunction
|
|||||||
// Select statements
|
// Select statements
|
||||||
|
|
||||||
queryStatement
|
queryStatement
|
||||||
: valuesDefinition
|
: valuesDefinition | selectStatements queryOrderByDefinition? queryLimitDefinition? queryOffsetDefinition? queryFetchDefinition?
|
||||||
| (
|
;
|
||||||
selectStatement
|
|
||||||
|
selectStatements
|
||||||
|
: selectStatement
|
||||||
| selectWithoutFromDefinition
|
| selectWithoutFromDefinition
|
||||||
// | queryStatement UNION ALL? queryStatement
|
// | queryStatement UNION ALL? queryStatement
|
||||||
// | queryStatement EXCEPT queryStatement
|
// | queryStatement EXCEPT queryStatement
|
||||||
// | queryStatement INTERSECT queryStatement
|
// | queryStatement INTERSECT queryStatement
|
||||||
) queryOrderByDefinition? queryLimitDefinition? queryOffsetDefinition? queryFetchDefinition?
|
|
||||||
;
|
;
|
||||||
|
|
||||||
selectStatement
|
selectStatement
|
||||||
: SELECT (ALL | DISTINCT)?
|
: SELECT (ALL | DISTINCT)?
|
||||||
(ASTERISK_SIGN | projectItemDefinition (COMMA projectItemDefinition)*)
|
(ASTERISK_SIGN | projectItemDefinition (COMMA projectItemDefinition)*)
|
||||||
FROM tableExpression
|
FROM tableExpression
|
||||||
|
(WHERE booleanExpression)?
|
||||||
|
(GROUP BY groupItemDefinition (COMMA groupItemDefinition)*)
|
||||||
|
(HAVING booleanExpression)?
|
||||||
|
// (WINDOW windowName AS windowSpec (COMMA windowName AS windowSpec)*)?
|
||||||
;
|
;
|
||||||
|
|
||||||
projectItemDefinition // expression (AS? columnAlias)? | tableAlias . *
|
projectItemDefinition // expression (AS? columnAlias)? | tableAlias . *
|
||||||
@ -150,13 +155,62 @@ projectItemDefinition // expression (AS? columnAlias)? | tableAlias . *
|
|||||||
;
|
;
|
||||||
|
|
||||||
tableExpression
|
tableExpression
|
||||||
|
: tableReference (COMMA tableReference)*
|
||||||
|
| tableExpression NATURAL? (LEFT | RIGHT | FULL)? JOIN tableExpression joinCondition?
|
||||||
|
;
|
||||||
|
|
||||||
|
tableReference
|
||||||
|
: // tablePrimary matchRecognize? (AS? alias (LR_BRACKET columnAlias (COMMA columnAlias)* RR_BRACKET)?)?
|
||||||
|
;
|
||||||
|
|
||||||
|
// tablePrimary
|
||||||
|
// : TABLE? uid dynamicTableOptions?
|
||||||
|
// | LATERAL TABLE LR_BRACKET uid LR_BRACKET expression (COMMA expression)* RR_BRACKET RR_BRACKET
|
||||||
|
// | UNNEST LR_BRACKET expression RR_BRACKET
|
||||||
|
// ;
|
||||||
|
|
||||||
|
|
||||||
|
joinCondition // ON booleanExpression | USING LR_BRACKET column (COMMA column)* RR_BRACKET
|
||||||
:
|
:
|
||||||
;
|
;
|
||||||
|
|
||||||
selectWithoutFromDefinition
|
booleanExpression
|
||||||
:
|
:
|
||||||
;
|
;
|
||||||
|
|
||||||
|
groupItemDefinition
|
||||||
|
: expression
|
||||||
|
| LR_BRACKET RR_BRACKET
|
||||||
|
| LR_BRACKET expression (COMMA expression)* RR_BRACKET
|
||||||
|
| CUBE LR_BRACKET expression (COMMA expression)* RR_BRACKET
|
||||||
|
| ROLLUP LR_BRACKET expression (COMMA expression)* RR_BRACKET
|
||||||
|
| GROUPING SETS LR_BRACKET groupItemDefinition (COMMA groupItemDefinition)* RR_BRACKET
|
||||||
|
;
|
||||||
|
|
||||||
|
// windowRef
|
||||||
|
// : windowName | windowSpec
|
||||||
|
// ;
|
||||||
|
|
||||||
|
// windowSpec
|
||||||
|
// : windowName
|
||||||
|
// LR_BRACKET
|
||||||
|
// (ORDER BY orderItem (COMMA orderItem)*)?
|
||||||
|
// (PARTITION BY expression (COMMA expression)*)
|
||||||
|
// (
|
||||||
|
// RANGE numericOrIntervalExpression PRECEDING
|
||||||
|
// | ROWS numericExpression PRECEDING
|
||||||
|
// )?
|
||||||
|
// RR_BRACKET
|
||||||
|
// ;
|
||||||
|
|
||||||
|
selectWithoutFromDefinition
|
||||||
|
: SELECT (ALL | DISTINCT)? (ASTERISK_SIGN | projectItem (COMMA projectItem)*)
|
||||||
|
;
|
||||||
|
|
||||||
|
projectItem
|
||||||
|
: // expression (AS? columnAlias)? | tableAlias . *
|
||||||
|
;
|
||||||
|
|
||||||
queryOrderByDefinition
|
queryOrderByDefinition
|
||||||
: ORDER BY orderItemDefition (COMMA orderItemDefition)*
|
: ORDER BY orderItemDefition (COMMA orderItemDefition)*
|
||||||
;
|
;
|
||||||
@ -234,3 +288,7 @@ ifExists
|
|||||||
keyValueDefinition
|
keyValueDefinition
|
||||||
: DOUBLE_QUOTE_ID EQUAL_SYMBOL DOUBLE_QUOTE_ID
|
: DOUBLE_QUOTE_ID EQUAL_SYMBOL DOUBLE_QUOTE_ID
|
||||||
;
|
;
|
||||||
|
|
||||||
|
expression
|
||||||
|
:
|
||||||
|
;
|
Loading…
Reference in New Issue
Block a user