support MATCH_RECOGNIZE

This commit is contained in:
HSunboy 2019-10-21 16:52:16 +08:00
parent eb0d32751b
commit 2962271262
14 changed files with 14821 additions and 13946 deletions

File diff suppressed because it is too large Load Diff

View File

@ -776,6 +776,72 @@ sqlListener.prototype.enterTableValuedFunction = function (ctx) {
// Exit a parse tree produced by sqlParser#tableValuedFunction.
sqlListener.prototype.exitTableValuedFunction = function (ctx) {
};
// Enter a parse tree produced by sqlParser#matchRecognize.
sqlListener.prototype.enterMatchRecognize = function (ctx) {
};
// Exit a parse tree produced by sqlParser#matchRecognize.
sqlListener.prototype.exitMatchRecognize = function (ctx) {
};
// Enter a parse tree produced by sqlParser#measureColumn.
sqlListener.prototype.enterMeasureColumn = function (ctx) {
};
// Exit a parse tree produced by sqlParser#measureColumn.
sqlListener.prototype.exitMeasureColumn = function (ctx) {
};
// Enter a parse tree produced by sqlParser#condition1.
sqlListener.prototype.enterCondition1 = function (ctx) {
};
// Exit a parse tree produced by sqlParser#condition1.
sqlListener.prototype.exitCondition1 = function (ctx) {
};
// Enter a parse tree produced by sqlParser#variable.
sqlListener.prototype.enterVariable = function (ctx) {
};
// Exit a parse tree produced by sqlParser#variable.
sqlListener.prototype.exitVariable = function (ctx) {
};
// Enter a parse tree produced by sqlParser#pattern1.
sqlListener.prototype.enterPattern1 = function (ctx) {
};
// Exit a parse tree produced by sqlParser#pattern1.
sqlListener.prototype.exitPattern1 = function (ctx) {
};
// Enter a parse tree produced by sqlParser#patternTerm.
sqlListener.prototype.enterPatternTerm = function (ctx) {
};
// Exit a parse tree produced by sqlParser#patternTerm.
sqlListener.prototype.exitPatternTerm = function (ctx) {
};
// Enter a parse tree produced by sqlParser#patternFactor.
sqlListener.prototype.enterPatternFactor = function (ctx) {
};
// Exit a parse tree produced by sqlParser#patternFactor.
sqlListener.prototype.exitPatternFactor = function (ctx) {
};
// Enter a parse tree produced by sqlParser#patternQuantifier.
sqlListener.prototype.enterPatternQuantifier = function (ctx) {
};
// Exit a parse tree produced by sqlParser#patternQuantifier.
sqlListener.prototype.exitPatternQuantifier = function (ctx) {
};
// Enter a parse tree produced by sqlParser#minRepeat.
sqlListener.prototype.enterMinRepeat = function (ctx) {
};
// Exit a parse tree produced by sqlParser#minRepeat.
sqlListener.prototype.exitMinRepeat = function (ctx) {
};
// Enter a parse tree produced by sqlParser#maxRepeat.
sqlListener.prototype.enterMaxRepeat = function (ctx) {
};
// Exit a parse tree produced by sqlParser#maxRepeat.
sqlListener.prototype.exitMaxRepeat = function (ctx) {
};
// Enter a parse tree produced by sqlParser#repeat.
sqlListener.prototype.enterRepeat = function (ctx) {
};
// Exit a parse tree produced by sqlParser#repeat.
sqlListener.prototype.exitRepeat = function (ctx) {
};
// Enter a parse tree produced by sqlParser#inlineTable.
sqlListener.prototype.enterInlineTable = function (ctx) {
};

File diff suppressed because one or more lines are too long

View File

@ -520,6 +520,50 @@ sqlVisitor.prototype.visitInlineTableDefault2 = function (ctx) {
sqlVisitor.prototype.visitTableValuedFunction = function (ctx) {
return this.visitChildren(ctx);
};
// Visit a parse tree produced by sqlParser#matchRecognize.
sqlVisitor.prototype.visitMatchRecognize = function (ctx) {
return this.visitChildren(ctx);
};
// Visit a parse tree produced by sqlParser#measureColumn.
sqlVisitor.prototype.visitMeasureColumn = function (ctx) {
return this.visitChildren(ctx);
};
// Visit a parse tree produced by sqlParser#condition1.
sqlVisitor.prototype.visitCondition1 = function (ctx) {
return this.visitChildren(ctx);
};
// Visit a parse tree produced by sqlParser#variable.
sqlVisitor.prototype.visitVariable = function (ctx) {
return this.visitChildren(ctx);
};
// Visit a parse tree produced by sqlParser#pattern1.
sqlVisitor.prototype.visitPattern1 = function (ctx) {
return this.visitChildren(ctx);
};
// Visit a parse tree produced by sqlParser#patternTerm.
sqlVisitor.prototype.visitPatternTerm = function (ctx) {
return this.visitChildren(ctx);
};
// Visit a parse tree produced by sqlParser#patternFactor.
sqlVisitor.prototype.visitPatternFactor = function (ctx) {
return this.visitChildren(ctx);
};
// Visit a parse tree produced by sqlParser#patternQuantifier.
sqlVisitor.prototype.visitPatternQuantifier = function (ctx) {
return this.visitChildren(ctx);
};
// Visit a parse tree produced by sqlParser#minRepeat.
sqlVisitor.prototype.visitMinRepeat = function (ctx) {
return this.visitChildren(ctx);
};
// Visit a parse tree produced by sqlParser#maxRepeat.
sqlVisitor.prototype.visitMaxRepeat = function (ctx) {
return this.visitChildren(ctx);
};
// Visit a parse tree produced by sqlParser#repeat.
sqlVisitor.prototype.visitRepeat = function (ctx) {
return this.visitChildren(ctx);
};
// Visit a parse tree produced by sqlParser#inlineTable.
sqlVisitor.prototype.visitInlineTable = function (ctx) {
return this.visitChildren(ctx);

View File

@ -1,6 +1,6 @@
{
"name": "dt-sql-parser",
"version": "2.0.5",
"version": "2.0.6",
"description": "sql,hive,parser ",
"keywords": [
"hive",

File diff suppressed because one or more lines are too long

View File

@ -1,490 +0,0 @@
T__0=1
T__1=2
T__2=3
T__3=4
T__4=5
T__5=6
T__6=7
T__7=8
T__8=9
T__9=10
SELECT=11
FROM=12
ADD=13
AS=14
ALL=15
ANY=16
DISTINCT=17
WHERE=18
GROUP=19
BY=20
GROUPING=21
SETS=22
CUBE=23
ROLLUP=24
ORDER=25
HAVING=26
LIMIT=27
AT=28
OR=29
AND=30
IN=31
NOT=32
NO=33
EXISTS=34
BETWEEN=35
LIKE=36
RLIKE=37
IS=38
NULL=39
TRUE=40
FALSE=41
NULLS=42
ASC=43
DESC=44
FOR=45
INTERVAL=46
CASE=47
WHEN=48
THEN=49
ELSE=50
END=51
JOIN=52
CROSS=53
OUTER=54
INNER=55
LEFT=56
SEMI=57
RIGHT=58
FULL=59
NATURAL=60
ON=61
PIVOT=62
LATERAL=63
WINDOW=64
OVER=65
PARTITION=66
RANGE=67
ROWS=68
UNBOUNDED=69
PRECEDING=70
FOLLOWING=71
CURRENT=72
FIRST=73
AFTER=74
LAST=75
ROW=76
WITH=77
VALUES=78
CREATE=79
TABLE=80
DIRECTORY=81
VIEW=82
REPLACE=83
INSERT=84
DELETE=85
INTO=86
DESCRIBE=87
EXPLAIN=88
FORMAT=89
LOGICAL=90
CODEGEN=91
COST=92
CAST=93
SHOW=94
TABLES=95
COLUMNS=96
COLUMN=97
USE=98
PARTITIONS=99
FUNCTIONS=100
DROP=101
UNION=102
EXCEPT=103
SETMINUS=104
INTERSECT=105
TO=106
TABLESAMPLE=107
STRATIFY=108
ALTER=109
RENAME=110
ARRAY=111
MAP=112
STRUCT=113
COMMENT=114
SET=115
RESET=116
DATA=117
START=118
TRANSACTION=119
COMMIT=120
ROLLBACK=121
MACRO=122
IGNORE=123
BOTH=124
LEADING=125
TRAILING=126
IF=127
POSITION=128
EXTRACT=129
EQ=130
NSEQ=131
NEQ=132
NEQJ=133
LT=134
LTE=135
GT=136
GTE=137
PLUS=138
MINUS=139
ASTERISK=140
SLASH=141
PERCENT=142
DIV=143
TILDE=144
AMPERSAND=145
PIPE=146
CONCAT_PIPE=147
HAT=148
PERCENTLIT=149
BUCKET=150
OUT=151
OF=152
SORT=153
CLUSTER=154
DISTRIBUTE=155
OVERWRITE=156
TRANSFORM=157
REDUCE=158
USING=159
SERDE=160
SERDEPROPERTIES=161
RECORDREADER=162
RECORDWRITER=163
DELIMITED=164
FIELDS=165
TERMINATED=166
COLLECTION=167
ITEMS=168
KEYS=169
ESCAPED=170
LINES=171
SEPARATED=172
FUNCTION=173
EXTENDED=174
REFRESH=175
CLEAR=176
CACHE=177
UNCACHE=178
LAZY=179
FORMATTED=180
GLOBAL=181
TEMPORARY=182
OPTIONS=183
UNSET=184
TBLPROPERTIES=185
DBPROPERTIES=186
BUCKETS=187
SKEWED=188
STORED=189
DIRECTORIES=190
LOCATION=191
EXCHANGE=192
ARCHIVE=193
UNARCHIVE=194
FILEFORMAT=195
TOUCH=196
COMPACT=197
CONCATENATE=198
CHANGE=199
CASCADE=200
RESTRICT=201
CLUSTERED=202
SORTED=203
PURGE=204
INPUTFORMAT=205
OUTPUTFORMAT=206
DATABASE=207
DATABASES=208
DFS=209
TRUNCATE=210
ANALYZE=211
COMPUTE=212
LIST=213
STATISTICS=214
PARTITIONED=215
EXTERNAL=216
DEFINED=217
REVOKE=218
GRANT=219
LOCK=220
UNLOCK=221
MSCK=222
REPAIR=223
RECOVER=224
EXPORT=225
IMPORT=226
LOAD=227
ROLE=228
ROLES=229
COMPACTIONS=230
PRINCIPALS=231
TRANSACTIONS=232
INDEX=233
INDEXES=234
LOCKS=235
OPTION=236
ANTI=237
LOCAL=238
INPATH=239
WATERMARK=240
UNNEST=241
STRING=242
BIGINT_LITERAL=243
SMALLINT_LITERAL=244
TINYINT_LITERAL=245
INTEGER_VALUE=246
DECIMAL_VALUE=247
DOUBLE_LITERAL=248
BIGDECIMAL_LITERAL=249
IDENTIFIER=250
BACKQUOTED_IDENTIFIER=251
SIMPLE_COMMENT=252
BRACKETED_EMPTY_COMMENT=253
BRACKETED_COMMENT=254
WS=255
UNRECOGNIZED=256
'('=1
')'=2
'.'=3
','=4
'/*+'=5
'*/'=6
'->'=7
'['=8
']'=9
':'=10
'SELECT'=11
'FROM'=12
'ADD'=13
'AS'=14
'ALL'=15
'ANY'=16
'DISTINCT'=17
'WHERE'=18
'GROUP'=19
'BY'=20
'GROUPING'=21
'SETS'=22
'CUBE'=23
'ROLLUP'=24
'ORDER'=25
'HAVING'=26
'LIMIT'=27
'AT'=28
'OR'=29
'AND'=30
'IN'=31
'NO'=33
'EXISTS'=34
'BETWEEN'=35
'LIKE'=36
'IS'=38
'NULL'=39
'TRUE'=40
'FALSE'=41
'NULLS'=42
'ASC'=43
'DESC'=44
'FOR'=45
'INTERVAL'=46
'CASE'=47
'WHEN'=48
'THEN'=49
'ELSE'=50
'END'=51
'JOIN'=52
'CROSS'=53
'OUTER'=54
'INNER'=55
'LEFT'=56
'SEMI'=57
'RIGHT'=58
'FULL'=59
'NATURAL'=60
'ON'=61
'PIVOT'=62
'LATERAL'=63
'WINDOW'=64
'OVER'=65
'PARTITION'=66
'RANGE'=67
'ROWS'=68
'UNBOUNDED'=69
'PRECEDING'=70
'FOLLOWING'=71
'CURRENT'=72
'FIRST'=73
'AFTER'=74
'LAST'=75
'ROW'=76
'WITH'=77
'VALUES'=78
'CREATE'=79
'TABLE'=80
'DIRECTORY'=81
'VIEW'=82
'REPLACE'=83
'INSERT'=84
'DELETE'=85
'INTO'=86
'DESCRIBE'=87
'EXPLAIN'=88
'FORMAT'=89
'LOGICAL'=90
'CODEGEN'=91
'COST'=92
'CAST'=93
'SHOW'=94
'TABLES'=95
'COLUMNS'=96
'COLUMN'=97
'USE'=98
'PARTITIONS'=99
'FUNCTIONS'=100
'DROP'=101
'UNION'=102
'EXCEPT'=103
'MINUS'=104
'INTERSECT'=105
'TO'=106
'TABLESAMPLE'=107
'STRATIFY'=108
'ALTER'=109
'RENAME'=110
'ARRAY'=111
'MAP'=112
'STRUCT'=113
'COMMENT'=114
'SET'=115
'RESET'=116
'DATA'=117
'START'=118
'TRANSACTION'=119
'COMMIT'=120
'ROLLBACK'=121
'MACRO'=122
'IGNORE'=123
'BOTH'=124
'LEADING'=125
'TRAILING'=126
'IF'=127
'POSITION'=128
'EXTRACT'=129
'<=>'=131
'<>'=132
'!='=133
'<'=134
'>'=136
'+'=138
'-'=139
'*'=140
'/'=141
'%'=142
'DIV'=143
'~'=144
'&'=145
'|'=146
'||'=147
'^'=148
'PERCENT'=149
'BUCKET'=150
'OUT'=151
'OF'=152
'SORT'=153
'CLUSTER'=154
'DISTRIBUTE'=155
'OVERWRITE'=156
'TRANSFORM'=157
'REDUCE'=158
'USING'=159
'SERDE'=160
'SERDEPROPERTIES'=161
'RECORDREADER'=162
'RECORDWRITER'=163
'DELIMITED'=164
'FIELDS'=165
'TERMINATED'=166
'COLLECTION'=167
'ITEMS'=168
'KEYS'=169
'ESCAPED'=170
'LINES'=171
'SEPARATED'=172
'FUNCTION'=173
'EXTENDED'=174
'REFRESH'=175
'CLEAR'=176
'CACHE'=177
'UNCACHE'=178
'LAZY'=179
'FORMATTED'=180
'GLOBAL'=181
'OPTIONS'=183
'UNSET'=184
'TBLPROPERTIES'=185
'DBPROPERTIES'=186
'BUCKETS'=187
'SKEWED'=188
'STORED'=189
'DIRECTORIES'=190
'LOCATION'=191
'EXCHANGE'=192
'ARCHIVE'=193
'UNARCHIVE'=194
'FILEFORMAT'=195
'TOUCH'=196
'COMPACT'=197
'CONCATENATE'=198
'CHANGE'=199
'CASCADE'=200
'RESTRICT'=201
'CLUSTERED'=202
'SORTED'=203
'PURGE'=204
'INPUTFORMAT'=205
'OUTPUTFORMAT'=206
'DFS'=209
'TRUNCATE'=210
'ANALYZE'=211
'COMPUTE'=212
'LIST'=213
'STATISTICS'=214
'PARTITIONED'=215
'EXTERNAL'=216
'DEFINED'=217
'REVOKE'=218
'GRANT'=219
'LOCK'=220
'UNLOCK'=221
'MSCK'=222
'REPAIR'=223
'RECOVER'=224
'EXPORT'=225
'IMPORT'=226
'LOAD'=227
'ROLE'=228
'ROLES'=229
'COMPACTIONS'=230
'PRINCIPALS'=231
'TRANSACTIONS'=232
'INDEX'=233
'INDEXES'=234
'LOCKS'=235
'OPTION'=236
'ANTI'=237
'LOCAL'=238
'INPATH'=239
'WATERMARK'=240
'UNNEST'=241
'/**/'=253

File diff suppressed because one or more lines are too long

File diff suppressed because it is too large Load Diff

View File

@ -1,490 +0,0 @@
T__0=1
T__1=2
T__2=3
T__3=4
T__4=5
T__5=6
T__6=7
T__7=8
T__8=9
T__9=10
SELECT=11
FROM=12
ADD=13
AS=14
ALL=15
ANY=16
DISTINCT=17
WHERE=18
GROUP=19
BY=20
GROUPING=21
SETS=22
CUBE=23
ROLLUP=24
ORDER=25
HAVING=26
LIMIT=27
AT=28
OR=29
AND=30
IN=31
NOT=32
NO=33
EXISTS=34
BETWEEN=35
LIKE=36
RLIKE=37
IS=38
NULL=39
TRUE=40
FALSE=41
NULLS=42
ASC=43
DESC=44
FOR=45
INTERVAL=46
CASE=47
WHEN=48
THEN=49
ELSE=50
END=51
JOIN=52
CROSS=53
OUTER=54
INNER=55
LEFT=56
SEMI=57
RIGHT=58
FULL=59
NATURAL=60
ON=61
PIVOT=62
LATERAL=63
WINDOW=64
OVER=65
PARTITION=66
RANGE=67
ROWS=68
UNBOUNDED=69
PRECEDING=70
FOLLOWING=71
CURRENT=72
FIRST=73
AFTER=74
LAST=75
ROW=76
WITH=77
VALUES=78
CREATE=79
TABLE=80
DIRECTORY=81
VIEW=82
REPLACE=83
INSERT=84
DELETE=85
INTO=86
DESCRIBE=87
EXPLAIN=88
FORMAT=89
LOGICAL=90
CODEGEN=91
COST=92
CAST=93
SHOW=94
TABLES=95
COLUMNS=96
COLUMN=97
USE=98
PARTITIONS=99
FUNCTIONS=100
DROP=101
UNION=102
EXCEPT=103
SETMINUS=104
INTERSECT=105
TO=106
TABLESAMPLE=107
STRATIFY=108
ALTER=109
RENAME=110
ARRAY=111
MAP=112
STRUCT=113
COMMENT=114
SET=115
RESET=116
DATA=117
START=118
TRANSACTION=119
COMMIT=120
ROLLBACK=121
MACRO=122
IGNORE=123
BOTH=124
LEADING=125
TRAILING=126
IF=127
POSITION=128
EXTRACT=129
EQ=130
NSEQ=131
NEQ=132
NEQJ=133
LT=134
LTE=135
GT=136
GTE=137
PLUS=138
MINUS=139
ASTERISK=140
SLASH=141
PERCENT=142
DIV=143
TILDE=144
AMPERSAND=145
PIPE=146
CONCAT_PIPE=147
HAT=148
PERCENTLIT=149
BUCKET=150
OUT=151
OF=152
SORT=153
CLUSTER=154
DISTRIBUTE=155
OVERWRITE=156
TRANSFORM=157
REDUCE=158
USING=159
SERDE=160
SERDEPROPERTIES=161
RECORDREADER=162
RECORDWRITER=163
DELIMITED=164
FIELDS=165
TERMINATED=166
COLLECTION=167
ITEMS=168
KEYS=169
ESCAPED=170
LINES=171
SEPARATED=172
FUNCTION=173
EXTENDED=174
REFRESH=175
CLEAR=176
CACHE=177
UNCACHE=178
LAZY=179
FORMATTED=180
GLOBAL=181
TEMPORARY=182
OPTIONS=183
UNSET=184
TBLPROPERTIES=185
DBPROPERTIES=186
BUCKETS=187
SKEWED=188
STORED=189
DIRECTORIES=190
LOCATION=191
EXCHANGE=192
ARCHIVE=193
UNARCHIVE=194
FILEFORMAT=195
TOUCH=196
COMPACT=197
CONCATENATE=198
CHANGE=199
CASCADE=200
RESTRICT=201
CLUSTERED=202
SORTED=203
PURGE=204
INPUTFORMAT=205
OUTPUTFORMAT=206
DATABASE=207
DATABASES=208
DFS=209
TRUNCATE=210
ANALYZE=211
COMPUTE=212
LIST=213
STATISTICS=214
PARTITIONED=215
EXTERNAL=216
DEFINED=217
REVOKE=218
GRANT=219
LOCK=220
UNLOCK=221
MSCK=222
REPAIR=223
RECOVER=224
EXPORT=225
IMPORT=226
LOAD=227
ROLE=228
ROLES=229
COMPACTIONS=230
PRINCIPALS=231
TRANSACTIONS=232
INDEX=233
INDEXES=234
LOCKS=235
OPTION=236
ANTI=237
LOCAL=238
INPATH=239
WATERMARK=240
UNNEST=241
STRING=242
BIGINT_LITERAL=243
SMALLINT_LITERAL=244
TINYINT_LITERAL=245
INTEGER_VALUE=246
DECIMAL_VALUE=247
DOUBLE_LITERAL=248
BIGDECIMAL_LITERAL=249
IDENTIFIER=250
BACKQUOTED_IDENTIFIER=251
SIMPLE_COMMENT=252
BRACKETED_EMPTY_COMMENT=253
BRACKETED_COMMENT=254
WS=255
UNRECOGNIZED=256
'('=1
')'=2
'.'=3
','=4
'/*+'=5
'*/'=6
'->'=7
'['=8
']'=9
':'=10
'SELECT'=11
'FROM'=12
'ADD'=13
'AS'=14
'ALL'=15
'ANY'=16
'DISTINCT'=17
'WHERE'=18
'GROUP'=19
'BY'=20
'GROUPING'=21
'SETS'=22
'CUBE'=23
'ROLLUP'=24
'ORDER'=25
'HAVING'=26
'LIMIT'=27
'AT'=28
'OR'=29
'AND'=30
'IN'=31
'NO'=33
'EXISTS'=34
'BETWEEN'=35
'LIKE'=36
'IS'=38
'NULL'=39
'TRUE'=40
'FALSE'=41
'NULLS'=42
'ASC'=43
'DESC'=44
'FOR'=45
'INTERVAL'=46
'CASE'=47
'WHEN'=48
'THEN'=49
'ELSE'=50
'END'=51
'JOIN'=52
'CROSS'=53
'OUTER'=54
'INNER'=55
'LEFT'=56
'SEMI'=57
'RIGHT'=58
'FULL'=59
'NATURAL'=60
'ON'=61
'PIVOT'=62
'LATERAL'=63
'WINDOW'=64
'OVER'=65
'PARTITION'=66
'RANGE'=67
'ROWS'=68
'UNBOUNDED'=69
'PRECEDING'=70
'FOLLOWING'=71
'CURRENT'=72
'FIRST'=73
'AFTER'=74
'LAST'=75
'ROW'=76
'WITH'=77
'VALUES'=78
'CREATE'=79
'TABLE'=80
'DIRECTORY'=81
'VIEW'=82
'REPLACE'=83
'INSERT'=84
'DELETE'=85
'INTO'=86
'DESCRIBE'=87
'EXPLAIN'=88
'FORMAT'=89
'LOGICAL'=90
'CODEGEN'=91
'COST'=92
'CAST'=93
'SHOW'=94
'TABLES'=95
'COLUMNS'=96
'COLUMN'=97
'USE'=98
'PARTITIONS'=99
'FUNCTIONS'=100
'DROP'=101
'UNION'=102
'EXCEPT'=103
'MINUS'=104
'INTERSECT'=105
'TO'=106
'TABLESAMPLE'=107
'STRATIFY'=108
'ALTER'=109
'RENAME'=110
'ARRAY'=111
'MAP'=112
'STRUCT'=113
'COMMENT'=114
'SET'=115
'RESET'=116
'DATA'=117
'START'=118
'TRANSACTION'=119
'COMMIT'=120
'ROLLBACK'=121
'MACRO'=122
'IGNORE'=123
'BOTH'=124
'LEADING'=125
'TRAILING'=126
'IF'=127
'POSITION'=128
'EXTRACT'=129
'<=>'=131
'<>'=132
'!='=133
'<'=134
'>'=136
'+'=138
'-'=139
'*'=140
'/'=141
'%'=142
'DIV'=143
'~'=144
'&'=145
'|'=146
'||'=147
'^'=148
'PERCENT'=149
'BUCKET'=150
'OUT'=151
'OF'=152
'SORT'=153
'CLUSTER'=154
'DISTRIBUTE'=155
'OVERWRITE'=156
'TRANSFORM'=157
'REDUCE'=158
'USING'=159
'SERDE'=160
'SERDEPROPERTIES'=161
'RECORDREADER'=162
'RECORDWRITER'=163
'DELIMITED'=164
'FIELDS'=165
'TERMINATED'=166
'COLLECTION'=167
'ITEMS'=168
'KEYS'=169
'ESCAPED'=170
'LINES'=171
'SEPARATED'=172
'FUNCTION'=173
'EXTENDED'=174
'REFRESH'=175
'CLEAR'=176
'CACHE'=177
'UNCACHE'=178
'LAZY'=179
'FORMATTED'=180
'GLOBAL'=181
'OPTIONS'=183
'UNSET'=184
'TBLPROPERTIES'=185
'DBPROPERTIES'=186
'BUCKETS'=187
'SKEWED'=188
'STORED'=189
'DIRECTORIES'=190
'LOCATION'=191
'EXCHANGE'=192
'ARCHIVE'=193
'UNARCHIVE'=194
'FILEFORMAT'=195
'TOUCH'=196
'COMPACT'=197
'CONCATENATE'=198
'CHANGE'=199
'CASCADE'=200
'RESTRICT'=201
'CLUSTERED'=202
'SORTED'=203
'PURGE'=204
'INPUTFORMAT'=205
'OUTPUTFORMAT'=206
'DFS'=209
'TRUNCATE'=210
'ANALYZE'=211
'COMPUTE'=212
'LIST'=213
'STATISTICS'=214
'PARTITIONED'=215
'EXTERNAL'=216
'DEFINED'=217
'REVOKE'=218
'GRANT'=219
'LOCK'=220
'UNLOCK'=221
'MSCK'=222
'REPAIR'=223
'RECOVER'=224
'EXPORT'=225
'IMPORT'=226
'LOAD'=227
'ROLE'=228
'ROLES'=229
'COMPACTIONS'=230
'PRINCIPALS'=231
'TRANSACTIONS'=232
'INDEX'=233
'INDEXES'=234
'LOCKS'=235
'OPTION'=236
'ANTI'=237
'LOCAL'=238
'INPATH'=239
'WATERMARK'=240
'UNNEST'=241
'/**/'=253

View File

@ -1163,6 +1163,105 @@ sqlListener.prototype.exitTableValuedFunction = function(ctx) {
};
// Enter a parse tree produced by sqlParser#matchRecognize.
sqlListener.prototype.enterMatchRecognize = function(ctx) {
};
// Exit a parse tree produced by sqlParser#matchRecognize.
sqlListener.prototype.exitMatchRecognize = function(ctx) {
};
// Enter a parse tree produced by sqlParser#measureColumn.
sqlListener.prototype.enterMeasureColumn = function(ctx) {
};
// Exit a parse tree produced by sqlParser#measureColumn.
sqlListener.prototype.exitMeasureColumn = function(ctx) {
};
// Enter a parse tree produced by sqlParser#condition1.
sqlListener.prototype.enterCondition1 = function(ctx) {
};
// Exit a parse tree produced by sqlParser#condition1.
sqlListener.prototype.exitCondition1 = function(ctx) {
};
// Enter a parse tree produced by sqlParser#variable.
sqlListener.prototype.enterVariable = function(ctx) {
};
// Exit a parse tree produced by sqlParser#variable.
sqlListener.prototype.exitVariable = function(ctx) {
};
// Enter a parse tree produced by sqlParser#pattern1.
sqlListener.prototype.enterPattern1 = function(ctx) {
};
// Exit a parse tree produced by sqlParser#pattern1.
sqlListener.prototype.exitPattern1 = function(ctx) {
};
// Enter a parse tree produced by sqlParser#patternTerm.
sqlListener.prototype.enterPatternTerm = function(ctx) {
};
// Exit a parse tree produced by sqlParser#patternTerm.
sqlListener.prototype.exitPatternTerm = function(ctx) {
};
// Enter a parse tree produced by sqlParser#patternFactor.
sqlListener.prototype.enterPatternFactor = function(ctx) {
};
// Exit a parse tree produced by sqlParser#patternFactor.
sqlListener.prototype.exitPatternFactor = function(ctx) {
};
// Enter a parse tree produced by sqlParser#patternQuantifier.
sqlListener.prototype.enterPatternQuantifier = function(ctx) {
};
// Exit a parse tree produced by sqlParser#patternQuantifier.
sqlListener.prototype.exitPatternQuantifier = function(ctx) {
};
// Enter a parse tree produced by sqlParser#minRepeat.
sqlListener.prototype.enterMinRepeat = function(ctx) {
};
// Exit a parse tree produced by sqlParser#minRepeat.
sqlListener.prototype.exitMinRepeat = function(ctx) {
};
// Enter a parse tree produced by sqlParser#maxRepeat.
sqlListener.prototype.enterMaxRepeat = function(ctx) {
};
// Exit a parse tree produced by sqlParser#maxRepeat.
sqlListener.prototype.exitMaxRepeat = function(ctx) {
};
// Enter a parse tree produced by sqlParser#repeat.
sqlListener.prototype.enterRepeat = function(ctx) {
};
// Exit a parse tree produced by sqlParser#repeat.
sqlListener.prototype.exitRepeat = function(ctx) {
};
// Enter a parse tree produced by sqlParser#inlineTable.
sqlListener.prototype.enterInlineTable = function(ctx) {
};

File diff suppressed because one or more lines are too long

View File

@ -780,6 +780,72 @@ sqlVisitor.prototype.visitTableValuedFunction = function(ctx) {
};
// Visit a parse tree produced by sqlParser#matchRecognize.
sqlVisitor.prototype.visitMatchRecognize = function(ctx) {
return this.visitChildren(ctx);
};
// Visit a parse tree produced by sqlParser#measureColumn.
sqlVisitor.prototype.visitMeasureColumn = function(ctx) {
return this.visitChildren(ctx);
};
// Visit a parse tree produced by sqlParser#condition1.
sqlVisitor.prototype.visitCondition1 = function(ctx) {
return this.visitChildren(ctx);
};
// Visit a parse tree produced by sqlParser#variable.
sqlVisitor.prototype.visitVariable = function(ctx) {
return this.visitChildren(ctx);
};
// Visit a parse tree produced by sqlParser#pattern1.
sqlVisitor.prototype.visitPattern1 = function(ctx) {
return this.visitChildren(ctx);
};
// Visit a parse tree produced by sqlParser#patternTerm.
sqlVisitor.prototype.visitPatternTerm = function(ctx) {
return this.visitChildren(ctx);
};
// Visit a parse tree produced by sqlParser#patternFactor.
sqlVisitor.prototype.visitPatternFactor = function(ctx) {
return this.visitChildren(ctx);
};
// Visit a parse tree produced by sqlParser#patternQuantifier.
sqlVisitor.prototype.visitPatternQuantifier = function(ctx) {
return this.visitChildren(ctx);
};
// Visit a parse tree produced by sqlParser#minRepeat.
sqlVisitor.prototype.visitMinRepeat = function(ctx) {
return this.visitChildren(ctx);
};
// Visit a parse tree produced by sqlParser#maxRepeat.
sqlVisitor.prototype.visitMaxRepeat = function(ctx) {
return this.visitChildren(ctx);
};
// Visit a parse tree produced by sqlParser#repeat.
sqlVisitor.prototype.visitRepeat = function(ctx) {
return this.visitChildren(ctx);
};
// Visit a parse tree produced by sqlParser#inlineTable.
sqlVisitor.prototype.visitInlineTable = function(ctx) {
return this.visitChildren(ctx);

View File

@ -133,5 +133,28 @@ describe('syntax test', () => {
const result2 = flinksqlParser(sql2);
expect(result2).not.toBeNull();
});
test('MATCH_RECOGNIZE', () => {
const sql = `SELECT *
FROM Ticker
MATCH_RECOGNIZE (
PARTITION BY symbol
ORDER BY rowtime
MEASURES
START_ROW.rowtime AS start_tstamp,
LAST(PRICE_DOWN.rowtime) AS bottom_tstamp,
LAST(PRICE_UP.rowtime) AS end_tstamp
ONE ROW PER MATCH
AFTER MATCH SKIP TO LAST PRICE_UP
PATTERN (START_ROW PRICE_DOWN+ PRICE_UP)
DEFINE
PRICE_DOWN AS
(LAST(PRICE_DOWN.price, 1) IS NULL AND PRICE_DOWN.price < START_ROW.price) OR
PRICE_DOWN.price < LAST(PRICE_DOWN.price, 1),
PRICE_UP AS
PRICE_UP.price > LAST(PRICE_DOWN.price, 1)
) MR;`;
const result = flinksqlParser(sql);
expect(result).toBeNull();
})
})
})