dt-sql-parser 4.5.2-beta.0 → 4.5.2-beta.2
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 +8 -8
- package/dist/lib/flink/FlinkSqlParser.d.ts +220 -363
- package/dist/lib/flink/FlinkSqlParser.js +3246 -4046
- package/dist/lib/flink/FlinkSqlParserListener.d.ts +0 -154
- package/dist/lib/flink/FlinkSqlParserVisitor.d.ts +0 -98
- package/dist/lib/generic/GenericSqlListener.d.ts +90 -5
- package/dist/lib/generic/GenericSqlParser.d.ts +102 -33
- package/dist/lib/generic/GenericSqlParser.js +1329 -930
- package/dist/lib/generic/GenericSqlVisitor.d.ts +56 -3
- package/dist/lib/hive/HiveSqlParser.d.ts +515 -943
- package/dist/lib/hive/HiveSqlParser.js +8234 -10573
- package/dist/lib/hive/HiveSqlParserListener.d.ts +50 -490
- package/dist/lib/hive/HiveSqlParserVisitor.d.ts +30 -310
- package/dist/lib/impala/ImpalaSqlParser.d.ts +96 -131
- package/dist/lib/impala/ImpalaSqlParser.js +3311 -3522
- package/dist/lib/impala/ImpalaSqlParserListener.d.ts +0 -44
- package/dist/lib/impala/ImpalaSqlParserVisitor.d.ts +0 -28
- package/dist/lib/mysql/MySqlParser.d.ts +422 -464
- package/dist/lib/mysql/MySqlParser.js +9954 -10184
- package/dist/lib/mysql/MySqlParserListener.d.ts +0 -44
- package/dist/lib/mysql/MySqlParserVisitor.d.ts +0 -28
- package/dist/lib/trino/TrinoSqlListener.d.ts +0 -328
- package/dist/lib/trino/TrinoSqlParser.d.ts +203 -476
- package/dist/lib/trino/TrinoSqlParser.js +6680 -7917
- package/dist/lib/trino/TrinoSqlVisitor.d.ts +0 -206
- package/dist/parser/common/entityCollector.js +5 -0
- package/dist/parser/flink/flinkEntityCollector.js +1 -1
- package/dist/parser/generic/genericEntityCollector.d.ts +6 -3
- package/dist/parser/generic/genericEntityCollector.js +30 -42
- package/dist/parser/generic/index.js +13 -10
- package/package.json +1 -1
|
@@ -101,11 +101,7 @@ import { LikeClauseContext } from "./TrinoSqlParser.js";
|
|
|
101
101
|
import { PropertiesContext } from "./TrinoSqlParser.js";
|
|
102
102
|
import { PropertyAssignmentsContext } from "./TrinoSqlParser.js";
|
|
103
103
|
import { PropertyContext } from "./TrinoSqlParser.js";
|
|
104
|
-
import { DefaultPropertyValueContext } from "./TrinoSqlParser.js";
|
|
105
|
-
import { NonDefaultPropertyValueContext } from "./TrinoSqlParser.js";
|
|
106
104
|
import { QueryNoWithContext } from "./TrinoSqlParser.js";
|
|
107
|
-
import { LimitRowCountContext } from "./TrinoSqlParser.js";
|
|
108
|
-
import { RowCountContext } from "./TrinoSqlParser.js";
|
|
109
105
|
import { QueryTermDefaultContext } from "./TrinoSqlParser.js";
|
|
110
106
|
import { SetOperationContext } from "./TrinoSqlParser.js";
|
|
111
107
|
import { QueryPrimaryDefaultContext } from "./TrinoSqlParser.js";
|
|
@@ -141,14 +137,10 @@ import { JoinCriteriaContext } from "./TrinoSqlParser.js";
|
|
|
141
137
|
import { JoinColumnEqualityContext } from "./TrinoSqlParser.js";
|
|
142
138
|
import { JoinColumnReferenceContext } from "./TrinoSqlParser.js";
|
|
143
139
|
import { SampledRelationContext } from "./TrinoSqlParser.js";
|
|
144
|
-
import { SampleTypeContext } from "./TrinoSqlParser.js";
|
|
145
|
-
import { TrimsSpecificationContext } from "./TrinoSqlParser.js";
|
|
146
140
|
import { ListAggOverflowBehaviorContext } from "./TrinoSqlParser.js";
|
|
147
|
-
import { ListAggCountIndicationContext } from "./TrinoSqlParser.js";
|
|
148
141
|
import { PatternRecognitionContext } from "./TrinoSqlParser.js";
|
|
149
142
|
import { MeasureDefinitionContext } from "./TrinoSqlParser.js";
|
|
150
143
|
import { RowsPerMatchContext } from "./TrinoSqlParser.js";
|
|
151
|
-
import { EmptyMatchHandlingContext } from "./TrinoSqlParser.js";
|
|
152
144
|
import { SkipToContext } from "./TrinoSqlParser.js";
|
|
153
145
|
import { SubsetDefinitionContext } from "./TrinoSqlParser.js";
|
|
154
146
|
import { VariableDefinitionContext } from "./TrinoSqlParser.js";
|
|
@@ -249,23 +241,17 @@ import { JsonPathInvocationContext } from "./TrinoSqlParser.js";
|
|
|
249
241
|
import { JsonValueExpressionContext } from "./TrinoSqlParser.js";
|
|
250
242
|
import { JsonRepresentationContext } from "./TrinoSqlParser.js";
|
|
251
243
|
import { JsonArgumentContext } from "./TrinoSqlParser.js";
|
|
252
|
-
import { JsonExistsErrorBehaviorContext } from "./TrinoSqlParser.js";
|
|
253
244
|
import { JsonValueBehaviorContext } from "./TrinoSqlParser.js";
|
|
254
245
|
import { JsonQueryWrapperBehaviorContext } from "./TrinoSqlParser.js";
|
|
255
246
|
import { JsonQueryBehaviorContext } from "./TrinoSqlParser.js";
|
|
256
247
|
import { JsonObjectMemberContext } from "./TrinoSqlParser.js";
|
|
257
248
|
import { ProcessingModeContext } from "./TrinoSqlParser.js";
|
|
258
|
-
import { NullTreatmentContext } from "./TrinoSqlParser.js";
|
|
259
249
|
import { BasicStringLiteralContext } from "./TrinoSqlParser.js";
|
|
260
250
|
import { UnicodeStringLiteralContext } from "./TrinoSqlParser.js";
|
|
261
|
-
import { TimeZoneIntervalContext } from "./TrinoSqlParser.js";
|
|
262
|
-
import { TimeZoneStringContext } from "./TrinoSqlParser.js";
|
|
263
251
|
import { ComparisonOperatorContext } from "./TrinoSqlParser.js";
|
|
264
252
|
import { ComparisonQuantifierContext } from "./TrinoSqlParser.js";
|
|
265
|
-
import { BooleanValueContext } from "./TrinoSqlParser.js";
|
|
266
253
|
import { IntervalContext } from "./TrinoSqlParser.js";
|
|
267
254
|
import { IntervalFieldContext } from "./TrinoSqlParser.js";
|
|
268
|
-
import { NormalFormContext } from "./TrinoSqlParser.js";
|
|
269
255
|
import { RowTypeContext } from "./TrinoSqlParser.js";
|
|
270
256
|
import { IntervalTypeContext } from "./TrinoSqlParser.js";
|
|
271
257
|
import { ArrayTypeContext } from "./TrinoSqlParser.js";
|
|
@@ -307,20 +293,13 @@ import { ExplainFormatContext } from "./TrinoSqlParser.js";
|
|
|
307
293
|
import { ExplainTypeContext } from "./TrinoSqlParser.js";
|
|
308
294
|
import { IsolationLevelContext } from "./TrinoSqlParser.js";
|
|
309
295
|
import { TransactionAccessModeContext } from "./TrinoSqlParser.js";
|
|
310
|
-
import { ReadUncommittedContext } from "./TrinoSqlParser.js";
|
|
311
|
-
import { ReadCommittedContext } from "./TrinoSqlParser.js";
|
|
312
|
-
import { RepeatableReadContext } from "./TrinoSqlParser.js";
|
|
313
|
-
import { SerializableContext } from "./TrinoSqlParser.js";
|
|
314
296
|
import { PositionalArgumentContext } from "./TrinoSqlParser.js";
|
|
315
297
|
import { NamedArgumentContext } from "./TrinoSqlParser.js";
|
|
316
298
|
import { QualifiedArgumentContext } from "./TrinoSqlParser.js";
|
|
317
299
|
import { UnqualifiedArgumentContext } from "./TrinoSqlParser.js";
|
|
318
300
|
import { PathSpecificationContext } from "./TrinoSqlParser.js";
|
|
319
301
|
import { FunctionSpecificationContext } from "./TrinoSqlParser.js";
|
|
320
|
-
import { FunctionDeclarationContext } from "./TrinoSqlParser.js";
|
|
321
|
-
import { FunctionSignatureContext } from "./TrinoSqlParser.js";
|
|
322
302
|
import { ParameterDeclarationContext } from "./TrinoSqlParser.js";
|
|
323
|
-
import { ReturnsClauseContext } from "./TrinoSqlParser.js";
|
|
324
303
|
import { LanguageCharacteristicContext } from "./TrinoSqlParser.js";
|
|
325
304
|
import { DeterministicCharacteristicContext } from "./TrinoSqlParser.js";
|
|
326
305
|
import { ReturnsNullOnNullInputCharacteristicContext } from "./TrinoSqlParser.js";
|
|
@@ -339,12 +318,9 @@ import { LoopStatementContext } from "./TrinoSqlParser.js";
|
|
|
339
318
|
import { WhileStatementContext } from "./TrinoSqlParser.js";
|
|
340
319
|
import { RepeatStatementContext } from "./TrinoSqlParser.js";
|
|
341
320
|
import { CaseStatementWhenClauseContext } from "./TrinoSqlParser.js";
|
|
342
|
-
import { ElseIfClauseContext } from "./TrinoSqlParser.js";
|
|
343
321
|
import { ElseClauseContext } from "./TrinoSqlParser.js";
|
|
344
|
-
import { VariableDeclarationContext } from "./TrinoSqlParser.js";
|
|
345
322
|
import { SqlStatementListContext } from "./TrinoSqlParser.js";
|
|
346
323
|
import { PrivilegeContext } from "./TrinoSqlParser.js";
|
|
347
|
-
import { EntityKindContext } from "./TrinoSqlParser.js";
|
|
348
324
|
import { GrantObjectContext } from "./TrinoSqlParser.js";
|
|
349
325
|
import { TableOrViewNameContext } from "./TrinoSqlParser.js";
|
|
350
326
|
import { TableRefContext } from "./TrinoSqlParser.js";
|
|
@@ -362,8 +338,6 @@ import { EmptyColumnContext } from "./TrinoSqlParser.js";
|
|
|
362
338
|
import { ColumnNameContext } from "./TrinoSqlParser.js";
|
|
363
339
|
import { ColumnNameCreateContext } from "./TrinoSqlParser.js";
|
|
364
340
|
import { QualifiedNameContext } from "./TrinoSqlParser.js";
|
|
365
|
-
import { QueryPeriodContext } from "./TrinoSqlParser.js";
|
|
366
|
-
import { RangeTypeContext } from "./TrinoSqlParser.js";
|
|
367
341
|
import { SpecifiedPrincipalContext } from "./TrinoSqlParser.js";
|
|
368
342
|
import { CurrentUserGrantorContext } from "./TrinoSqlParser.js";
|
|
369
343
|
import { CurrentRoleGrantorContext } from "./TrinoSqlParser.js";
|
|
@@ -379,8 +353,6 @@ import { DigitIdentifierContext } from "./TrinoSqlParser.js";
|
|
|
379
353
|
import { DecimalLiteralContext } from "./TrinoSqlParser.js";
|
|
380
354
|
import { DoubleLiteralContext } from "./TrinoSqlParser.js";
|
|
381
355
|
import { IntegerLiteralContext } from "./TrinoSqlParser.js";
|
|
382
|
-
import { IdentifierUserContext } from "./TrinoSqlParser.js";
|
|
383
|
-
import { StringUserContext } from "./TrinoSqlParser.js";
|
|
384
356
|
import { NonReservedContext } from "./TrinoSqlParser.js";
|
|
385
357
|
/**
|
|
386
358
|
* This interface defines a complete generic visitor for a parse tree produced
|
|
@@ -1087,38 +1059,12 @@ export declare class TrinoSqlVisitor<Result> extends AbstractParseTreeVisitor<Re
|
|
|
1087
1059
|
* @return the visitor result
|
|
1088
1060
|
*/
|
|
1089
1061
|
visitProperty?: (ctx: PropertyContext) => Result;
|
|
1090
|
-
/**
|
|
1091
|
-
* Visit a parse tree produced by the `defaultPropertyValue`
|
|
1092
|
-
* labeled alternative in `TrinoSqlParser.propertyValue`.
|
|
1093
|
-
* @param ctx the parse tree
|
|
1094
|
-
* @return the visitor result
|
|
1095
|
-
*/
|
|
1096
|
-
visitDefaultPropertyValue?: (ctx: DefaultPropertyValueContext) => Result;
|
|
1097
|
-
/**
|
|
1098
|
-
* Visit a parse tree produced by the `nonDefaultPropertyValue`
|
|
1099
|
-
* labeled alternative in `TrinoSqlParser.propertyValue`.
|
|
1100
|
-
* @param ctx the parse tree
|
|
1101
|
-
* @return the visitor result
|
|
1102
|
-
*/
|
|
1103
|
-
visitNonDefaultPropertyValue?: (ctx: NonDefaultPropertyValueContext) => Result;
|
|
1104
1062
|
/**
|
|
1105
1063
|
* Visit a parse tree produced by `TrinoSqlParser.queryNoWith`.
|
|
1106
1064
|
* @param ctx the parse tree
|
|
1107
1065
|
* @return the visitor result
|
|
1108
1066
|
*/
|
|
1109
1067
|
visitQueryNoWith?: (ctx: QueryNoWithContext) => Result;
|
|
1110
|
-
/**
|
|
1111
|
-
* Visit a parse tree produced by `TrinoSqlParser.limitRowCount`.
|
|
1112
|
-
* @param ctx the parse tree
|
|
1113
|
-
* @return the visitor result
|
|
1114
|
-
*/
|
|
1115
|
-
visitLimitRowCount?: (ctx: LimitRowCountContext) => Result;
|
|
1116
|
-
/**
|
|
1117
|
-
* Visit a parse tree produced by `TrinoSqlParser.rowCount`.
|
|
1118
|
-
* @param ctx the parse tree
|
|
1119
|
-
* @return the visitor result
|
|
1120
|
-
*/
|
|
1121
|
-
visitRowCount?: (ctx: RowCountContext) => Result;
|
|
1122
1068
|
/**
|
|
1123
1069
|
* Visit a parse tree produced by the `queryTermDefault`
|
|
1124
1070
|
* labeled alternative in `TrinoSqlParser.queryTerm`.
|
|
@@ -1341,30 +1287,12 @@ export declare class TrinoSqlVisitor<Result> extends AbstractParseTreeVisitor<Re
|
|
|
1341
1287
|
* @return the visitor result
|
|
1342
1288
|
*/
|
|
1343
1289
|
visitSampledRelation?: (ctx: SampledRelationContext) => Result;
|
|
1344
|
-
/**
|
|
1345
|
-
* Visit a parse tree produced by `TrinoSqlParser.sampleType`.
|
|
1346
|
-
* @param ctx the parse tree
|
|
1347
|
-
* @return the visitor result
|
|
1348
|
-
*/
|
|
1349
|
-
visitSampleType?: (ctx: SampleTypeContext) => Result;
|
|
1350
|
-
/**
|
|
1351
|
-
* Visit a parse tree produced by `TrinoSqlParser.trimsSpecification`.
|
|
1352
|
-
* @param ctx the parse tree
|
|
1353
|
-
* @return the visitor result
|
|
1354
|
-
*/
|
|
1355
|
-
visitTrimsSpecification?: (ctx: TrimsSpecificationContext) => Result;
|
|
1356
1290
|
/**
|
|
1357
1291
|
* Visit a parse tree produced by `TrinoSqlParser.listAggOverflowBehavior`.
|
|
1358
1292
|
* @param ctx the parse tree
|
|
1359
1293
|
* @return the visitor result
|
|
1360
1294
|
*/
|
|
1361
1295
|
visitListAggOverflowBehavior?: (ctx: ListAggOverflowBehaviorContext) => Result;
|
|
1362
|
-
/**
|
|
1363
|
-
* Visit a parse tree produced by `TrinoSqlParser.listAggCountIndication`.
|
|
1364
|
-
* @param ctx the parse tree
|
|
1365
|
-
* @return the visitor result
|
|
1366
|
-
*/
|
|
1367
|
-
visitListAggCountIndication?: (ctx: ListAggCountIndicationContext) => Result;
|
|
1368
1296
|
/**
|
|
1369
1297
|
* Visit a parse tree produced by `TrinoSqlParser.patternRecognition`.
|
|
1370
1298
|
* @param ctx the parse tree
|
|
@@ -1383,12 +1311,6 @@ export declare class TrinoSqlVisitor<Result> extends AbstractParseTreeVisitor<Re
|
|
|
1383
1311
|
* @return the visitor result
|
|
1384
1312
|
*/
|
|
1385
1313
|
visitRowsPerMatch?: (ctx: RowsPerMatchContext) => Result;
|
|
1386
|
-
/**
|
|
1387
|
-
* Visit a parse tree produced by `TrinoSqlParser.emptyMatchHandling`.
|
|
1388
|
-
* @param ctx the parse tree
|
|
1389
|
-
* @return the visitor result
|
|
1390
|
-
*/
|
|
1391
|
-
visitEmptyMatchHandling?: (ctx: EmptyMatchHandlingContext) => Result;
|
|
1392
1314
|
/**
|
|
1393
1315
|
* Visit a parse tree produced by `TrinoSqlParser.skipTo`.
|
|
1394
1316
|
* @param ctx the parse tree
|
|
@@ -2068,12 +1990,6 @@ export declare class TrinoSqlVisitor<Result> extends AbstractParseTreeVisitor<Re
|
|
|
2068
1990
|
* @return the visitor result
|
|
2069
1991
|
*/
|
|
2070
1992
|
visitJsonArgument?: (ctx: JsonArgumentContext) => Result;
|
|
2071
|
-
/**
|
|
2072
|
-
* Visit a parse tree produced by `TrinoSqlParser.jsonExistsErrorBehavior`.
|
|
2073
|
-
* @param ctx the parse tree
|
|
2074
|
-
* @return the visitor result
|
|
2075
|
-
*/
|
|
2076
|
-
visitJsonExistsErrorBehavior?: (ctx: JsonExistsErrorBehaviorContext) => Result;
|
|
2077
1993
|
/**
|
|
2078
1994
|
* Visit a parse tree produced by `TrinoSqlParser.jsonValueBehavior`.
|
|
2079
1995
|
* @param ctx the parse tree
|
|
@@ -2104,12 +2020,6 @@ export declare class TrinoSqlVisitor<Result> extends AbstractParseTreeVisitor<Re
|
|
|
2104
2020
|
* @return the visitor result
|
|
2105
2021
|
*/
|
|
2106
2022
|
visitProcessingMode?: (ctx: ProcessingModeContext) => Result;
|
|
2107
|
-
/**
|
|
2108
|
-
* Visit a parse tree produced by `TrinoSqlParser.nullTreatment`.
|
|
2109
|
-
* @param ctx the parse tree
|
|
2110
|
-
* @return the visitor result
|
|
2111
|
-
*/
|
|
2112
|
-
visitNullTreatment?: (ctx: NullTreatmentContext) => Result;
|
|
2113
2023
|
/**
|
|
2114
2024
|
* Visit a parse tree produced by the `basicStringLiteral`
|
|
2115
2025
|
* labeled alternative in `TrinoSqlParser.string`.
|
|
@@ -2124,20 +2034,6 @@ export declare class TrinoSqlVisitor<Result> extends AbstractParseTreeVisitor<Re
|
|
|
2124
2034
|
* @return the visitor result
|
|
2125
2035
|
*/
|
|
2126
2036
|
visitUnicodeStringLiteral?: (ctx: UnicodeStringLiteralContext) => Result;
|
|
2127
|
-
/**
|
|
2128
|
-
* Visit a parse tree produced by the `timeZoneInterval`
|
|
2129
|
-
* labeled alternative in `TrinoSqlParser.timeZoneSpecifier`.
|
|
2130
|
-
* @param ctx the parse tree
|
|
2131
|
-
* @return the visitor result
|
|
2132
|
-
*/
|
|
2133
|
-
visitTimeZoneInterval?: (ctx: TimeZoneIntervalContext) => Result;
|
|
2134
|
-
/**
|
|
2135
|
-
* Visit a parse tree produced by the `timeZoneString`
|
|
2136
|
-
* labeled alternative in `TrinoSqlParser.timeZoneSpecifier`.
|
|
2137
|
-
* @param ctx the parse tree
|
|
2138
|
-
* @return the visitor result
|
|
2139
|
-
*/
|
|
2140
|
-
visitTimeZoneString?: (ctx: TimeZoneStringContext) => Result;
|
|
2141
2037
|
/**
|
|
2142
2038
|
* Visit a parse tree produced by `TrinoSqlParser.comparisonOperator`.
|
|
2143
2039
|
* @param ctx the parse tree
|
|
@@ -2150,12 +2046,6 @@ export declare class TrinoSqlVisitor<Result> extends AbstractParseTreeVisitor<Re
|
|
|
2150
2046
|
* @return the visitor result
|
|
2151
2047
|
*/
|
|
2152
2048
|
visitComparisonQuantifier?: (ctx: ComparisonQuantifierContext) => Result;
|
|
2153
|
-
/**
|
|
2154
|
-
* Visit a parse tree produced by `TrinoSqlParser.booleanValue`.
|
|
2155
|
-
* @param ctx the parse tree
|
|
2156
|
-
* @return the visitor result
|
|
2157
|
-
*/
|
|
2158
|
-
visitBooleanValue?: (ctx: BooleanValueContext) => Result;
|
|
2159
2049
|
/**
|
|
2160
2050
|
* Visit a parse tree produced by `TrinoSqlParser.interval`.
|
|
2161
2051
|
* @param ctx the parse tree
|
|
@@ -2168,12 +2058,6 @@ export declare class TrinoSqlVisitor<Result> extends AbstractParseTreeVisitor<Re
|
|
|
2168
2058
|
* @return the visitor result
|
|
2169
2059
|
*/
|
|
2170
2060
|
visitIntervalField?: (ctx: IntervalFieldContext) => Result;
|
|
2171
|
-
/**
|
|
2172
|
-
* Visit a parse tree produced by `TrinoSqlParser.normalForm`.
|
|
2173
|
-
* @param ctx the parse tree
|
|
2174
|
-
* @return the visitor result
|
|
2175
|
-
*/
|
|
2176
|
-
visitNormalForm?: (ctx: NormalFormContext) => Result;
|
|
2177
2061
|
/**
|
|
2178
2062
|
* Visit a parse tree produced by the `rowType`
|
|
2179
2063
|
* labeled alternative in `TrinoSqlParser.type`.
|
|
@@ -2453,34 +2337,6 @@ export declare class TrinoSqlVisitor<Result> extends AbstractParseTreeVisitor<Re
|
|
|
2453
2337
|
* @return the visitor result
|
|
2454
2338
|
*/
|
|
2455
2339
|
visitTransactionAccessMode?: (ctx: TransactionAccessModeContext) => Result;
|
|
2456
|
-
/**
|
|
2457
|
-
* Visit a parse tree produced by the `readUncommitted`
|
|
2458
|
-
* labeled alternative in `TrinoSqlParser.levelOfIsolation`.
|
|
2459
|
-
* @param ctx the parse tree
|
|
2460
|
-
* @return the visitor result
|
|
2461
|
-
*/
|
|
2462
|
-
visitReadUncommitted?: (ctx: ReadUncommittedContext) => Result;
|
|
2463
|
-
/**
|
|
2464
|
-
* Visit a parse tree produced by the `readCommitted`
|
|
2465
|
-
* labeled alternative in `TrinoSqlParser.levelOfIsolation`.
|
|
2466
|
-
* @param ctx the parse tree
|
|
2467
|
-
* @return the visitor result
|
|
2468
|
-
*/
|
|
2469
|
-
visitReadCommitted?: (ctx: ReadCommittedContext) => Result;
|
|
2470
|
-
/**
|
|
2471
|
-
* Visit a parse tree produced by the `repeatableRead`
|
|
2472
|
-
* labeled alternative in `TrinoSqlParser.levelOfIsolation`.
|
|
2473
|
-
* @param ctx the parse tree
|
|
2474
|
-
* @return the visitor result
|
|
2475
|
-
*/
|
|
2476
|
-
visitRepeatableRead?: (ctx: RepeatableReadContext) => Result;
|
|
2477
|
-
/**
|
|
2478
|
-
* Visit a parse tree produced by the `serializable`
|
|
2479
|
-
* labeled alternative in `TrinoSqlParser.levelOfIsolation`.
|
|
2480
|
-
* @param ctx the parse tree
|
|
2481
|
-
* @return the visitor result
|
|
2482
|
-
*/
|
|
2483
|
-
visitSerializable?: (ctx: SerializableContext) => Result;
|
|
2484
2340
|
/**
|
|
2485
2341
|
* Visit a parse tree produced by the `positionalArgument`
|
|
2486
2342
|
* labeled alternative in `TrinoSqlParser.callArgument`.
|
|
@@ -2521,30 +2377,12 @@ export declare class TrinoSqlVisitor<Result> extends AbstractParseTreeVisitor<Re
|
|
|
2521
2377
|
* @return the visitor result
|
|
2522
2378
|
*/
|
|
2523
2379
|
visitFunctionSpecification?: (ctx: FunctionSpecificationContext) => Result;
|
|
2524
|
-
/**
|
|
2525
|
-
* Visit a parse tree produced by `TrinoSqlParser.functionDeclaration`.
|
|
2526
|
-
* @param ctx the parse tree
|
|
2527
|
-
* @return the visitor result
|
|
2528
|
-
*/
|
|
2529
|
-
visitFunctionDeclaration?: (ctx: FunctionDeclarationContext) => Result;
|
|
2530
|
-
/**
|
|
2531
|
-
* Visit a parse tree produced by `TrinoSqlParser.functionSignature`.
|
|
2532
|
-
* @param ctx the parse tree
|
|
2533
|
-
* @return the visitor result
|
|
2534
|
-
*/
|
|
2535
|
-
visitFunctionSignature?: (ctx: FunctionSignatureContext) => Result;
|
|
2536
2380
|
/**
|
|
2537
2381
|
* Visit a parse tree produced by `TrinoSqlParser.parameterDeclaration`.
|
|
2538
2382
|
* @param ctx the parse tree
|
|
2539
2383
|
* @return the visitor result
|
|
2540
2384
|
*/
|
|
2541
2385
|
visitParameterDeclaration?: (ctx: ParameterDeclarationContext) => Result;
|
|
2542
|
-
/**
|
|
2543
|
-
* Visit a parse tree produced by `TrinoSqlParser.returnsClause`.
|
|
2544
|
-
* @param ctx the parse tree
|
|
2545
|
-
* @return the visitor result
|
|
2546
|
-
*/
|
|
2547
|
-
visitReturnsClause?: (ctx: ReturnsClauseContext) => Result;
|
|
2548
2386
|
/**
|
|
2549
2387
|
* Visit a parse tree produced by the `languageCharacteristic`
|
|
2550
2388
|
* labeled alternative in `TrinoSqlParser.routineCharacteristic`.
|
|
@@ -2670,24 +2508,12 @@ export declare class TrinoSqlVisitor<Result> extends AbstractParseTreeVisitor<Re
|
|
|
2670
2508
|
* @return the visitor result
|
|
2671
2509
|
*/
|
|
2672
2510
|
visitCaseStatementWhenClause?: (ctx: CaseStatementWhenClauseContext) => Result;
|
|
2673
|
-
/**
|
|
2674
|
-
* Visit a parse tree produced by `TrinoSqlParser.elseIfClause`.
|
|
2675
|
-
* @param ctx the parse tree
|
|
2676
|
-
* @return the visitor result
|
|
2677
|
-
*/
|
|
2678
|
-
visitElseIfClause?: (ctx: ElseIfClauseContext) => Result;
|
|
2679
2511
|
/**
|
|
2680
2512
|
* Visit a parse tree produced by `TrinoSqlParser.elseClause`.
|
|
2681
2513
|
* @param ctx the parse tree
|
|
2682
2514
|
* @return the visitor result
|
|
2683
2515
|
*/
|
|
2684
2516
|
visitElseClause?: (ctx: ElseClauseContext) => Result;
|
|
2685
|
-
/**
|
|
2686
|
-
* Visit a parse tree produced by `TrinoSqlParser.variableDeclaration`.
|
|
2687
|
-
* @param ctx the parse tree
|
|
2688
|
-
* @return the visitor result
|
|
2689
|
-
*/
|
|
2690
|
-
visitVariableDeclaration?: (ctx: VariableDeclarationContext) => Result;
|
|
2691
2517
|
/**
|
|
2692
2518
|
* Visit a parse tree produced by `TrinoSqlParser.sqlStatementList`.
|
|
2693
2519
|
* @param ctx the parse tree
|
|
@@ -2700,12 +2526,6 @@ export declare class TrinoSqlVisitor<Result> extends AbstractParseTreeVisitor<Re
|
|
|
2700
2526
|
* @return the visitor result
|
|
2701
2527
|
*/
|
|
2702
2528
|
visitPrivilege?: (ctx: PrivilegeContext) => Result;
|
|
2703
|
-
/**
|
|
2704
|
-
* Visit a parse tree produced by `TrinoSqlParser.entityKind`.
|
|
2705
|
-
* @param ctx the parse tree
|
|
2706
|
-
* @return the visitor result
|
|
2707
|
-
*/
|
|
2708
|
-
visitEntityKind?: (ctx: EntityKindContext) => Result;
|
|
2709
2529
|
/**
|
|
2710
2530
|
* Visit a parse tree produced by `TrinoSqlParser.grantObject`.
|
|
2711
2531
|
* @param ctx the parse tree
|
|
@@ -2808,18 +2628,6 @@ export declare class TrinoSqlVisitor<Result> extends AbstractParseTreeVisitor<Re
|
|
|
2808
2628
|
* @return the visitor result
|
|
2809
2629
|
*/
|
|
2810
2630
|
visitQualifiedName?: (ctx: QualifiedNameContext) => Result;
|
|
2811
|
-
/**
|
|
2812
|
-
* Visit a parse tree produced by `TrinoSqlParser.queryPeriod`.
|
|
2813
|
-
* @param ctx the parse tree
|
|
2814
|
-
* @return the visitor result
|
|
2815
|
-
*/
|
|
2816
|
-
visitQueryPeriod?: (ctx: QueryPeriodContext) => Result;
|
|
2817
|
-
/**
|
|
2818
|
-
* Visit a parse tree produced by `TrinoSqlParser.rangeType`.
|
|
2819
|
-
* @param ctx the parse tree
|
|
2820
|
-
* @return the visitor result
|
|
2821
|
-
*/
|
|
2822
|
-
visitRangeType?: (ctx: RangeTypeContext) => Result;
|
|
2823
2631
|
/**
|
|
2824
2632
|
* Visit a parse tree produced by the `specifiedPrincipal`
|
|
2825
2633
|
* labeled alternative in `TrinoSqlParser.grantor`.
|
|
@@ -2923,20 +2731,6 @@ export declare class TrinoSqlVisitor<Result> extends AbstractParseTreeVisitor<Re
|
|
|
2923
2731
|
* @return the visitor result
|
|
2924
2732
|
*/
|
|
2925
2733
|
visitIntegerLiteral?: (ctx: IntegerLiteralContext) => Result;
|
|
2926
|
-
/**
|
|
2927
|
-
* Visit a parse tree produced by the `identifierUser`
|
|
2928
|
-
* labeled alternative in `TrinoSqlParser.authorizationUser`.
|
|
2929
|
-
* @param ctx the parse tree
|
|
2930
|
-
* @return the visitor result
|
|
2931
|
-
*/
|
|
2932
|
-
visitIdentifierUser?: (ctx: IdentifierUserContext) => Result;
|
|
2933
|
-
/**
|
|
2934
|
-
* Visit a parse tree produced by the `stringUser`
|
|
2935
|
-
* labeled alternative in `TrinoSqlParser.authorizationUser`.
|
|
2936
|
-
* @param ctx the parse tree
|
|
2937
|
-
* @return the visitor result
|
|
2938
|
-
*/
|
|
2939
|
-
visitStringUser?: (ctx: StringUserContext) => Result;
|
|
2940
2734
|
/**
|
|
2941
2735
|
* Visit a parse tree produced by `TrinoSqlParser.nonReserved`.
|
|
2942
2736
|
* @param ctx the parse tree
|
|
@@ -233,6 +233,11 @@ const CTE_CLAUSE_CONTEXT_NAMES = new Set([
|
|
|
233
233
|
'CtesContext',
|
|
234
234
|
'WithContext',
|
|
235
235
|
]);
|
|
236
|
+
/**
|
|
237
|
+
* Strip outer quotes/brackets and lowercase for CTE name matching.
|
|
238
|
+
* Quoted forms are lowercased too on purpose — loose match for completion UX
|
|
239
|
+
* across dialects, not dialect-accurate case folding (e.g. PostgreSQL quoted ids).
|
|
240
|
+
*/
|
|
236
241
|
function normalizeIdent(text) {
|
|
237
242
|
let value = text.trim();
|
|
238
243
|
if ((value.startsWith('`') && value.endsWith('`') && value.length >= 2) ||
|
|
@@ -60,7 +60,7 @@ export class FlinkEntityCollector extends EntityCollector {
|
|
|
60
60
|
}
|
|
61
61
|
exitWithItem(ctx) {
|
|
62
62
|
var _a, _b;
|
|
63
|
-
this.collectCte(ctx, ctx.
|
|
63
|
+
this.collectCte(ctx, ctx.identifier(), ctx.queryStatement(), (_b = (_a = ctx.stop) === null || _a === void 0 ? void 0 : _a.tokenIndex) !== null && _b !== void 0 ? _b : -1, ctx.columnName());
|
|
64
64
|
}
|
|
65
65
|
exitViewPath(ctx) {
|
|
66
66
|
this.pushEntity(ctx, EntityContextType.VIEW);
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { GenericSqlListener } from '../../lib/generic/GenericSqlListener';
|
|
2
|
-
import { AlterTableContext,
|
|
2
|
+
import { AlterTableContext, ColumnRefContext, ColumnRefCreateContext, CreateTableContext, DeleteContext, DropTableContext, InsertContext, NamedQueryContext, QuerySpecificationContext, QueryStatementContext, SelectAllElementContext, SelectEmptyElementContext, SelectExpressionElementContext, SelectStarElementContext, SingleStatementContext, TableNameContext, TableNameCreateContext, UpdateContext } from '../../lib/generic/GenericSqlParser';
|
|
3
3
|
import { CommonEntityContext, EntityCollector } from '../common/entityCollector';
|
|
4
4
|
export declare class GenericEntityCollector extends EntityCollector implements GenericSqlListener {
|
|
5
5
|
/** Select-list source text for each query result. The result itself keeps the full statement. */
|
|
@@ -10,10 +10,13 @@ export declare class GenericEntityCollector extends EntityCollector implements G
|
|
|
10
10
|
exitNamedQuery(ctx: NamedQueryContext): void;
|
|
11
11
|
exitTableNameCreate(ctx: TableNameCreateContext): void;
|
|
12
12
|
exitColumnRef(ctx: ColumnRefContext): void;
|
|
13
|
-
|
|
13
|
+
exitColumnRefCreate(ctx: ColumnRefCreateContext): void;
|
|
14
14
|
exitQuerySpecification(ctx: QuerySpecificationContext): void;
|
|
15
15
|
protected adaptOutwardQueryResult(entity: CommonEntityContext): CommonEntityContext;
|
|
16
|
-
|
|
16
|
+
exitSelectExpressionElement(ctx: SelectExpressionElementContext): void;
|
|
17
|
+
exitSelectStarElement(ctx: SelectStarElementContext): void;
|
|
18
|
+
exitSelectAllElement(ctx: SelectAllElementContext): void;
|
|
19
|
+
exitSelectEmptyElement(ctx: SelectEmptyElementContext): void;
|
|
17
20
|
private isSimpleColumnReference;
|
|
18
21
|
/** ===== Statement begin */
|
|
19
22
|
enterSingleStatement(ctx: SingleStatementContext): void;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { ColumnDefinitionContext, AliasedRelationContext, CreateTableStatementContext, } from '../../lib/generic/GenericSqlParser';
|
|
2
|
-
import { AttrName, ColumnDeclareType, EntityCollector,
|
|
2
|
+
import { AttrName, ColumnDeclareType, EntityCollector, isCommonEntityContext, StmtContextType, TableDeclareType, } from '../common/entityCollector';
|
|
3
3
|
import { EntityContextType } from '../common/types';
|
|
4
4
|
import { tokenToWord } from '../common/textAndWord';
|
|
5
5
|
export class GenericEntityCollector extends EntityCollector {
|
|
@@ -38,33 +38,17 @@ export class GenericEntityCollector extends EntityCollector {
|
|
|
38
38
|
exitColumnRef(ctx) {
|
|
39
39
|
this.pushEntity(ctx, EntityContextType.COLUMN);
|
|
40
40
|
}
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
41
|
+
exitColumnRefCreate(ctx) {
|
|
42
|
+
this.pushEntity(ctx, EntityContextType.COLUMN_CREATE, [
|
|
43
|
+
{
|
|
44
|
+
attrName: AttrName.colType,
|
|
45
|
+
endContextList: [ColumnDefinitionContext.name],
|
|
46
|
+
},
|
|
46
47
|
{
|
|
47
48
|
attrName: AttrName.comment,
|
|
48
49
|
endContextList: [ColumnDefinitionContext.name],
|
|
49
50
|
},
|
|
50
51
|
]);
|
|
51
|
-
const dataType = ctx.dataType();
|
|
52
|
-
if (entity && isColumnEntityContext(entity) && (dataType === null || dataType === void 0 ? void 0 : dataType.start) && dataType.stop) {
|
|
53
|
-
const startIndex = dataType.start.start;
|
|
54
|
-
const endIndex = dataType.stop.stop;
|
|
55
|
-
const typeText = this.sourceSlice(startIndex, endIndex);
|
|
56
|
-
const startColumn = dataType.start.column + 1;
|
|
57
|
-
entity[AttrName.colType] = {
|
|
58
|
-
text: typeText,
|
|
59
|
-
line: dataType.start.line,
|
|
60
|
-
startIndex,
|
|
61
|
-
endIndex,
|
|
62
|
-
startColumn,
|
|
63
|
-
endColumn: dataType.stop.line === dataType.start.line
|
|
64
|
-
? startColumn + typeText.length
|
|
65
|
-
: dataType.stop.column + 1 + ((_b = (_a = dataType.stop.text) === null || _a === void 0 ? void 0 : _a.length) !== null && _b !== void 0 ? _b : 0),
|
|
66
|
-
};
|
|
67
|
-
}
|
|
68
52
|
}
|
|
69
53
|
exitQuerySpecification(ctx) {
|
|
70
54
|
var _a, _b;
|
|
@@ -82,28 +66,32 @@ export class GenericEntityCollector extends EntityCollector {
|
|
|
82
66
|
return entity;
|
|
83
67
|
return Object.assign(Object.assign({}, entity), { text });
|
|
84
68
|
}
|
|
85
|
-
|
|
69
|
+
exitSelectExpressionElement(ctx) {
|
|
86
70
|
var _a;
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
const entity = this.pushEntity(ctx, EntityContextType.COLUMN, [], {
|
|
95
|
-
declareType: isSimpleColumn
|
|
96
|
-
? ColumnDeclareType.LITERAL
|
|
97
|
-
: ColumnDeclareType.EXPRESSION,
|
|
98
|
-
});
|
|
99
|
-
// The alias sits on this select item. Searching parents would pick a
|
|
100
|
-
// later item's alias and label every column with that name.
|
|
101
|
-
const aliasToken = (_a = ctx._alias) === null || _a === void 0 ? void 0 : _a.start;
|
|
102
|
-
if (entity && aliasToken) {
|
|
103
|
-
entity[AttrName.alias] = tokenToWord(aliasToken, '');
|
|
104
|
-
}
|
|
71
|
+
const isSimpleColumn = this.isSimpleColumnReference(ctx);
|
|
72
|
+
const entity = this.pushEntity(ctx, EntityContextType.COLUMN, [], {
|
|
73
|
+
declareType: isSimpleColumn ? ColumnDeclareType.LITERAL : ColumnDeclareType.EXPRESSION,
|
|
74
|
+
});
|
|
75
|
+
const aliasToken = (_a = ctx._alias) === null || _a === void 0 ? void 0 : _a.start;
|
|
76
|
+
if (entity && aliasToken) {
|
|
77
|
+
entity[AttrName.alias] = tokenToWord(aliasToken, '');
|
|
105
78
|
}
|
|
106
79
|
}
|
|
80
|
+
exitSelectStarElement(ctx) {
|
|
81
|
+
this.pushEntity(ctx, EntityContextType.COLUMN, [], {
|
|
82
|
+
declareType: ColumnDeclareType.ALL,
|
|
83
|
+
});
|
|
84
|
+
}
|
|
85
|
+
exitSelectAllElement(ctx) {
|
|
86
|
+
this.pushEntity(ctx, EntityContextType.COLUMN, [], {
|
|
87
|
+
declareType: ColumnDeclareType.ALL,
|
|
88
|
+
});
|
|
89
|
+
}
|
|
90
|
+
exitSelectEmptyElement(ctx) {
|
|
91
|
+
this.pushEntity(ctx, EntityContextType.COLUMN, [], {
|
|
92
|
+
declareType: ColumnDeclareType.LITERAL,
|
|
93
|
+
});
|
|
94
|
+
}
|
|
107
95
|
isSimpleColumnReference(ctx) {
|
|
108
96
|
const text = ctx.getText();
|
|
109
97
|
// Simple column reference: no parentheses, no operators, no spaces
|
|
@@ -19,7 +19,9 @@ export class GenericSQL extends BasicSQL {
|
|
|
19
19
|
GenericSqlParser.RULE_tableName,
|
|
20
20
|
GenericSqlParser.RULE_tableNameCreate,
|
|
21
21
|
GenericSqlParser.RULE_columnRef,
|
|
22
|
-
GenericSqlParser.
|
|
22
|
+
GenericSqlParser.RULE_columnRefCreate,
|
|
23
|
+
GenericSqlParser.RULE_columnName,
|
|
24
|
+
GenericSqlParser.RULE_functionName,
|
|
23
25
|
...this.excludeKeywordRules,
|
|
24
26
|
]);
|
|
25
27
|
this._diagnostics = (options === null || options === void 0 ? void 0 : options.diagnostics) !== false;
|
|
@@ -69,15 +71,16 @@ export class GenericSQL extends BasicSQL {
|
|
|
69
71
|
syntaxContextType = EntityContextType.COLUMN;
|
|
70
72
|
break;
|
|
71
73
|
}
|
|
72
|
-
case GenericSqlParser.
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
74
|
+
case GenericSqlParser.RULE_columnRefCreate: {
|
|
75
|
+
syntaxContextType = EntityContextType.COLUMN_CREATE;
|
|
76
|
+
break;
|
|
77
|
+
}
|
|
78
|
+
case GenericSqlParser.RULE_columnName: {
|
|
79
|
+
syntaxContextType = EntityContextType.COLUMN;
|
|
80
|
+
break;
|
|
81
|
+
}
|
|
82
|
+
case GenericSqlParser.RULE_functionName: {
|
|
83
|
+
syntaxContextType = EntityContextType.FUNCTION;
|
|
81
84
|
break;
|
|
82
85
|
}
|
|
83
86
|
default:
|