dt-sql-parser 4.0.1 → 4.0.3-beta.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +6 -1
- package/dist/lib/flink/FlinkSqlLexer.js +1 -2
- package/dist/lib/flink/FlinkSqlParser.d.ts +14 -6
- package/dist/lib/flink/FlinkSqlParser.js +1448 -1379
- package/dist/lib/flink/FlinkSqlParserListener.d.ts +5 -5
- package/dist/lib/flink/FlinkSqlParserVisitor.d.ts +3 -3
- package/dist/lib/hive/HiveSqlLexer.js +1 -2
- package/dist/lib/hive/HiveSqlParser.d.ts +1 -0
- package/dist/lib/hive/HiveSqlParser.js +537 -527
- package/dist/lib/impala/ImpalaSqlLexer.js +1 -2
- package/dist/lib/impala/ImpalaSqlParser.d.ts +2 -2
- package/dist/lib/impala/ImpalaSqlParser.js +1914 -1924
- package/dist/lib/mysql/MySqlLexer.js +1 -2
- package/dist/lib/mysql/MySqlParser.d.ts +465 -422
- package/dist/lib/mysql/MySqlParser.js +11459 -10508
- package/dist/lib/mysql/MySqlParserListener.d.ts +42 -20
- package/dist/lib/mysql/MySqlParserVisitor.d.ts +26 -12
- package/dist/lib/postgresql/PostgreSqlLexer.js +1 -2
- package/dist/lib/postgresql/PostgreSqlParser.d.ts +2025 -6267
- package/dist/lib/postgresql/PostgreSqlParser.js +59631 -88362
- package/dist/lib/postgresql/PostgreSqlParserListener.d.ts +1688 -6083
- package/dist/lib/postgresql/PostgreSqlParserVisitor.d.ts +712 -3511
- package/dist/lib/spark/SparkSqlLexer.js +1 -2
- package/dist/lib/spark/SparkSqlParser.js +1 -2
- package/dist/lib/trino/TrinoSqlLexer.d.ts +323 -260
- package/dist/lib/trino/TrinoSqlLexer.js +1610 -1264
- package/dist/lib/trino/TrinoSqlListener.d.ts +1311 -200
- package/dist/lib/trino/TrinoSqlParser.d.ts +1884 -546
- package/dist/lib/trino/TrinoSqlParser.js +22685 -13468
- package/dist/lib/trino/TrinoSqlVisitor.d.ts +761 -69
- package/dist/parser/common/basicSQL.js +0 -10
- package/dist/parser/common/entityCollector.d.ts +2 -1
- package/dist/parser/common/entityCollector.js +1 -0
- package/dist/parser/flink/index.js +9 -9
- package/dist/parser/hive/index.js +9 -9
- package/dist/parser/mysql/mysqlEntityCollector.d.ts +3 -1
- package/dist/parser/mysql/mysqlEntityCollector.js +6 -0
- package/dist/parser/postgresql/index.js +13 -13
- package/dist/parser/postgresql/postgreEntityCollector.d.ts +3 -1
- package/dist/parser/postgresql/postgreEntityCollector.js +6 -0
- package/dist/parser/trino/index.js +19 -10
- package/dist/parser/trino/trinoEntityCollector.d.ts +6 -4
- package/dist/parser/trino/trinoEntityCollector.js +9 -3
- package/package.json +39 -12
|
@@ -140,9 +140,6 @@ export class BasicSQL {
|
|
|
140
140
|
return null;
|
|
141
141
|
}
|
|
142
142
|
const splitListener = this.splitListener;
|
|
143
|
-
// TODO: add splitListener to all sqlParser implements and remove following if
|
|
144
|
-
if (!splitListener)
|
|
145
|
-
return null;
|
|
146
143
|
this.listen(splitListener, this._parseTree);
|
|
147
144
|
const res = splitListener.statementsContext
|
|
148
145
|
.map((context) => {
|
|
@@ -160,9 +157,6 @@ export class BasicSQL {
|
|
|
160
157
|
getSuggestionAtCaretPosition(input, caretPosition) {
|
|
161
158
|
var _a, _b, _c, _d, _e, _f, _g, _h, _j;
|
|
162
159
|
const splitListener = this.splitListener;
|
|
163
|
-
// TODO: add splitListener to all sqlParser implements and remove following if
|
|
164
|
-
if (!splitListener)
|
|
165
|
-
return null;
|
|
166
160
|
this.parseWithCache(input);
|
|
167
161
|
if (!this._parseTree)
|
|
168
162
|
return null;
|
|
@@ -261,10 +255,6 @@ export class BasicSQL {
|
|
|
261
255
|
? findCaretTokenIndex(caretPosition, allTokens)
|
|
262
256
|
: void 0;
|
|
263
257
|
const collectListener = this.createEntityCollector(input, caretTokenIndex);
|
|
264
|
-
// TODO: add entityCollector to all sqlParser implements and remove following if
|
|
265
|
-
if (!collectListener) {
|
|
266
|
-
return null;
|
|
267
|
-
}
|
|
268
258
|
// const parser = this.createParserWithCache(input);
|
|
269
259
|
// parser.entityCollecting = true;
|
|
270
260
|
// if(caretPosition) {
|
|
@@ -13,7 +13,8 @@ export declare enum StmtContextType {
|
|
|
13
13
|
CREATE_VIEW_STMT = "createViewStmt",
|
|
14
14
|
SELECT_STMT = "selectStmt",
|
|
15
15
|
INSERT_STMT = "insertStmt",
|
|
16
|
-
CREATE_FUNCTION_STMT = "createFunctionStmt"
|
|
16
|
+
CREATE_FUNCTION_STMT = "createFunctionStmt",
|
|
17
|
+
ALTER_TABLE_STMT = "alterTableStmt"
|
|
17
18
|
}
|
|
18
19
|
export interface StmtContext {
|
|
19
20
|
readonly stmtContextType: StmtContextType;
|
|
@@ -26,6 +26,7 @@ export var StmtContextType;
|
|
|
26
26
|
StmtContextType["SELECT_STMT"] = "selectStmt";
|
|
27
27
|
StmtContextType["INSERT_STMT"] = "insertStmt";
|
|
28
28
|
StmtContextType["CREATE_FUNCTION_STMT"] = "createFunctionStmt";
|
|
29
|
+
StmtContextType["ALTER_TABLE_STMT"] = "alterTableStmt";
|
|
29
30
|
})(StmtContextType || (StmtContextType = {}));
|
|
30
31
|
export function toStmtContext(ctx, type, input, rootStmt, parentStmt, isContainCaret) {
|
|
31
32
|
const text = ctxToText(ctx, input);
|
|
@@ -9,15 +9,15 @@ export class FlinkSQL extends BasicSQL {
|
|
|
9
9
|
constructor() {
|
|
10
10
|
super(...arguments);
|
|
11
11
|
this.preferredRules = new Set([
|
|
12
|
-
FlinkSqlParser.RULE_catalogPath,
|
|
13
|
-
FlinkSqlParser.RULE_databasePath,
|
|
14
|
-
FlinkSqlParser.RULE_databasePathCreate,
|
|
15
|
-
FlinkSqlParser.RULE_tablePath,
|
|
16
|
-
FlinkSqlParser.RULE_tablePathCreate,
|
|
17
|
-
FlinkSqlParser.RULE_viewPath,
|
|
18
|
-
FlinkSqlParser.RULE_viewPathCreate,
|
|
19
|
-
FlinkSqlParser.RULE_functionName,
|
|
20
|
-
FlinkSqlParser.RULE_functionNameCreate,
|
|
12
|
+
FlinkSqlParser.RULE_catalogPath, // catalog name
|
|
13
|
+
FlinkSqlParser.RULE_databasePath, // database name
|
|
14
|
+
FlinkSqlParser.RULE_databasePathCreate, // database name that will be created
|
|
15
|
+
FlinkSqlParser.RULE_tablePath, // table name
|
|
16
|
+
FlinkSqlParser.RULE_tablePathCreate, // table name that will be created
|
|
17
|
+
FlinkSqlParser.RULE_viewPath, // view name path
|
|
18
|
+
FlinkSqlParser.RULE_viewPathCreate, // viewName that will be created
|
|
19
|
+
FlinkSqlParser.RULE_functionName, // functionName
|
|
20
|
+
FlinkSqlParser.RULE_functionNameCreate, // functionName that will be created
|
|
21
21
|
FlinkSqlParser.RULE_columnName,
|
|
22
22
|
FlinkSqlParser.RULE_columnNameCreate,
|
|
23
23
|
]);
|
|
@@ -9,15 +9,15 @@ export class HiveSQL extends BasicSQL {
|
|
|
9
9
|
constructor() {
|
|
10
10
|
super(...arguments);
|
|
11
11
|
this.preferredRules = new Set([
|
|
12
|
-
HiveSqlParser.RULE_dbSchemaName,
|
|
13
|
-
HiveSqlParser.RULE_dbSchemaNameCreate,
|
|
14
|
-
HiveSqlParser.RULE_tableName,
|
|
15
|
-
HiveSqlParser.RULE_tableNameCreate,
|
|
16
|
-
HiveSqlParser.RULE_viewName,
|
|
17
|
-
HiveSqlParser.RULE_viewNameCreate,
|
|
18
|
-
HiveSqlParser.RULE_functionNameForDDL,
|
|
19
|
-
HiveSqlParser.RULE_functionNameForInvoke,
|
|
20
|
-
HiveSqlParser.RULE_functionNameCreate,
|
|
12
|
+
HiveSqlParser.RULE_dbSchemaName, // db or schema name
|
|
13
|
+
HiveSqlParser.RULE_dbSchemaNameCreate, // db or schema name that will be created
|
|
14
|
+
HiveSqlParser.RULE_tableName, // table name
|
|
15
|
+
HiveSqlParser.RULE_tableNameCreate, // table name that will be created
|
|
16
|
+
HiveSqlParser.RULE_viewName, // view name
|
|
17
|
+
HiveSqlParser.RULE_viewNameCreate, // view name that will be created
|
|
18
|
+
HiveSqlParser.RULE_functionNameForDDL, // function name
|
|
19
|
+
HiveSqlParser.RULE_functionNameForInvoke, // function name
|
|
20
|
+
HiveSqlParser.RULE_functionNameCreate, // function name that will be created
|
|
21
21
|
HiveSqlParser.RULE_columnName,
|
|
22
22
|
HiveSqlParser.RULE_columnNameCreate,
|
|
23
23
|
]);
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { ColumnCreateTableContext, ColumnNameCreateContext, CopyCreateTableContext, CreateDatabaseContext, CreateFunctionContext, CreateViewContext, DatabaseNameContext, DatabaseNameCreateContext, FunctionNameCreateContext, InsertStatementContext, QueryCreateTableContext, SelectStatementContext, SingleStatementContext, TableNameContext, TableNameCreateContext, ViewNameContext, ViewNameCreateContext } from '../../lib/mysql/MySqlParser';
|
|
1
|
+
import type { ColumnCreateTableContext, ColumnNameCreateContext, CopyCreateTableContext, CreateDatabaseContext, CreateFunctionContext, CreateFunctionLoadableContext, CreateViewContext, DatabaseNameContext, DatabaseNameCreateContext, FunctionNameCreateContext, InsertStatementContext, QueryCreateTableContext, SelectStatementContext, SingleStatementContext, TableNameContext, TableNameCreateContext, ViewNameContext, ViewNameCreateContext } from '../../lib/mysql/MySqlParser';
|
|
2
2
|
import type { MySqlParserListener } from '../../lib/mysql/MySqlParserListener';
|
|
3
3
|
import { EntityCollector } from '../common/entityCollector';
|
|
4
4
|
export declare class MySqlEntityCollector extends EntityCollector implements MySqlParserListener {
|
|
@@ -34,4 +34,6 @@ export declare class MySqlEntityCollector extends EntityCollector implements MyS
|
|
|
34
34
|
exitCreateDatabase(ctx: CreateDatabaseContext): void;
|
|
35
35
|
enterCreateFunction(ctx: CreateFunctionContext): void;
|
|
36
36
|
exitCreateFunction(ctx: CreateFunctionContext): void;
|
|
37
|
+
enterCreateFunctionLoadable(ctx: CreateFunctionLoadableContext): void;
|
|
38
|
+
exitCreateFunctionLoadable(ctx: CreateFunctionLoadableContext): void;
|
|
37
39
|
}
|
|
@@ -93,4 +93,10 @@ export class MySqlEntityCollector extends EntityCollector {
|
|
|
93
93
|
exitCreateFunction(ctx) {
|
|
94
94
|
this.popStmt();
|
|
95
95
|
}
|
|
96
|
+
enterCreateFunctionLoadable(ctx) {
|
|
97
|
+
this.pushStmt(ctx, StmtContextType.CREATE_FUNCTION_STMT);
|
|
98
|
+
}
|
|
99
|
+
exitCreateFunctionLoadable(ctx) {
|
|
100
|
+
this.popStmt();
|
|
101
|
+
}
|
|
96
102
|
}
|
|
@@ -9,19 +9,19 @@ export class PostgreSQL extends BasicSQL {
|
|
|
9
9
|
constructor() {
|
|
10
10
|
super(...arguments);
|
|
11
11
|
this.preferredRules = new Set([
|
|
12
|
-
PostgreSqlParser.RULE_table_name_create,
|
|
13
|
-
PostgreSqlParser.RULE_table_name,
|
|
14
|
-
PostgreSqlParser.RULE_function_name,
|
|
15
|
-
PostgreSqlParser.RULE_function_name_create,
|
|
16
|
-
PostgreSqlParser.RULE_schema_name_create,
|
|
17
|
-
PostgreSqlParser.RULE_schema_name,
|
|
18
|
-
PostgreSqlParser.RULE_view_name_create,
|
|
19
|
-
PostgreSqlParser.RULE_view_name,
|
|
20
|
-
PostgreSqlParser.RULE_database_name_create,
|
|
21
|
-
PostgreSqlParser.RULE_database_name,
|
|
22
|
-
PostgreSqlParser.RULE_procedure_name_create,
|
|
23
|
-
PostgreSqlParser.RULE_procedure_name,
|
|
24
|
-
PostgreSqlParser.RULE_column_name_create,
|
|
12
|
+
PostgreSqlParser.RULE_table_name_create, // table name
|
|
13
|
+
PostgreSqlParser.RULE_table_name, // table name that will be created
|
|
14
|
+
PostgreSqlParser.RULE_function_name, // function name
|
|
15
|
+
PostgreSqlParser.RULE_function_name_create, // function name that will be created
|
|
16
|
+
PostgreSqlParser.RULE_schema_name_create, // schema name that will be created
|
|
17
|
+
PostgreSqlParser.RULE_schema_name, // schema name
|
|
18
|
+
PostgreSqlParser.RULE_view_name_create, // view name that will be created
|
|
19
|
+
PostgreSqlParser.RULE_view_name, // view name
|
|
20
|
+
PostgreSqlParser.RULE_database_name_create, // database name that will be created
|
|
21
|
+
PostgreSqlParser.RULE_database_name, // database name
|
|
22
|
+
PostgreSqlParser.RULE_procedure_name_create, // procedure name that will be created
|
|
23
|
+
PostgreSqlParser.RULE_procedure_name, // procedure name
|
|
24
|
+
PostgreSqlParser.RULE_column_name_create, // column name that will be created
|
|
25
25
|
PostgreSqlParser.RULE_column_name, // column name
|
|
26
26
|
]);
|
|
27
27
|
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { ColumnCreateTableContext, ColumnNameCreateContext, CreateDatabaseContext, CreateForeignTableContext, CreateMaterializedViewContext, CreatePartitionForeignTableContext, CreateViewContext, CreatefunctionstmtContext, DatabaseNameContext, DatabaseNameCreateContext, FunctionNameCreateContext, InsertStatementContext, QueryCreateTableContext, SelectStatementContext, SingleStmtContext, TableNameContext, TableNameCreateContext, ViewNameContext, ViewNameCreateContext } from '../../lib/postgresql/PostgreSqlParser';
|
|
1
|
+
import type { AltertablestmtContext, ColumnCreateTableContext, ColumnNameCreateContext, CreateDatabaseContext, CreateForeignTableContext, CreateMaterializedViewContext, CreatePartitionForeignTableContext, CreateViewContext, CreatefunctionstmtContext, DatabaseNameContext, DatabaseNameCreateContext, FunctionNameCreateContext, InsertStatementContext, QueryCreateTableContext, SelectStatementContext, SingleStmtContext, TableNameContext, TableNameCreateContext, ViewNameContext, ViewNameCreateContext } from '../../lib/postgresql/PostgreSqlParser';
|
|
2
2
|
import type { PostgreSqlParserListener } from '../../lib/postgresql/PostgreSqlParserListener';
|
|
3
3
|
import { EntityCollector } from '../common/entityCollector';
|
|
4
4
|
export declare class PostgreSqlEntityCollector extends EntityCollector implements PostgreSqlParserListener {
|
|
@@ -34,4 +34,6 @@ export declare class PostgreSqlEntityCollector extends EntityCollector implement
|
|
|
34
34
|
exitInsertStatement(ctx: InsertStatementContext): void;
|
|
35
35
|
enterCreatefunctionstmt(ctx: CreatefunctionstmtContext): void;
|
|
36
36
|
exitCreatefunctionstmt(ctx: CreatefunctionstmtContext): void;
|
|
37
|
+
enterAltertablestmt(ctx: AltertablestmtContext): void;
|
|
38
|
+
exitAltertablestmt(ctx: AltertablestmtContext): void;
|
|
37
39
|
}
|
|
@@ -93,4 +93,10 @@ export class PostgreSqlEntityCollector extends EntityCollector {
|
|
|
93
93
|
exitCreatefunctionstmt(ctx) {
|
|
94
94
|
this.popStmt();
|
|
95
95
|
}
|
|
96
|
+
enterAltertablestmt(ctx) {
|
|
97
|
+
this.pushStmt(ctx, StmtContextType.ALTER_TABLE_STMT);
|
|
98
|
+
}
|
|
99
|
+
exitAltertablestmt(ctx) {
|
|
100
|
+
this.popStmt();
|
|
101
|
+
}
|
|
96
102
|
}
|
|
@@ -9,16 +9,17 @@ export class TrinoSQL extends BasicSQL {
|
|
|
9
9
|
constructor() {
|
|
10
10
|
super(...arguments);
|
|
11
11
|
this.preferredRules = new Set([
|
|
12
|
-
TrinoSqlParser.
|
|
12
|
+
TrinoSqlParser.RULE_catalogRef,
|
|
13
13
|
TrinoSqlParser.RULE_catalogNameCreate,
|
|
14
|
-
TrinoSqlParser.
|
|
14
|
+
TrinoSqlParser.RULE_schemaRef,
|
|
15
15
|
TrinoSqlParser.RULE_schemaNameCreate,
|
|
16
|
-
TrinoSqlParser.
|
|
16
|
+
TrinoSqlParser.RULE_tableRef,
|
|
17
17
|
TrinoSqlParser.RULE_tableNameCreate,
|
|
18
|
-
TrinoSqlParser.
|
|
18
|
+
TrinoSqlParser.RULE_viewRef,
|
|
19
19
|
TrinoSqlParser.RULE_viewNameCreate,
|
|
20
20
|
TrinoSqlParser.RULE_functionName,
|
|
21
|
-
TrinoSqlParser.
|
|
21
|
+
TrinoSqlParser.RULE_functionNameCreate,
|
|
22
|
+
TrinoSqlParser.RULE_columnRef,
|
|
22
23
|
TrinoSqlParser.RULE_columnNameCreate,
|
|
23
24
|
]);
|
|
24
25
|
}
|
|
@@ -43,11 +44,15 @@ export class TrinoSQL extends BasicSQL {
|
|
|
43
44
|
const tokenRanges = allTokens.slice(startTokenIndex, caretTokenIndex + tokenIndexOffset + 1);
|
|
44
45
|
let syntaxContextType = void 0;
|
|
45
46
|
switch (ruleType) {
|
|
46
|
-
case TrinoSqlParser.
|
|
47
|
+
case TrinoSqlParser.RULE_catalogRef: {
|
|
47
48
|
syntaxContextType = EntityContextType.CATALOG;
|
|
48
49
|
break;
|
|
49
50
|
}
|
|
50
|
-
case TrinoSqlParser.
|
|
51
|
+
case TrinoSqlParser.RULE_catalogNameCreate: {
|
|
52
|
+
syntaxContextType = EntityContextType.CATALOG_CREATE;
|
|
53
|
+
break;
|
|
54
|
+
}
|
|
55
|
+
case TrinoSqlParser.RULE_schemaRef: {
|
|
51
56
|
syntaxContextType = EntityContextType.DATABASE;
|
|
52
57
|
break;
|
|
53
58
|
}
|
|
@@ -55,7 +60,7 @@ export class TrinoSQL extends BasicSQL {
|
|
|
55
60
|
syntaxContextType = EntityContextType.DATABASE_CREATE;
|
|
56
61
|
break;
|
|
57
62
|
}
|
|
58
|
-
case TrinoSqlParser.
|
|
63
|
+
case TrinoSqlParser.RULE_tableRef: {
|
|
59
64
|
syntaxContextType = EntityContextType.TABLE;
|
|
60
65
|
break;
|
|
61
66
|
}
|
|
@@ -63,7 +68,7 @@ export class TrinoSQL extends BasicSQL {
|
|
|
63
68
|
syntaxContextType = EntityContextType.TABLE_CREATE;
|
|
64
69
|
break;
|
|
65
70
|
}
|
|
66
|
-
case TrinoSqlParser.
|
|
71
|
+
case TrinoSqlParser.RULE_viewRef: {
|
|
67
72
|
syntaxContextType = EntityContextType.VIEW;
|
|
68
73
|
break;
|
|
69
74
|
}
|
|
@@ -75,11 +80,15 @@ export class TrinoSQL extends BasicSQL {
|
|
|
75
80
|
syntaxContextType = EntityContextType.FUNCTION;
|
|
76
81
|
break;
|
|
77
82
|
}
|
|
83
|
+
case TrinoSqlParser.RULE_functionNameCreate: {
|
|
84
|
+
syntaxContextType = EntityContextType.FUNCTION_CREATE;
|
|
85
|
+
break;
|
|
86
|
+
}
|
|
78
87
|
case TrinoSqlParser.RULE_columnNameCreate: {
|
|
79
88
|
syntaxContextType = EntityContextType.COLUMN_CREATE;
|
|
80
89
|
break;
|
|
81
90
|
}
|
|
82
|
-
case TrinoSqlParser.
|
|
91
|
+
case TrinoSqlParser.RULE_columnRef: {
|
|
83
92
|
syntaxContextType = EntityContextType.COLUMN;
|
|
84
93
|
break;
|
|
85
94
|
}
|
|
@@ -1,13 +1,15 @@
|
|
|
1
|
-
import type { ColumnNameCreateContext, CreateMaterializedViewContext, CreateSchemaContext, CreateTableAsSelectContext, CreateTableContext, CreateViewContext, InsertIntoContext,
|
|
1
|
+
import type { CatalogNameCreateContext, CatalogRefContext, ColumnNameCreateContext, CreateMaterializedViewContext, CreateSchemaContext, CreateTableAsSelectContext, CreateTableContext, CreateViewContext, InsertIntoContext, SchemaNameCreateContext, SchemaRefContext, SingleStatementContext, TableNameCreateContext, TableRefContext, ViewNameCreateContext, ViewRefContext, QueryStatementContext } from '../../lib/trino/TrinoSqlParser';
|
|
2
2
|
import type { TrinoSqlListener } from '../../lib/trino/TrinoSqlListener';
|
|
3
3
|
import { EntityCollector } from '../common/entityCollector';
|
|
4
4
|
export declare class TrinoEntityCollector extends EntityCollector implements TrinoSqlListener {
|
|
5
5
|
/** ====== Entity Begin */
|
|
6
|
-
|
|
6
|
+
exitCatalogRef(ctx: CatalogRefContext): void;
|
|
7
|
+
exitCatalogNameCreate(ctx: CatalogNameCreateContext): void;
|
|
8
|
+
exitSchemaRef(ctx: SchemaRefContext): void;
|
|
7
9
|
exitSchemaNameCreate(ctx: SchemaNameCreateContext): void;
|
|
8
|
-
|
|
10
|
+
exitTableRef(ctx: TableRefContext): void;
|
|
9
11
|
exitTableNameCreate(ctx: TableNameCreateContext): void;
|
|
10
|
-
|
|
12
|
+
exitViewRef(ctx: ViewRefContext): void;
|
|
11
13
|
exitViewNameCreate(ctx: ViewNameCreateContext): void;
|
|
12
14
|
exitColumnNameCreate(ctx: ColumnNameCreateContext): void;
|
|
13
15
|
/** ===== Statement begin */
|
|
@@ -2,19 +2,25 @@ import { EntityContextType } from '../common/types';
|
|
|
2
2
|
import { StmtContextType, EntityCollector } from '../common/entityCollector';
|
|
3
3
|
export class TrinoEntityCollector extends EntityCollector {
|
|
4
4
|
/** ====== Entity Begin */
|
|
5
|
-
|
|
5
|
+
exitCatalogRef(ctx) {
|
|
6
|
+
this.pushEntity(ctx, EntityContextType.CATALOG);
|
|
7
|
+
}
|
|
8
|
+
exitCatalogNameCreate(ctx) {
|
|
9
|
+
this.pushEntity(ctx, EntityContextType.CATALOG_CREATE);
|
|
10
|
+
}
|
|
11
|
+
exitSchemaRef(ctx) {
|
|
6
12
|
this.pushEntity(ctx, EntityContextType.DATABASE);
|
|
7
13
|
}
|
|
8
14
|
exitSchemaNameCreate(ctx) {
|
|
9
15
|
this.pushEntity(ctx, EntityContextType.DATABASE_CREATE);
|
|
10
16
|
}
|
|
11
|
-
|
|
17
|
+
exitTableRef(ctx) {
|
|
12
18
|
this.pushEntity(ctx, EntityContextType.TABLE);
|
|
13
19
|
}
|
|
14
20
|
exitTableNameCreate(ctx) {
|
|
15
21
|
this.pushEntity(ctx, EntityContextType.TABLE_CREATE);
|
|
16
22
|
}
|
|
17
|
-
|
|
23
|
+
exitViewRef(ctx) {
|
|
18
24
|
this.pushEntity(ctx, EntityContextType.VIEW);
|
|
19
25
|
}
|
|
20
26
|
exitViewNameCreate(ctx) {
|
package/package.json
CHANGED
|
@@ -1,16 +1,20 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "dt-sql-parser",
|
|
3
|
-
"version": "4.0.
|
|
3
|
+
"version": "4.0.3-beta.0",
|
|
4
4
|
"authors": "DTStack Corporation",
|
|
5
5
|
"description": "SQL Parsers for BigData, built with antlr4",
|
|
6
6
|
"keywords": [
|
|
7
|
+
"antlr4",
|
|
7
8
|
"sql",
|
|
8
9
|
"parser",
|
|
9
|
-
"
|
|
10
|
+
"code-completion",
|
|
10
11
|
"hive",
|
|
11
12
|
"spark",
|
|
12
13
|
"flink",
|
|
13
|
-
"
|
|
14
|
+
"mysql",
|
|
15
|
+
"postgresql",
|
|
16
|
+
"trino",
|
|
17
|
+
"impala"
|
|
14
18
|
],
|
|
15
19
|
"main": "dist/index.js",
|
|
16
20
|
"module": "dist/index.js",
|
|
@@ -26,12 +30,18 @@
|
|
|
26
30
|
"check-types": "tsc -p ./tsconfig.json && tsc -p ./test/tsconfig.json",
|
|
27
31
|
"test": "NODE_OPTIONS=--max_old_space_size=4096 && jest",
|
|
28
32
|
"release": "node ./scripts/release.js",
|
|
29
|
-
"
|
|
30
|
-
"
|
|
33
|
+
"prettier-check": "prettier --check .",
|
|
34
|
+
"format": "prettier --write .",
|
|
31
35
|
"format-g4": "antlr-format -c ./antlr.format.json -v ./src/grammar/**/*.g4",
|
|
32
|
-
"cleanComment": "node ./scripts/cleanCommentCli.js"
|
|
36
|
+
"cleanComment": "node ./scripts/cleanCommentCli.js",
|
|
37
|
+
"benchmark": "NODE_OPTIONS=--max_old_space_size=4096 && node --no-warnings ./scripts/benchmark.js",
|
|
38
|
+
"benchmark:release": "node --no-warnings ./scripts/benchmark.js --release"
|
|
33
39
|
},
|
|
34
40
|
"license": "MIT",
|
|
41
|
+
"dependencies": {
|
|
42
|
+
"antlr4-c3": "3.3.7",
|
|
43
|
+
"antlr4ng": "2.0.11"
|
|
44
|
+
},
|
|
35
45
|
"devDependencies": {
|
|
36
46
|
"@commitlint/cli": "^17.7.2",
|
|
37
47
|
"@commitlint/config-conventional": "^17.7.0",
|
|
@@ -44,24 +54,41 @@
|
|
|
44
54
|
"antlr4ng-cli": "^1.0.7",
|
|
45
55
|
"chalk": "4.1.2",
|
|
46
56
|
"commitizen": "^4.3.0",
|
|
57
|
+
"console-table-printer": "^2.12.0",
|
|
58
|
+
"envinfo": "^7.11.1",
|
|
47
59
|
"glob": "^10.3.10",
|
|
48
60
|
"husky": "^8.0.3",
|
|
49
61
|
"inquirer": "^8.2.2",
|
|
50
62
|
"jest": "^29.5.0",
|
|
51
63
|
"lint-staged": "12.5.0",
|
|
52
64
|
"prettier": "^3.0.3",
|
|
65
|
+
"semver": "^7.6.2",
|
|
53
66
|
"standard-version": "^9.5.0",
|
|
67
|
+
"tsx": "^4.7.1",
|
|
54
68
|
"typescript": "^5.0.4",
|
|
55
69
|
"yargs-parser": "^21.1.1"
|
|
56
70
|
},
|
|
57
|
-
"
|
|
58
|
-
|
|
71
|
+
"repository": {
|
|
72
|
+
"type": "git",
|
|
73
|
+
"url": "https://github.com/DTStack/dt-sql-parser.git"
|
|
74
|
+
},
|
|
59
75
|
"publishConfig": {
|
|
60
76
|
"registry": "https://registry.npmjs.org/"
|
|
61
77
|
},
|
|
62
|
-
"
|
|
63
|
-
|
|
64
|
-
"
|
|
78
|
+
"sideEffects": false,
|
|
79
|
+
"engines": {
|
|
80
|
+
"node": ">=18"
|
|
81
|
+
},
|
|
82
|
+
"packageManager": "pnpm@9.7.0",
|
|
83
|
+
"config": {
|
|
84
|
+
"commitizen": {
|
|
85
|
+
"path": "./node_modules/@commitlint/cz-commitlint"
|
|
86
|
+
}
|
|
65
87
|
},
|
|
66
|
-
"
|
|
88
|
+
"lint-staged": {
|
|
89
|
+
"*": [
|
|
90
|
+
"prettier --write --ignore-unknown"
|
|
91
|
+
],
|
|
92
|
+
"*.g4": ["antlr-format -c ./antlr.format.json -v"]
|
|
93
|
+
}
|
|
67
94
|
}
|