Skip to content

Commit 2b0de6a

Browse files
authored
feat: upgrade trino to 450 (#323)
* feat: upgrade trino grammar to 450 * feat: prefix KW to keyword rule * feat: resume suggestion and collect entity * feat: optimize trino drop function * feat: add test cases to trino unit tests * feat: correct types
1 parent 7884cbe commit 2b0de6a

31 files changed

+28551
-15748
lines changed

src/grammar/trino/TrinoSql.g4

Lines changed: 667 additions & 263 deletions
Large diffs are not rendered by default.

src/lib/trino/TrinoSql.interp

Lines changed: 189 additions & 21 deletions
Large diffs are not rendered by default.

src/lib/trino/TrinoSql.tokens

Lines changed: 643 additions & 517 deletions
Large diffs are not rendered by default.

src/lib/trino/TrinoSqlLexer.interp

Lines changed: 210 additions & 17 deletions
Large diffs are not rendered by default.

src/lib/trino/TrinoSqlLexer.tokens

Lines changed: 642 additions & 516 deletions
Large diffs are not rendered by default.

src/lib/trino/TrinoSqlLexer.ts

Lines changed: 1609 additions & 1262 deletions
Large diffs are not rendered by default.

src/lib/trino/TrinoSqlListener.ts

Lines changed: 1311 additions & 200 deletions
Large diffs are not rendered by default.

src/lib/trino/TrinoSqlParser.ts

Lines changed: 22264 additions & 12858 deletions
Large diffs are not rendered by default.

src/lib/trino/TrinoSqlVisitor.ts

Lines changed: 761 additions & 69 deletions
Large diffs are not rendered by default.

src/parser/trino/index.ts

Lines changed: 19 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -28,16 +28,17 @@ export class TrinoSQL extends BasicSQL<TrinoSqlLexer, ProgramContext, TrinoSqlPa
2828
}
2929

3030
protected preferredRules: Set<number> = new Set([
31-
TrinoSqlParser.RULE_catalogName,
31+
TrinoSqlParser.RULE_catalogRef,
3232
TrinoSqlParser.RULE_catalogNameCreate,
33-
TrinoSqlParser.RULE_schemaName,
33+
TrinoSqlParser.RULE_schemaRef,
3434
TrinoSqlParser.RULE_schemaNameCreate,
35-
TrinoSqlParser.RULE_tableName,
35+
TrinoSqlParser.RULE_tableRef,
3636
TrinoSqlParser.RULE_tableNameCreate,
37-
TrinoSqlParser.RULE_viewName,
37+
TrinoSqlParser.RULE_viewRef,
3838
TrinoSqlParser.RULE_viewNameCreate,
3939
TrinoSqlParser.RULE_functionName,
40-
TrinoSqlParser.RULE_columnName,
40+
TrinoSqlParser.RULE_functionNameCreate,
41+
TrinoSqlParser.RULE_columnRef,
4142
TrinoSqlParser.RULE_columnNameCreate,
4243
]);
4344

@@ -60,27 +61,31 @@ export class TrinoSQL extends BasicSQL<TrinoSqlLexer, ProgramContext, TrinoSqlPa
6061

6162
let syntaxContextType: EntityContextType | StmtContextType | undefined = void 0;
6263
switch (ruleType) {
63-
case TrinoSqlParser.RULE_catalogName: {
64+
case TrinoSqlParser.RULE_catalogRef: {
6465
syntaxContextType = EntityContextType.CATALOG;
6566
break;
6667
}
67-
case TrinoSqlParser.RULE_schemaName: {
68+
case TrinoSqlParser.RULE_catalogNameCreate: {
69+
syntaxContextType = EntityContextType.CATALOG_CREATE;
70+
break;
71+
}
72+
case TrinoSqlParser.RULE_schemaRef: {
6873
syntaxContextType = EntityContextType.DATABASE;
6974
break;
7075
}
7176
case TrinoSqlParser.RULE_schemaNameCreate: {
7277
syntaxContextType = EntityContextType.DATABASE_CREATE;
7378
break;
7479
}
75-
case TrinoSqlParser.RULE_tableName: {
80+
case TrinoSqlParser.RULE_tableRef: {
7681
syntaxContextType = EntityContextType.TABLE;
7782
break;
7883
}
7984
case TrinoSqlParser.RULE_tableNameCreate: {
8085
syntaxContextType = EntityContextType.TABLE_CREATE;
8186
break;
8287
}
83-
case TrinoSqlParser.RULE_viewName: {
88+
case TrinoSqlParser.RULE_viewRef: {
8489
syntaxContextType = EntityContextType.VIEW;
8590
break;
8691
}
@@ -92,11 +97,15 @@ export class TrinoSQL extends BasicSQL<TrinoSqlLexer, ProgramContext, TrinoSqlPa
9297
syntaxContextType = EntityContextType.FUNCTION;
9398
break;
9499
}
100+
case TrinoSqlParser.RULE_functionNameCreate: {
101+
syntaxContextType = EntityContextType.FUNCTION_CREATE;
102+
break;
103+
}
95104
case TrinoSqlParser.RULE_columnNameCreate: {
96105
syntaxContextType = EntityContextType.COLUMN_CREATE;
97106
break;
98107
}
99-
case TrinoSqlParser.RULE_columnName: {
108+
case TrinoSqlParser.RULE_columnRef: {
100109
syntaxContextType = EntityContextType.COLUMN;
101110
break;
102111
}

0 commit comments

Comments
 (0)