dt-sql-parser 4.5.1-beta.3 → 4.5.2-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/dist/lib/SQLParserBase.d.ts +9 -0
- package/dist/lib/SQLParserBase.js +15 -0
- package/dist/lib/generic/GenericSqlListener.d.ts +11 -0
- package/dist/lib/generic/GenericSqlParser.d.ts +61 -47
- package/dist/lib/generic/GenericSqlParser.js +1047 -949
- package/dist/lib/generic/GenericSqlVisitor.d.ts +7 -0
- package/dist/lib/hive/HiveSqlParser.d.ts +54 -30
- package/dist/lib/hive/HiveSqlParser.js +5633 -5467
- package/dist/lib/hive/HiveSqlParserListener.d.ts +22 -0
- package/dist/lib/hive/HiveSqlParserVisitor.d.ts +14 -0
- package/dist/lib/mysql/MySqlParser.d.ts +34 -9
- package/dist/lib/mysql/MySqlParser.js +5697 -5550
- package/dist/lib/mysql/MySqlParserListener.d.ts +33 -5
- package/dist/lib/mysql/MySqlParserVisitor.d.ts +20 -3
- package/dist/lib/postgresql/PostgreSqlParser.d.ts +200 -166
- package/dist/lib/postgresql/PostgreSqlParser.js +10389 -10136
- package/dist/lib/postgresql/PostgreSqlParserListener.d.ts +31 -5
- package/dist/lib/postgresql/PostgreSqlParserVisitor.d.ts +19 -3
- package/dist/lib/trino/TrinoSqlListener.d.ts +33 -0
- package/dist/lib/trino/TrinoSqlParser.d.ts +157 -115
- package/dist/lib/trino/TrinoSqlParser.js +4775 -4494
- package/dist/lib/trino/TrinoSqlVisitor.d.ts +21 -0
- package/dist/parser/common/basicSQL.d.ts +3 -0
- package/dist/parser/common/basicSQL.js +47 -1
- package/dist/parser/common/entityCollector.d.ts +37 -2
- package/dist/parser/common/entityCollector.js +303 -2
- package/dist/parser/flink/flinkEntityCollector.d.ts +2 -1
- package/dist/parser/flink/flinkEntityCollector.js +4 -0
- package/dist/parser/flink/index.js +1 -1
- package/dist/parser/generic/genericEntityCollector.d.ts +7 -2
- package/dist/parser/generic/genericEntityCollector.js +65 -15
- package/dist/parser/generic/index.js +13 -1
- package/dist/parser/hive/hiveEntityCollector.d.ts +2 -1
- package/dist/parser/hive/hiveEntityCollector.js +5 -0
- package/dist/parser/hive/index.js +1 -1
- package/dist/parser/impala/impalaEntityCollector.d.ts +2 -1
- package/dist/parser/impala/impalaEntityCollector.js +4 -0
- package/dist/parser/impala/index.js +1 -1
- package/dist/parser/mysql/index.js +15 -1
- package/dist/parser/mysql/mysqlEntityCollector.d.ts +3 -1
- package/dist/parser/mysql/mysqlEntityCollector.js +24 -0
- package/dist/parser/postgresql/index.js +3 -2
- package/dist/parser/postgresql/postgreEntityCollector.d.ts +3 -1
- package/dist/parser/postgresql/postgreEntityCollector.js +10 -0
- package/dist/parser/spark/index.js +1 -1
- package/dist/parser/spark/sparkEntityCollector.d.ts +2 -1
- package/dist/parser/spark/sparkEntityCollector.js +5 -0
- package/dist/parser/trino/index.js +4 -2
- package/dist/parser/trino/trinoEntityCollector.d.ts +2 -1
- package/dist/parser/trino/trinoEntityCollector.js +5 -0
- package/package.json +1 -1
|
@@ -17,4 +17,13 @@ export declare abstract class SQLParserBase<T = antlr.ParserRuleContext> extends
|
|
|
17
17
|
* prediction in non-entity-collecting contexts.
|
|
18
18
|
*/
|
|
19
19
|
shouldMatchEmpty(ruleName?: string): boolean;
|
|
20
|
+
/**
|
|
21
|
+
* Semantic predicate to check whether the previous token and the next token
|
|
22
|
+
* are adjacent (no whitespace in between).
|
|
23
|
+
*
|
|
24
|
+
* Used to support hyphens inside Hive SET config property names, e.g.
|
|
25
|
+
* `set tez.grouping.max-size = 1`, while still rejecting invalid spacing
|
|
26
|
+
* like `set hive.a - b = 1`.
|
|
27
|
+
*/
|
|
28
|
+
isNextTokenAdjacent(): boolean;
|
|
20
29
|
}
|
|
@@ -46,4 +46,19 @@ export class SQLParserBase extends antlr.Parser {
|
|
|
46
46
|
// This allows ANTLR to report errors naturally
|
|
47
47
|
return false;
|
|
48
48
|
}
|
|
49
|
+
/**
|
|
50
|
+
* Semantic predicate to check whether the previous token and the next token
|
|
51
|
+
* are adjacent (no whitespace in between).
|
|
52
|
+
*
|
|
53
|
+
* Used to support hyphens inside Hive SET config property names, e.g.
|
|
54
|
+
* `set tez.grouping.max-size = 1`, while still rejecting invalid spacing
|
|
55
|
+
* like `set hive.a - b = 1`.
|
|
56
|
+
*/
|
|
57
|
+
isNextTokenAdjacent() {
|
|
58
|
+
const previousToken = this.tokenStream.LT(-1);
|
|
59
|
+
const nextToken = this.tokenStream.LT(1);
|
|
60
|
+
return (previousToken !== null &&
|
|
61
|
+
nextToken !== null &&
|
|
62
|
+
previousToken.stop + 1 === nextToken.start);
|
|
63
|
+
}
|
|
49
64
|
}
|
|
@@ -12,6 +12,7 @@ import { DropTableContext } from "./GenericSqlParser.js";
|
|
|
12
12
|
import { QueryStatementContext } from "./GenericSqlParser.js";
|
|
13
13
|
import { WithClauseContext } from "./GenericSqlParser.js";
|
|
14
14
|
import { NamedQueryContext } from "./GenericSqlParser.js";
|
|
15
|
+
import { CteColumnListContext } from "./GenericSqlParser.js";
|
|
15
16
|
import { QueryNoWithContext } from "./GenericSqlParser.js";
|
|
16
17
|
import { QueryTermContext } from "./GenericSqlParser.js";
|
|
17
18
|
import { QueryPrimaryContext } from "./GenericSqlParser.js";
|
|
@@ -238,6 +239,16 @@ export declare class GenericSqlListener implements ParseTreeListener {
|
|
|
238
239
|
* @param ctx the parse tree
|
|
239
240
|
*/
|
|
240
241
|
exitNamedQuery?: (ctx: NamedQueryContext) => void;
|
|
242
|
+
/**
|
|
243
|
+
* Enter a parse tree produced by `GenericSqlParser.cteColumnList`.
|
|
244
|
+
* @param ctx the parse tree
|
|
245
|
+
*/
|
|
246
|
+
enterCteColumnList?: (ctx: CteColumnListContext) => void;
|
|
247
|
+
/**
|
|
248
|
+
* Exit a parse tree produced by `GenericSqlParser.cteColumnList`.
|
|
249
|
+
* @param ctx the parse tree
|
|
250
|
+
*/
|
|
251
|
+
exitCteColumnList?: (ctx: CteColumnListContext) => void;
|
|
241
252
|
/**
|
|
242
253
|
* Enter a parse tree produced by `GenericSqlParser.queryNoWith`.
|
|
243
254
|
* @param ctx the parse tree
|
|
@@ -133,53 +133,54 @@ export declare class GenericSqlParser extends SQLParserBase {
|
|
|
133
133
|
static readonly RULE_queryStatement = 4;
|
|
134
134
|
static readonly RULE_withClause = 5;
|
|
135
135
|
static readonly RULE_namedQuery = 6;
|
|
136
|
-
static readonly
|
|
137
|
-
static readonly
|
|
138
|
-
static readonly
|
|
139
|
-
static readonly
|
|
140
|
-
static readonly
|
|
141
|
-
static readonly
|
|
142
|
-
static readonly
|
|
143
|
-
static readonly
|
|
144
|
-
static readonly
|
|
145
|
-
static readonly
|
|
146
|
-
static readonly
|
|
147
|
-
static readonly
|
|
148
|
-
static readonly
|
|
149
|
-
static readonly
|
|
150
|
-
static readonly
|
|
151
|
-
static readonly
|
|
152
|
-
static readonly
|
|
153
|
-
static readonly
|
|
154
|
-
static readonly
|
|
155
|
-
static readonly
|
|
156
|
-
static readonly
|
|
157
|
-
static readonly
|
|
158
|
-
static readonly
|
|
159
|
-
static readonly
|
|
160
|
-
static readonly
|
|
161
|
-
static readonly
|
|
162
|
-
static readonly
|
|
163
|
-
static readonly
|
|
164
|
-
static readonly
|
|
165
|
-
static readonly
|
|
166
|
-
static readonly
|
|
167
|
-
static readonly
|
|
168
|
-
static readonly
|
|
169
|
-
static readonly
|
|
170
|
-
static readonly
|
|
171
|
-
static readonly
|
|
172
|
-
static readonly
|
|
173
|
-
static readonly
|
|
174
|
-
static readonly
|
|
175
|
-
static readonly
|
|
176
|
-
static readonly
|
|
177
|
-
static readonly
|
|
178
|
-
static readonly
|
|
179
|
-
static readonly
|
|
180
|
-
static readonly
|
|
181
|
-
static readonly
|
|
182
|
-
static readonly
|
|
136
|
+
static readonly RULE_cteColumnList = 7;
|
|
137
|
+
static readonly RULE_queryNoWith = 8;
|
|
138
|
+
static readonly RULE_queryTerm = 9;
|
|
139
|
+
static readonly RULE_queryPrimary = 10;
|
|
140
|
+
static readonly RULE_querySpecification = 11;
|
|
141
|
+
static readonly RULE_setQuantifier = 12;
|
|
142
|
+
static readonly RULE_selectItem = 13;
|
|
143
|
+
static readonly RULE_fromClause = 14;
|
|
144
|
+
static readonly RULE_relation = 15;
|
|
145
|
+
static readonly RULE_joinType = 16;
|
|
146
|
+
static readonly RULE_aliasedRelation = 17;
|
|
147
|
+
static readonly RULE_relationPrimary = 18;
|
|
148
|
+
static readonly RULE_whereClause = 19;
|
|
149
|
+
static readonly RULE_groupByClause = 20;
|
|
150
|
+
static readonly RULE_havingClause = 21;
|
|
151
|
+
static readonly RULE_orderByClause = 22;
|
|
152
|
+
static readonly RULE_sortItem = 23;
|
|
153
|
+
static readonly RULE_limitClause = 24;
|
|
154
|
+
static readonly RULE_insertStatement = 25;
|
|
155
|
+
static readonly RULE_columnList = 26;
|
|
156
|
+
static readonly RULE_updateStatement = 27;
|
|
157
|
+
static readonly RULE_updateAssignment = 28;
|
|
158
|
+
static readonly RULE_deleteStatement = 29;
|
|
159
|
+
static readonly RULE_createTableStatement = 30;
|
|
160
|
+
static readonly RULE_tableElement = 31;
|
|
161
|
+
static readonly RULE_columnDefinition = 32;
|
|
162
|
+
static readonly RULE_tableConstraint = 33;
|
|
163
|
+
static readonly RULE_alterTableStatement = 34;
|
|
164
|
+
static readonly RULE_dropTableStatement = 35;
|
|
165
|
+
static readonly RULE_expression = 36;
|
|
166
|
+
static readonly RULE_booleanExpression = 37;
|
|
167
|
+
static readonly RULE_predicatedExpression = 38;
|
|
168
|
+
static readonly RULE_predicate = 39;
|
|
169
|
+
static readonly RULE_comparisonOperator = 40;
|
|
170
|
+
static readonly RULE_valueExpression = 41;
|
|
171
|
+
static readonly RULE_primaryExpression = 42;
|
|
172
|
+
static readonly RULE_whenClause = 43;
|
|
173
|
+
static readonly RULE_subqueryExpression = 44;
|
|
174
|
+
static readonly RULE_dataType = 45;
|
|
175
|
+
static readonly RULE_properties = 46;
|
|
176
|
+
static readonly RULE_property = 47;
|
|
177
|
+
static readonly RULE_literal = 48;
|
|
178
|
+
static readonly RULE_identifier = 49;
|
|
179
|
+
static readonly RULE_qualifiedName = 50;
|
|
180
|
+
static readonly RULE_columnRef = 51;
|
|
181
|
+
static readonly RULE_tableName = 52;
|
|
182
|
+
static readonly RULE_tableNameCreate = 53;
|
|
183
|
+
static readonly RULE_nonReserved = 54;
|
|
183
184
|
static readonly literalNames: (string | null)[];
|
|
184
185
|
static readonly symbolicNames: (string | null)[];
|
|
185
186
|
static readonly ruleNames: string[];
|
|
@@ -197,6 +198,7 @@ export declare class GenericSqlParser extends SQLParserBase {
|
|
|
197
198
|
queryStatement(): QueryStatementContext;
|
|
198
199
|
withClause(): WithClauseContext;
|
|
199
200
|
namedQuery(): NamedQueryContext;
|
|
201
|
+
cteColumnList(): CteColumnListContext;
|
|
200
202
|
queryNoWith(): QueryNoWithContext;
|
|
201
203
|
queryTerm(): QueryTermContext;
|
|
202
204
|
queryPrimary(): QueryPrimaryContext;
|
|
@@ -365,6 +367,16 @@ export declare class NamedQueryContext extends antlr.ParserRuleContext {
|
|
|
365
367
|
KW_AS(): antlr.TerminalNode;
|
|
366
368
|
queryStatement(): QueryStatementContext;
|
|
367
369
|
identifier(): IdentifierContext;
|
|
370
|
+
cteColumnList(): CteColumnListContext | null;
|
|
371
|
+
get ruleIndex(): number;
|
|
372
|
+
enterRule(listener: GenericSqlListener): void;
|
|
373
|
+
exitRule(listener: GenericSqlListener): void;
|
|
374
|
+
accept<Result>(visitor: GenericSqlVisitor<Result>): Result | null;
|
|
375
|
+
}
|
|
376
|
+
export declare class CteColumnListContext extends antlr.ParserRuleContext {
|
|
377
|
+
constructor(parent: antlr.ParserRuleContext | null, invokingState: number);
|
|
378
|
+
identifier(): IdentifierContext[];
|
|
379
|
+
identifier(i: number): IdentifierContext | null;
|
|
368
380
|
get ruleIndex(): number;
|
|
369
381
|
enterRule(listener: GenericSqlListener): void;
|
|
370
382
|
exitRule(listener: GenericSqlListener): void;
|
|
@@ -431,6 +443,7 @@ export declare class SetQuantifierContext extends antlr.ParserRuleContext {
|
|
|
431
443
|
accept<Result>(visitor: GenericSqlVisitor<Result>): Result | null;
|
|
432
444
|
}
|
|
433
445
|
export declare class SelectItemContext extends antlr.ParserRuleContext {
|
|
446
|
+
_alias?: IdentifierContext;
|
|
434
447
|
constructor(parent: antlr.ParserRuleContext | null, invokingState: number);
|
|
435
448
|
expression(): ExpressionContext | null;
|
|
436
449
|
identifier(): IdentifierContext | null;
|
|
@@ -493,6 +506,7 @@ export declare class JoinTypeContext extends antlr.ParserRuleContext {
|
|
|
493
506
|
accept<Result>(visitor: GenericSqlVisitor<Result>): Result | null;
|
|
494
507
|
}
|
|
495
508
|
export declare class AliasedRelationContext extends antlr.ParserRuleContext {
|
|
509
|
+
_alias?: IdentifierContext;
|
|
496
510
|
constructor(parent: antlr.ParserRuleContext | null, invokingState: number);
|
|
497
511
|
relationPrimary(): RelationPrimaryContext;
|
|
498
512
|
identifier(): IdentifierContext | null;
|