add lateral table support

This commit is contained in:
HSunboy 2019-10-08 17:22:35 +08:00
parent 3b6c224e0e
commit eb0d32751b
10 changed files with 6877 additions and 6684 deletions

File diff suppressed because it is too large Load Diff

File diff suppressed because one or more lines are too long

View File

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

File diff suppressed because one or more lines are too long

View File

@ -238,21 +238,22 @@ ANTI=237
LOCAL=238 LOCAL=238
INPATH=239 INPATH=239
WATERMARK=240 WATERMARK=240
STRING=241 UNNEST=241
BIGINT_LITERAL=242 STRING=242
SMALLINT_LITERAL=243 BIGINT_LITERAL=243
TINYINT_LITERAL=244 SMALLINT_LITERAL=244
INTEGER_VALUE=245 TINYINT_LITERAL=245
DECIMAL_VALUE=246 INTEGER_VALUE=246
DOUBLE_LITERAL=247 DECIMAL_VALUE=247
BIGDECIMAL_LITERAL=248 DOUBLE_LITERAL=248
IDENTIFIER=249 BIGDECIMAL_LITERAL=249
BACKQUOTED_IDENTIFIER=250 IDENTIFIER=250
SIMPLE_COMMENT=251 BACKQUOTED_IDENTIFIER=251
BRACKETED_EMPTY_COMMENT=252 SIMPLE_COMMENT=252
BRACKETED_COMMENT=253 BRACKETED_EMPTY_COMMENT=253
WS=254 BRACKETED_COMMENT=254
UNRECOGNIZED=255 WS=255
UNRECOGNIZED=256
'('=1 '('=1
')'=2 ')'=2
'.'=3 '.'=3
@ -485,4 +486,5 @@ UNRECOGNIZED=255
'LOCAL'=238 'LOCAL'=238
'INPATH'=239 'INPATH'=239
'WATERMARK'=240 'WATERMARK'=240
'/**/'=252 '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

@ -238,21 +238,22 @@ ANTI=237
LOCAL=238 LOCAL=238
INPATH=239 INPATH=239
WATERMARK=240 WATERMARK=240
STRING=241 UNNEST=241
BIGINT_LITERAL=242 STRING=242
SMALLINT_LITERAL=243 BIGINT_LITERAL=243
TINYINT_LITERAL=244 SMALLINT_LITERAL=244
INTEGER_VALUE=245 TINYINT_LITERAL=245
DECIMAL_VALUE=246 INTEGER_VALUE=246
DOUBLE_LITERAL=247 DECIMAL_VALUE=247
BIGDECIMAL_LITERAL=248 DOUBLE_LITERAL=248
IDENTIFIER=249 BIGDECIMAL_LITERAL=249
BACKQUOTED_IDENTIFIER=250 IDENTIFIER=250
SIMPLE_COMMENT=251 BACKQUOTED_IDENTIFIER=251
BRACKETED_EMPTY_COMMENT=252 SIMPLE_COMMENT=252
BRACKETED_COMMENT=253 BRACKETED_EMPTY_COMMENT=253
WS=254 BRACKETED_COMMENT=254
UNRECOGNIZED=255 WS=255
UNRECOGNIZED=256
'('=1 '('=1
')'=2 ')'=2
'.'=3 '.'=3
@ -485,4 +486,5 @@ UNRECOGNIZED=255
'LOCAL'=238 'LOCAL'=238
'INPATH'=239 'INPATH'=239
'WATERMARK'=240 'WATERMARK'=240
'/**/'=252 'UNNEST'=241
'/**/'=253

File diff suppressed because one or more lines are too long

View File

@ -82,6 +82,14 @@ describe('syntax test', () => {
expect(result.token.start).toBe(0); expect(result.token.start).toBe(0);
expect(result.token.stop).toBe(4); expect(result.token.stop).toBe(4);
}); });
test('test lateral table', () => {
const sql = `select
id
FROM
userTable, LATERAL table(json(mess)) as t(ord, name_id);`;
const result = flinksqlParser(sql);
expect(result).toBeNull();
});
test('syntax error', () => { test('syntax error', () => {
const sql = 'select id from user.id; \nselect id from us*er.id; \nselect id from *user.id;'; const sql = 'select id from user.id; \nselect id from us*er.id; \nselect id from *user.id;';
const result = flinksqlParser(sql); const result = flinksqlParser(sql);