dt-sql-parser 4.0.0-beta.4.2 → 4.0.0-beta.4.3
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 +124 -43
- package/dist/index.d.ts +3 -3
- package/dist/index.js +2 -2
- package/dist/index.js.map +1 -1
- package/dist/lib/flinksql/FlinkSqlParser.d.ts +122 -64
- package/dist/lib/flinksql/FlinkSqlParser.js +3429 -2829
- package/dist/lib/flinksql/FlinkSqlParser.js.map +1 -1
- package/dist/lib/flinksql/FlinkSqlParserListener.d.ts +44 -0
- package/dist/lib/flinksql/FlinkSqlParserVisitor.d.ts +28 -0
- package/dist/lib/hive/HiveSqlLexer.d.ts +365 -350
- package/dist/lib/hive/HiveSqlLexer.js +2395 -2339
- package/dist/lib/hive/HiveSqlLexer.js.map +1 -1
- package/dist/lib/hive/HiveSqlParser.d.ts +1213 -967
- package/dist/lib/hive/HiveSqlParser.js +10262 -8596
- package/dist/lib/hive/HiveSqlParser.js.map +1 -1
- package/dist/lib/hive/HiveSqlParserListener.d.ts +225 -27
- package/dist/lib/hive/HiveSqlParserVisitor.d.ts +143 -17
- package/dist/lib/pgsql/PostgreSQLLexerBase.js +0 -4
- package/dist/lib/pgsql/PostgreSQLLexerBase.js.map +1 -1
- package/dist/lib/pgsql/PostgreSQLParserBase.js +0 -6
- package/dist/lib/pgsql/PostgreSQLParserBase.js.map +1 -1
- package/dist/lib/spark/SparkSqlLexer.d.ts +398 -322
- package/dist/lib/spark/SparkSqlLexer.js +2302 -1738
- package/dist/lib/spark/SparkSqlLexer.js.map +1 -1
- package/dist/lib/spark/SparkSqlParser.d.ts +3319 -3314
- package/dist/lib/spark/SparkSqlParser.js +18718 -16132
- package/dist/lib/spark/SparkSqlParser.js.map +1 -1
- package/dist/lib/spark/SparkSqlParserListener.d.ts +2130 -0
- package/dist/lib/spark/SparkSqlParserListener.js +3 -0
- package/dist/lib/spark/SparkSqlParserListener.js.map +1 -0
- package/dist/lib/spark/SparkSqlParserVisitor.d.ts +1361 -0
- package/dist/lib/spark/SparkSqlParserVisitor.js +3 -0
- package/dist/lib/spark/SparkSqlParserVisitor.js.map +1 -0
- package/dist/parser/common/basic-parser-types.d.ts +16 -3
- package/dist/parser/common/basic-parser-types.js +12 -2
- package/dist/parser/common/basic-parser-types.js.map +1 -1
- package/dist/parser/common/basicParser.d.ts +27 -28
- package/dist/parser/common/basicParser.js +76 -60
- package/dist/parser/common/basicParser.js.map +1 -1
- package/dist/parser/common/parseErrorListener.d.ts +33 -0
- package/dist/parser/common/parseErrorListener.js +28 -0
- package/dist/parser/common/parseErrorListener.js.map +1 -0
- package/dist/parser/flinksql.js +32 -13
- package/dist/parser/flinksql.js.map +1 -1
- package/dist/parser/generic.js +1 -1
- package/dist/parser/generic.js.map +1 -1
- package/dist/parser/hive.d.ts +10 -3
- package/dist/parser/hive.js +89 -5
- package/dist/parser/hive.js.map +1 -1
- package/dist/parser/index.d.ts +1 -0
- package/dist/parser/index.js +1 -0
- package/dist/parser/index.js.map +1 -1
- package/dist/parser/pgsql.js +1 -1
- package/dist/parser/pgsql.js.map +1 -1
- package/dist/parser/plsql.js +1 -1
- package/dist/parser/plsql.js.map +1 -1
- package/dist/parser/spark.d.ts +10 -3
- package/dist/parser/spark.js +90 -7
- package/dist/parser/spark.js.map +1 -1
- package/dist/parser/trinosql.js +1 -1
- package/dist/parser/trinosql.js.map +1 -1
- package/dist/utils/findCaretTokenIndex.d.ts +2 -2
- package/dist/utils/findCaretTokenIndex.js +5 -4
- package/dist/utils/findCaretTokenIndex.js.map +1 -1
- package/dist/utils/index.d.ts +1 -1
- package/dist/utils/index.js +1 -5
- package/dist/utils/index.js.map +1 -1
- package/dist/utils/token.d.ts +2 -2
- package/dist/utils/token.js +2 -2
- package/dist/utils/token.js.map +1 -1
- package/package.json +15 -9
- package/dist/lib/spark/SparkSqlListener.d.ts +0 -3516
- package/dist/lib/spark/SparkSqlListener.js +0 -3
- package/dist/lib/spark/SparkSqlListener.js.map +0 -1
- package/dist/lib/spark/SparkSqlVisitor.d.ts +0 -2201
- package/dist/lib/spark/SparkSqlVisitor.js +0 -3
- package/dist/lib/spark/SparkSqlVisitor.js.map +0 -1
- package/dist/parser/common/parserErrorListener.d.ts +0 -30
- package/dist/parser/common/parserErrorListener.js +0 -62
- package/dist/parser/common/parserErrorListener.js.map +0 -1
package/README.md
CHANGED
|
@@ -15,9 +15,9 @@ English | [简体中文](./README-zh_CN.md)
|
|
|
15
15
|
|
|
16
16
|
dt-sql-parser is a **SQL Parser** project built with [ANTLR4](https://github.com/antlr/antlr4), and it's mainly for the **BigData** domain. The [ANTLR4](https://github.com/antlr/antlr4) generated the basic Parser, Visitor, and Listener, so it's easy to complete the **syntax validation**, **tokenizer**, **traverse** the AST, and so on features.
|
|
17
17
|
|
|
18
|
-
|
|
18
|
+
Additionally, it provides auxiliary functions such as SQL splitting and Auto-Complete.
|
|
19
19
|
|
|
20
|
-
Supported SQL
|
|
20
|
+
**Supported SQL**:
|
|
21
21
|
|
|
22
22
|
- Generic SQL (MySQL)
|
|
23
23
|
- Flink SQL
|
|
@@ -27,32 +27,56 @@ Supported SQL:
|
|
|
27
27
|
- PostgreSQL
|
|
28
28
|
- Trino SQL
|
|
29
29
|
|
|
30
|
+
**Supported auxiliary methods**
|
|
31
|
+
|
|
32
|
+
| SQL Type | SQL Split | Auto-Complete |
|
|
33
|
+
| ----------- | -------- | -------- |
|
|
34
|
+
| Generic SQL | WIP | WIP |
|
|
35
|
+
| Flink SQL | ✅ | ✅ |
|
|
36
|
+
| Spark SQL | ✅ | ✅ |
|
|
37
|
+
| Hive SQL | ✅ | ✅ |
|
|
38
|
+
| PL/SQL | WIP | WIP |
|
|
39
|
+
| Postgre SQL | WIP | WIP |
|
|
40
|
+
| Trino SQL | WIP | WIP |
|
|
41
|
+
|
|
30
42
|
>Tips: This project is the default for Javascript language, also you can try to compile it to other languages if you need.
|
|
31
43
|
|
|
44
|
+
<br/>
|
|
45
|
+
|
|
32
46
|
## Integrating SQL Parser with Monaco Editor
|
|
33
47
|
|
|
34
48
|
We have provided a [monaco-sql-languages](https://github.com/DTStack/monaco-sql-languages) package, you can integrate with `monaco-editor`
|
|
35
49
|
easily.
|
|
36
50
|
|
|
51
|
+
<br/>
|
|
52
|
+
|
|
37
53
|
## Installation
|
|
38
54
|
|
|
39
55
|
```bash
|
|
40
|
-
|
|
56
|
+
# use npm
|
|
41
57
|
npm i dt-sql-parser --save
|
|
42
58
|
|
|
43
|
-
|
|
59
|
+
# use yarn
|
|
44
60
|
yarn add dt-sql-parser
|
|
45
61
|
```
|
|
46
62
|
|
|
47
|
-
|
|
63
|
+
<br/>
|
|
48
64
|
|
|
49
|
-
|
|
65
|
+
## Usage
|
|
66
|
+
We recommend learning the Fundamentals usage before continuing. The dt-sql-parser library provides SQL Parser classes for different types of SQL.
|
|
67
|
+
```javascript
|
|
68
|
+
import { GenericSQL, FlinkSQL, SparkSQL, HiveSQL, PLSQL, PostgresSQL, TrinoSQL } from 'dt-sql-parser';
|
|
69
|
+
```
|
|
50
70
|
|
|
51
|
-
|
|
52
|
-
|
|
71
|
+
Before employing syntax validation, code completion, and other features, it is necessary to instantiate the Parser of the relevant SQL type.
|
|
72
|
+
For instance, one can consider using `GenericSQL` as an example:
|
|
73
|
+
```javascript
|
|
74
|
+
const parser = new GenericSQL();
|
|
75
|
+
```
|
|
53
76
|
|
|
54
|
-
The
|
|
77
|
+
The following usage examples will utilize the `GenericSQL`, and the Parser for other SQL types will be employed in a similar manner as `GenericSQL`.
|
|
55
78
|
|
|
79
|
+
### Syntax Validation
|
|
56
80
|
```javascript
|
|
57
81
|
import GenericSQL from 'dt-sql-parser/dist/parser/generic';
|
|
58
82
|
|
|
@@ -197,50 +221,107 @@ TableName user1
|
|
|
197
221
|
|
|
198
222
|
> Tips: The node's method name can be found in the Listener file under the corresponding SQL directory
|
|
199
223
|
|
|
200
|
-
###
|
|
201
|
-
|
|
202
|
-
Clear the **comments** and **spaces** before and after
|
|
203
|
-
|
|
224
|
+
### Splitting SQL statements
|
|
225
|
+
Take `FlinkSQL` as an example:
|
|
204
226
|
```javascript
|
|
205
|
-
import {
|
|
206
|
-
|
|
207
|
-
const sql =
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
console.log(cleanedSql)
|
|
227
|
+
import { FlinkSQL } from 'dt-sql-parser';
|
|
228
|
+
const parser = new FlinkSQL();
|
|
229
|
+
const sql = 'SHOW TABLES;\nSELECT * FROM tb;';
|
|
230
|
+
const sqlSlices = parser.splitSQLByStatement(sql);
|
|
231
|
+
console.log(sqlSlices)
|
|
211
232
|
|
|
212
233
|
/*
|
|
213
|
-
|
|
234
|
+
[
|
|
235
|
+
{
|
|
236
|
+
startIndex: 0,
|
|
237
|
+
endIndex: 11,
|
|
238
|
+
startLine: 1,
|
|
239
|
+
endLine: 1,
|
|
240
|
+
startColumn: 1,
|
|
241
|
+
endColumn: 12,
|
|
242
|
+
text: 'SHOW TABLES;'
|
|
243
|
+
},
|
|
244
|
+
{
|
|
245
|
+
startIndex: 13,
|
|
246
|
+
endIndex: 29,
|
|
247
|
+
startLine: 2,
|
|
248
|
+
endLine: 2,
|
|
249
|
+
startColumn: 1,
|
|
250
|
+
endColumn: 17,
|
|
251
|
+
text: 'SELECT * FROM tb;'
|
|
252
|
+
}
|
|
253
|
+
]
|
|
214
254
|
*/
|
|
215
|
-
```
|
|
216
|
-
|
|
217
|
-
### Split SQL
|
|
218
|
-
|
|
219
|
-
When the SQL text is very big, you can think about to split it by `;` , and handle it by each line.
|
|
220
255
|
|
|
221
|
-
```javascript
|
|
222
|
-
import { splitSql } from 'dt-sql-parser';
|
|
223
|
-
|
|
224
|
-
const sql = `select id,name from user1;
|
|
225
|
-
select id,name from user2;`
|
|
226
|
-
const sqlList = splitSql(sql)
|
|
227
|
-
console.log(sqlList)
|
|
228
|
-
|
|
229
|
-
/*
|
|
230
|
-
["select id,name from user1;", "\nselect id,name from user2;"]
|
|
231
|
-
*/
|
|
232
256
|
```
|
|
233
257
|
|
|
234
|
-
###
|
|
235
|
-
|
|
236
|
-
|
|
258
|
+
### Code Completion
|
|
259
|
+
Obtaining autocomplete information at a specified position in SQL.
|
|
260
|
+
We can refer to the example of using `FlinkSQL`.
|
|
261
|
+
|
|
262
|
+
Invoke the `getSuggestionAtCaretPosition` method, pass the SQL content and the row and column numbers indicating the position where auto-completion is desired.
|
|
263
|
+
+ keyword candidates list
|
|
264
|
+
|
|
265
|
+
```javascript
|
|
266
|
+
import { FlinkSQL } from 'dt-sql-parser';
|
|
267
|
+
const parser = new FlinkSQL();
|
|
268
|
+
const sql = 'CREATE ';
|
|
269
|
+
const pos = { lineNumber: 1, column: 16 }; // the end position
|
|
270
|
+
const keywords = parser.getSuggestionAtCaretPosition(sql, pos)?.keywords;
|
|
271
|
+
console.log(keywords);
|
|
272
|
+
|
|
273
|
+
/*
|
|
274
|
+
[ 'CATALOG', 'FUNCTION', 'TEMPORARY', 'VIEW', 'DATABASE', 'TABLE' ]
|
|
275
|
+
*/
|
|
276
|
+
```
|
|
277
|
+
+ Obtaining information related to grammar completion
|
|
278
|
+
```javascript
|
|
279
|
+
const parser = new FlinkSQL();
|
|
280
|
+
const sql = 'SELECT * FROM tb';
|
|
281
|
+
const pos = { lineNumber: 1, column: 16 }; // after 'tb'
|
|
282
|
+
const syntaxSuggestions = parser.getSuggestionAtCaretPosition(sql, pos)?.syntax;
|
|
283
|
+
console.log(syntaxSuggestions);
|
|
284
|
+
|
|
285
|
+
/*
|
|
286
|
+
[
|
|
287
|
+
{
|
|
288
|
+
syntaxContextType: 'table',
|
|
289
|
+
wordRanges: [
|
|
290
|
+
{
|
|
291
|
+
text: 'tb',
|
|
292
|
+
startIndex: 14,
|
|
293
|
+
stopIndex: 15,
|
|
294
|
+
line: 1,
|
|
295
|
+
startColumn: 15,
|
|
296
|
+
stopColumn: 16
|
|
297
|
+
}
|
|
298
|
+
]
|
|
299
|
+
},
|
|
300
|
+
{
|
|
301
|
+
syntaxContextType: 'view',
|
|
302
|
+
wordRanges: [
|
|
303
|
+
{
|
|
304
|
+
text: 'tb',
|
|
305
|
+
startIndex: 14,
|
|
306
|
+
stopIndex: 15,
|
|
307
|
+
line: 1,
|
|
308
|
+
startColumn: 15,
|
|
309
|
+
stopColumn: 16
|
|
310
|
+
}
|
|
311
|
+
]
|
|
312
|
+
}
|
|
313
|
+
]
|
|
314
|
+
*/
|
|
315
|
+
```
|
|
316
|
+
The grammar-related autocomplete information returns an array, where each item represents what grammar can be filled in at that position. For example, the output in the above example represents that the position can be filled with either a **table name** or **a view name**. In this case, `syntaxContextType` represents the type of grammar that can be completed, and `wordRanges` represents the content that has already been filled.
|
|
237
317
|
|
|
238
|
-
|
|
318
|
+
### Other API
|
|
239
319
|
|
|
240
|
-
|
|
320
|
+
- `createLexer` Create an instance of Antlr4 Lexer and return it;
|
|
321
|
+
- `createParser` Create an instance of Antlr4 parser and return it;
|
|
322
|
+
- `parse` Parses the input SQL and returns the parse tree;
|
|
241
323
|
|
|
242
|
-
|
|
243
|
-
- Code formatting
|
|
324
|
+
<br/>
|
|
244
325
|
|
|
245
326
|
## License
|
|
246
327
|
|
package/dist/index.d.ts
CHANGED
|
@@ -8,12 +8,12 @@ export * from './lib/hive/HiveSqlParserListener';
|
|
|
8
8
|
export * from './lib/hive/HiveSqlParserVisitor';
|
|
9
9
|
export * from './lib/plsql/PlSqlParserListener';
|
|
10
10
|
export * from './lib/plsql/PlSqlParserVisitor';
|
|
11
|
-
export * from './lib/spark/
|
|
12
|
-
export * from './lib/spark/
|
|
11
|
+
export * from './lib/spark/SparkSqlParserVisitor';
|
|
12
|
+
export * from './lib/spark/SparkSqlParserListener';
|
|
13
13
|
export * from './lib/pgsql/PostgreSQLParserListener';
|
|
14
14
|
export * from './lib/pgsql/PostgreSQLParserVisitor';
|
|
15
15
|
export * from './lib/trinosql/TrinoSqlListener';
|
|
16
16
|
export * from './lib/trinosql/TrinoSqlVisitor';
|
|
17
17
|
export { SyntaxContextType } from './parser/common/basic-parser-types';
|
|
18
18
|
export type * from './parser/common/basic-parser-types';
|
|
19
|
-
export type { SyntaxError,
|
|
19
|
+
export type { SyntaxError, ParseError, ErrorHandler } from './parser/common/parseErrorListener';
|
package/dist/index.js
CHANGED
|
@@ -8,8 +8,8 @@ export * from './lib/hive/HiveSqlParserListener';
|
|
|
8
8
|
export * from './lib/hive/HiveSqlParserVisitor';
|
|
9
9
|
export * from './lib/plsql/PlSqlParserListener';
|
|
10
10
|
export * from './lib/plsql/PlSqlParserVisitor';
|
|
11
|
-
export * from './lib/spark/
|
|
12
|
-
export * from './lib/spark/
|
|
11
|
+
export * from './lib/spark/SparkSqlParserVisitor';
|
|
12
|
+
export * from './lib/spark/SparkSqlParserListener';
|
|
13
13
|
export * from './lib/pgsql/PostgreSQLParserListener';
|
|
14
14
|
export * from './lib/pgsql/PostgreSQLParserVisitor';
|
|
15
15
|
export * from './lib/trinosql/TrinoSqlListener';
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,UAAU,CAAC;AACzB,cAAc,SAAS,CAAC;AACxB,cAAc,uCAAuC,CAAC;AACtD,cAAc,sCAAsC,CAAC;AACrD,cAAc,gCAAgC,CAAC;AAC/C,cAAc,iCAAiC,CAAC;AAChD,cAAc,kCAAkC,CAAC;AACjD,cAAc,iCAAiC,CAAC;AAChD,cAAc,iCAAiC,CAAC;AAChD,cAAc,gCAAgC,CAAC;AAC/C,cAAc,
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,UAAU,CAAC;AACzB,cAAc,SAAS,CAAC;AACxB,cAAc,uCAAuC,CAAC;AACtD,cAAc,sCAAsC,CAAC;AACrD,cAAc,gCAAgC,CAAC;AAC/C,cAAc,iCAAiC,CAAC;AAChD,cAAc,kCAAkC,CAAC;AACjD,cAAc,iCAAiC,CAAC;AAChD,cAAc,iCAAiC,CAAC;AAChD,cAAc,gCAAgC,CAAC;AAC/C,cAAc,mCAAmC,CAAC;AAClD,cAAc,oCAAoC,CAAC;AACnD,cAAc,sCAAsC,CAAC;AACrD,cAAc,qCAAqC,CAAC;AACpD,cAAc,iCAAiC,CAAC;AAChD,cAAc,gCAAgC,CAAC;AAC/C,OAAO,EAAE,iBAAiB,EAAE,MAAM,oCAAoC,CAAC"}
|
|
@@ -556,57 +556,61 @@ export declare class FlinkSqlParser extends Parser {
|
|
|
556
556
|
static readonly RULE_likePredicate = 132;
|
|
557
557
|
static readonly RULE_valueExpression = 133;
|
|
558
558
|
static readonly RULE_primaryExpression = 134;
|
|
559
|
-
static readonly
|
|
560
|
-
static readonly
|
|
561
|
-
static readonly
|
|
562
|
-
static readonly
|
|
563
|
-
static readonly
|
|
564
|
-
static readonly
|
|
565
|
-
static readonly
|
|
566
|
-
static readonly
|
|
567
|
-
static readonly
|
|
568
|
-
static readonly
|
|
569
|
-
static readonly
|
|
570
|
-
static readonly
|
|
571
|
-
static readonly
|
|
572
|
-
static readonly
|
|
573
|
-
static readonly
|
|
574
|
-
static readonly
|
|
575
|
-
static readonly
|
|
576
|
-
static readonly
|
|
577
|
-
static readonly
|
|
578
|
-
static readonly
|
|
579
|
-
static readonly
|
|
580
|
-
static readonly
|
|
581
|
-
static readonly
|
|
582
|
-
static readonly
|
|
583
|
-
static readonly
|
|
584
|
-
static readonly
|
|
585
|
-
static readonly
|
|
586
|
-
static readonly
|
|
587
|
-
static readonly
|
|
588
|
-
static readonly
|
|
589
|
-
static readonly
|
|
590
|
-
static readonly
|
|
591
|
-
static readonly
|
|
592
|
-
static readonly
|
|
593
|
-
static readonly
|
|
594
|
-
static readonly
|
|
595
|
-
static readonly
|
|
596
|
-
static readonly
|
|
597
|
-
static readonly
|
|
598
|
-
static readonly
|
|
599
|
-
static readonly
|
|
600
|
-
static readonly
|
|
601
|
-
static readonly
|
|
602
|
-
static readonly
|
|
603
|
-
static readonly
|
|
604
|
-
static readonly
|
|
605
|
-
static readonly
|
|
606
|
-
static readonly
|
|
607
|
-
static readonly
|
|
608
|
-
static readonly
|
|
609
|
-
static readonly
|
|
559
|
+
static readonly RULE_functionNameCreate = 135;
|
|
560
|
+
static readonly RULE_functionName = 136;
|
|
561
|
+
static readonly RULE_functionParam = 137;
|
|
562
|
+
static readonly RULE_dereferenceDefinition = 138;
|
|
563
|
+
static readonly RULE_correlationName = 139;
|
|
564
|
+
static readonly RULE_qualifiedName = 140;
|
|
565
|
+
static readonly RULE_timeIntervalExpression = 141;
|
|
566
|
+
static readonly RULE_errorCapturingMultiUnitsInterval = 142;
|
|
567
|
+
static readonly RULE_multiUnitsInterval = 143;
|
|
568
|
+
static readonly RULE_errorCapturingUnitToUnitInterval = 144;
|
|
569
|
+
static readonly RULE_unitToUnitInterval = 145;
|
|
570
|
+
static readonly RULE_intervalValue = 146;
|
|
571
|
+
static readonly RULE_columnAlias = 147;
|
|
572
|
+
static readonly RULE_tableAlias = 148;
|
|
573
|
+
static readonly RULE_errorCapturingIdentifier = 149;
|
|
574
|
+
static readonly RULE_errorCapturingIdentifierExtra = 150;
|
|
575
|
+
static readonly RULE_identifierList = 151;
|
|
576
|
+
static readonly RULE_identifierSeq = 152;
|
|
577
|
+
static readonly RULE_identifier = 153;
|
|
578
|
+
static readonly RULE_unquotedIdentifier = 154;
|
|
579
|
+
static readonly RULE_quotedIdentifier = 155;
|
|
580
|
+
static readonly RULE_whenClause = 156;
|
|
581
|
+
static readonly RULE_catalogPath = 157;
|
|
582
|
+
static readonly RULE_catalogPathCreate = 158;
|
|
583
|
+
static readonly RULE_databasePath = 159;
|
|
584
|
+
static readonly RULE_databasePathCreate = 160;
|
|
585
|
+
static readonly RULE_tablePathCreate = 161;
|
|
586
|
+
static readonly RULE_tablePath = 162;
|
|
587
|
+
static readonly RULE_viewPath = 163;
|
|
588
|
+
static readonly RULE_viewPathCreate = 164;
|
|
589
|
+
static readonly RULE_uid = 165;
|
|
590
|
+
static readonly RULE_withOption = 166;
|
|
591
|
+
static readonly RULE_ifNotExists = 167;
|
|
592
|
+
static readonly RULE_ifExists = 168;
|
|
593
|
+
static readonly RULE_tablePropertyList = 169;
|
|
594
|
+
static readonly RULE_tableProperty = 170;
|
|
595
|
+
static readonly RULE_tablePropertyKey = 171;
|
|
596
|
+
static readonly RULE_tablePropertyValue = 172;
|
|
597
|
+
static readonly RULE_logicalOperator = 173;
|
|
598
|
+
static readonly RULE_comparisonOperator = 174;
|
|
599
|
+
static readonly RULE_bitOperator = 175;
|
|
600
|
+
static readonly RULE_mathOperator = 176;
|
|
601
|
+
static readonly RULE_unaryOperator = 177;
|
|
602
|
+
static readonly RULE_constant = 178;
|
|
603
|
+
static readonly RULE_timePointLiteral = 179;
|
|
604
|
+
static readonly RULE_stringLiteral = 180;
|
|
605
|
+
static readonly RULE_decimalLiteral = 181;
|
|
606
|
+
static readonly RULE_booleanLiteral = 182;
|
|
607
|
+
static readonly RULE_setQuantifier = 183;
|
|
608
|
+
static readonly RULE_timePointUnit = 184;
|
|
609
|
+
static readonly RULE_timeIntervalUnit = 185;
|
|
610
|
+
static readonly RULE_reservedKeywordsUsedAsFuncParam = 186;
|
|
611
|
+
static readonly RULE_reservedKeywordsUsedAsFuncName = 187;
|
|
612
|
+
static readonly RULE_reservedKeywords = 188;
|
|
613
|
+
static readonly RULE_nonReservedKeywords = 189;
|
|
610
614
|
static readonly ruleNames: string[];
|
|
611
615
|
private static readonly _LITERAL_NAMES;
|
|
612
616
|
private static readonly _SYMBOLIC_NAMES;
|
|
@@ -757,6 +761,7 @@ export declare class FlinkSqlParser extends Parser {
|
|
|
757
761
|
valueExpression(_p: number): ValueExpressionContext;
|
|
758
762
|
primaryExpression(): PrimaryExpressionContext;
|
|
759
763
|
primaryExpression(_p: number): PrimaryExpressionContext;
|
|
764
|
+
functionNameCreate(): FunctionNameCreateContext;
|
|
760
765
|
functionName(): FunctionNameContext;
|
|
761
766
|
functionParam(): FunctionParamContext;
|
|
762
767
|
dereferenceDefinition(): DereferenceDefinitionContext;
|
|
@@ -779,10 +784,13 @@ export declare class FlinkSqlParser extends Parser {
|
|
|
779
784
|
quotedIdentifier(): QuotedIdentifierContext;
|
|
780
785
|
whenClause(): WhenClauseContext;
|
|
781
786
|
catalogPath(): CatalogPathContext;
|
|
787
|
+
catalogPathCreate(): CatalogPathCreateContext;
|
|
782
788
|
databasePath(): DatabasePathContext;
|
|
783
789
|
databasePathCreate(): DatabasePathCreateContext;
|
|
784
790
|
tablePathCreate(): TablePathCreateContext;
|
|
785
791
|
tablePath(): TablePathContext;
|
|
792
|
+
viewPath(): ViewPathContext;
|
|
793
|
+
viewPathCreate(): ViewPathCreateContext;
|
|
786
794
|
uid(): UidContext;
|
|
787
795
|
withOption(): WithOptionContext;
|
|
788
796
|
ifNotExists(): IfNotExistsContext;
|
|
@@ -991,12 +999,13 @@ export declare class ShowStatememtContext extends ParserRuleContext {
|
|
|
991
999
|
KW_CATALOG(): TerminalNode | undefined;
|
|
992
1000
|
KW_DATABASE(): TerminalNode | undefined;
|
|
993
1001
|
KW_TABLES(): TerminalNode | undefined;
|
|
994
|
-
|
|
1002
|
+
databasePath(): DatabasePathContext | undefined;
|
|
995
1003
|
likePredicate(): LikePredicateContext | undefined;
|
|
996
1004
|
KW_FROM(): TerminalNode | undefined;
|
|
997
1005
|
KW_IN(): TerminalNode | undefined;
|
|
998
1006
|
KW_COLUMNS(): TerminalNode | undefined;
|
|
999
|
-
|
|
1007
|
+
viewPath(): ViewPathContext | undefined;
|
|
1008
|
+
tablePath(): TablePathContext | undefined;
|
|
1000
1009
|
KW_CREATE(): TerminalNode | undefined;
|
|
1001
1010
|
KW_TABLE(): TerminalNode | undefined;
|
|
1002
1011
|
KW_VIEW(): TerminalNode | undefined;
|
|
@@ -1502,7 +1511,7 @@ export declare class LikeOptionContext extends ParserRuleContext {
|
|
|
1502
1511
|
export declare class CreateCatalogContext extends ParserRuleContext {
|
|
1503
1512
|
KW_CREATE(): TerminalNode;
|
|
1504
1513
|
KW_CATALOG(): TerminalNode;
|
|
1505
|
-
|
|
1514
|
+
catalogPathCreate(): CatalogPathCreateContext;
|
|
1506
1515
|
withOption(): WithOptionContext;
|
|
1507
1516
|
constructor(parent: ParserRuleContext | undefined, invokingState: number);
|
|
1508
1517
|
get ruleIndex(): number;
|
|
@@ -1526,7 +1535,7 @@ export declare class CreateDatabaseContext extends ParserRuleContext {
|
|
|
1526
1535
|
export declare class CreateViewContext extends ParserRuleContext {
|
|
1527
1536
|
KW_CREATE(): TerminalNode;
|
|
1528
1537
|
KW_VIEW(): TerminalNode;
|
|
1529
|
-
|
|
1538
|
+
viewPathCreate(): ViewPathCreateContext;
|
|
1530
1539
|
KW_AS(): TerminalNode;
|
|
1531
1540
|
queryStatement(): QueryStatementContext;
|
|
1532
1541
|
KW_TEMPORARY(): TerminalNode | undefined;
|
|
@@ -1542,7 +1551,7 @@ export declare class CreateViewContext extends ParserRuleContext {
|
|
|
1542
1551
|
export declare class CreateFunctionContext extends ParserRuleContext {
|
|
1543
1552
|
KW_CREATE(): TerminalNode;
|
|
1544
1553
|
KW_FUNCTION(): TerminalNode;
|
|
1545
|
-
|
|
1554
|
+
functionNameCreate(): FunctionNameCreateContext;
|
|
1546
1555
|
KW_AS(): TerminalNode;
|
|
1547
1556
|
identifier(): IdentifierContext;
|
|
1548
1557
|
KW_TEMPORARY(): TerminalNode | undefined;
|
|
@@ -1663,7 +1672,7 @@ export declare class NotForcedContext extends ParserRuleContext {
|
|
|
1663
1672
|
export declare class AlertViewContext extends ParserRuleContext {
|
|
1664
1673
|
KW_ALTER(): TerminalNode;
|
|
1665
1674
|
KW_VIEW(): TerminalNode;
|
|
1666
|
-
|
|
1675
|
+
viewPath(): ViewPathContext;
|
|
1667
1676
|
renameDefinition(): RenameDefinitionContext | undefined;
|
|
1668
1677
|
KW_AS(): TerminalNode | undefined;
|
|
1669
1678
|
queryStatement(): QueryStatementContext | undefined;
|
|
@@ -1687,7 +1696,7 @@ export declare class AlterDatabaseContext extends ParserRuleContext {
|
|
|
1687
1696
|
export declare class AlterFunctionContext extends ParserRuleContext {
|
|
1688
1697
|
KW_ALTER(): TerminalNode;
|
|
1689
1698
|
KW_FUNCTION(): TerminalNode;
|
|
1690
|
-
|
|
1699
|
+
functionName(): FunctionNameContext;
|
|
1691
1700
|
KW_AS(): TerminalNode;
|
|
1692
1701
|
identifier(): IdentifierContext;
|
|
1693
1702
|
KW_TEMPORARY(): TerminalNode | undefined;
|
|
@@ -1743,7 +1752,7 @@ export declare class DropDatabaseContext extends ParserRuleContext {
|
|
|
1743
1752
|
export declare class DropViewContext extends ParserRuleContext {
|
|
1744
1753
|
KW_DROP(): TerminalNode;
|
|
1745
1754
|
KW_VIEW(): TerminalNode;
|
|
1746
|
-
|
|
1755
|
+
viewPath(): ViewPathContext;
|
|
1747
1756
|
KW_TEMPORARY(): TerminalNode | undefined;
|
|
1748
1757
|
ifExists(): IfExistsContext | undefined;
|
|
1749
1758
|
constructor(parent: ParserRuleContext | undefined, invokingState: number);
|
|
@@ -2029,6 +2038,7 @@ export declare class TablePrimaryContext extends ParserRuleContext {
|
|
|
2029
2038
|
systemTimePeriod(): SystemTimePeriodContext | undefined;
|
|
2030
2039
|
correlationName(): CorrelationNameContext | undefined;
|
|
2031
2040
|
KW_AS(): TerminalNode | undefined;
|
|
2041
|
+
viewPath(): ViewPathContext | undefined;
|
|
2032
2042
|
KW_LATERAL(): TerminalNode | undefined;
|
|
2033
2043
|
LR_BRACKET(): TerminalNode[];
|
|
2034
2044
|
LR_BRACKET(i: number): TerminalNode;
|
|
@@ -2851,6 +2861,14 @@ export declare class ParenthesizedExpressionContext extends PrimaryExpressionCon
|
|
|
2851
2861
|
exitRule(listener: FlinkSqlParserListener): void;
|
|
2852
2862
|
accept<Result>(visitor: FlinkSqlParserVisitor<Result>): Result;
|
|
2853
2863
|
}
|
|
2864
|
+
export declare class FunctionNameCreateContext extends ParserRuleContext {
|
|
2865
|
+
uid(): UidContext;
|
|
2866
|
+
constructor(parent: ParserRuleContext | undefined, invokingState: number);
|
|
2867
|
+
get ruleIndex(): number;
|
|
2868
|
+
enterRule(listener: FlinkSqlParserListener): void;
|
|
2869
|
+
exitRule(listener: FlinkSqlParserListener): void;
|
|
2870
|
+
accept<Result>(visitor: FlinkSqlParserVisitor<Result>): Result;
|
|
2871
|
+
}
|
|
2854
2872
|
export declare class FunctionNameContext extends ParserRuleContext {
|
|
2855
2873
|
reservedKeywordsUsedAsFuncName(): ReservedKeywordsUsedAsFuncNameContext | undefined;
|
|
2856
2874
|
nonReservedKeywords(): NonReservedKeywordsContext | undefined;
|
|
@@ -3094,7 +3112,15 @@ export declare class WhenClauseContext extends ParserRuleContext {
|
|
|
3094
3112
|
accept<Result>(visitor: FlinkSqlParserVisitor<Result>): Result;
|
|
3095
3113
|
}
|
|
3096
3114
|
export declare class CatalogPathContext extends ParserRuleContext {
|
|
3097
|
-
|
|
3115
|
+
identifier(): IdentifierContext;
|
|
3116
|
+
constructor(parent: ParserRuleContext | undefined, invokingState: number);
|
|
3117
|
+
get ruleIndex(): number;
|
|
3118
|
+
enterRule(listener: FlinkSqlParserListener): void;
|
|
3119
|
+
exitRule(listener: FlinkSqlParserListener): void;
|
|
3120
|
+
accept<Result>(visitor: FlinkSqlParserVisitor<Result>): Result;
|
|
3121
|
+
}
|
|
3122
|
+
export declare class CatalogPathCreateContext extends ParserRuleContext {
|
|
3123
|
+
identifier(): IdentifierContext;
|
|
3098
3124
|
constructor(parent: ParserRuleContext | undefined, invokingState: number);
|
|
3099
3125
|
get ruleIndex(): number;
|
|
3100
3126
|
enterRule(listener: FlinkSqlParserListener): void;
|
|
@@ -3102,7 +3128,9 @@ export declare class CatalogPathContext extends ParserRuleContext {
|
|
|
3102
3128
|
accept<Result>(visitor: FlinkSqlParserVisitor<Result>): Result;
|
|
3103
3129
|
}
|
|
3104
3130
|
export declare class DatabasePathContext extends ParserRuleContext {
|
|
3105
|
-
|
|
3131
|
+
identifier(): IdentifierContext[];
|
|
3132
|
+
identifier(i: number): IdentifierContext;
|
|
3133
|
+
DOT(): TerminalNode | undefined;
|
|
3106
3134
|
constructor(parent: ParserRuleContext | undefined, invokingState: number);
|
|
3107
3135
|
get ruleIndex(): number;
|
|
3108
3136
|
enterRule(listener: FlinkSqlParserListener): void;
|
|
@@ -3110,7 +3138,9 @@ export declare class DatabasePathContext extends ParserRuleContext {
|
|
|
3110
3138
|
accept<Result>(visitor: FlinkSqlParserVisitor<Result>): Result;
|
|
3111
3139
|
}
|
|
3112
3140
|
export declare class DatabasePathCreateContext extends ParserRuleContext {
|
|
3113
|
-
|
|
3141
|
+
identifier(): IdentifierContext[];
|
|
3142
|
+
identifier(i: number): IdentifierContext;
|
|
3143
|
+
DOT(): TerminalNode | undefined;
|
|
3114
3144
|
constructor(parent: ParserRuleContext | undefined, invokingState: number);
|
|
3115
3145
|
get ruleIndex(): number;
|
|
3116
3146
|
enterRule(listener: FlinkSqlParserListener): void;
|
|
@@ -3118,7 +3148,10 @@ export declare class DatabasePathCreateContext extends ParserRuleContext {
|
|
|
3118
3148
|
accept<Result>(visitor: FlinkSqlParserVisitor<Result>): Result;
|
|
3119
3149
|
}
|
|
3120
3150
|
export declare class TablePathCreateContext extends ParserRuleContext {
|
|
3121
|
-
|
|
3151
|
+
identifier(): IdentifierContext[];
|
|
3152
|
+
identifier(i: number): IdentifierContext;
|
|
3153
|
+
DOT(): TerminalNode[];
|
|
3154
|
+
DOT(i: number): TerminalNode;
|
|
3122
3155
|
constructor(parent: ParserRuleContext | undefined, invokingState: number);
|
|
3123
3156
|
get ruleIndex(): number;
|
|
3124
3157
|
enterRule(listener: FlinkSqlParserListener): void;
|
|
@@ -3126,7 +3159,32 @@ export declare class TablePathCreateContext extends ParserRuleContext {
|
|
|
3126
3159
|
accept<Result>(visitor: FlinkSqlParserVisitor<Result>): Result;
|
|
3127
3160
|
}
|
|
3128
3161
|
export declare class TablePathContext extends ParserRuleContext {
|
|
3129
|
-
|
|
3162
|
+
identifier(): IdentifierContext[];
|
|
3163
|
+
identifier(i: number): IdentifierContext;
|
|
3164
|
+
DOT(): TerminalNode[];
|
|
3165
|
+
DOT(i: number): TerminalNode;
|
|
3166
|
+
constructor(parent: ParserRuleContext | undefined, invokingState: number);
|
|
3167
|
+
get ruleIndex(): number;
|
|
3168
|
+
enterRule(listener: FlinkSqlParserListener): void;
|
|
3169
|
+
exitRule(listener: FlinkSqlParserListener): void;
|
|
3170
|
+
accept<Result>(visitor: FlinkSqlParserVisitor<Result>): Result;
|
|
3171
|
+
}
|
|
3172
|
+
export declare class ViewPathContext extends ParserRuleContext {
|
|
3173
|
+
identifier(): IdentifierContext[];
|
|
3174
|
+
identifier(i: number): IdentifierContext;
|
|
3175
|
+
DOT(): TerminalNode[];
|
|
3176
|
+
DOT(i: number): TerminalNode;
|
|
3177
|
+
constructor(parent: ParserRuleContext | undefined, invokingState: number);
|
|
3178
|
+
get ruleIndex(): number;
|
|
3179
|
+
enterRule(listener: FlinkSqlParserListener): void;
|
|
3180
|
+
exitRule(listener: FlinkSqlParserListener): void;
|
|
3181
|
+
accept<Result>(visitor: FlinkSqlParserVisitor<Result>): Result;
|
|
3182
|
+
}
|
|
3183
|
+
export declare class ViewPathCreateContext extends ParserRuleContext {
|
|
3184
|
+
identifier(): IdentifierContext[];
|
|
3185
|
+
identifier(i: number): IdentifierContext;
|
|
3186
|
+
DOT(): TerminalNode[];
|
|
3187
|
+
DOT(i: number): TerminalNode;
|
|
3130
3188
|
constructor(parent: ParserRuleContext | undefined, invokingState: number);
|
|
3131
3189
|
get ruleIndex(): number;
|
|
3132
3190
|
enterRule(listener: FlinkSqlParserListener): void;
|