This commit is contained in:
Kijin-Seija 2024-06-07 15:39:49 +08:00
parent 63df067ae6
commit 9ac6039146
13 changed files with 17823 additions and 17710 deletions

View File

@ -1,6 +0,0 @@
#!/usr/bin/env sh
. "$(dirname -- "$0")/_/husky.sh"
echo 'commitlint'
npx --no -- commitlint --edit

View File

@ -1,4 +0,0 @@
#!/usr/bin/env sh
. "$(dirname -- "$0")/_/husky.sh"
npx lint-staged

View File

@ -1,5 +1,5 @@
{ {
"name": "dt-sql-parser", "name": "dt-sql-parser-oushudb",
"version": "4.0.1", "version": "4.0.1",
"authors": "DTStack Corporation", "authors": "DTStack Corporation",
"description": "SQL Parsers for BigData, built with antlr4", "description": "SQL Parsers for BigData, built with antlr4",

View File

@ -670,6 +670,10 @@ KW_SKIP_LOCKED : 'SKIP_LOCKED';
KW_BUFFER_USAGE_LIMIT : 'BUFFER_USAGE_LIMIT'; KW_BUFFER_USAGE_LIMIT : 'BUFFER_USAGE_LIMIT';
// //
// My custom keywords
KW_DISTRIBUTED : 'DISTRIBUTED';
//
// IDENTIFIERS (4.1.1) // IDENTIFIERS (4.1.1)
// //

View File

@ -730,6 +730,10 @@ createstmt
) # columnCreateTable ) # columnCreateTable
; ;
optdistributed
: KW_DISTRIBUTED KW_BY OPEN_PAREN column_list CLOSE_PAREN
;
opttemp opttemp
: KW_TEMPORARY : KW_TEMPORARY
| KW_TEMP | KW_TEMP

File diff suppressed because one or more lines are too long

View File

@ -546,48 +546,49 @@ KW_EXTENDED=545
KW_MAIN=546 KW_MAIN=546
KW_SKIP_LOCKED=547 KW_SKIP_LOCKED=547
KW_BUFFER_USAGE_LIMIT=548 KW_BUFFER_USAGE_LIMIT=548
Identifier=549 KW_DISTRIBUTED=549
QuotedIdentifier=550 Identifier=550
UnterminatedQuotedIdentifier=551 QuotedIdentifier=551
InvalidQuotedIdentifier=552 UnterminatedQuotedIdentifier=552
InvalidUnterminatedQuotedIdentifier=553 InvalidQuotedIdentifier=553
UnicodeQuotedIdentifier=554 InvalidUnterminatedQuotedIdentifier=554
UnterminatedUnicodeQuotedIdentifier=555 UnicodeQuotedIdentifier=555
InvalidUnicodeQuotedIdentifier=556 UnterminatedUnicodeQuotedIdentifier=556
InvalidUnterminatedUnicodeQuotedIdentifier=557 InvalidUnicodeQuotedIdentifier=557
StringConstant=558 InvalidUnterminatedUnicodeQuotedIdentifier=558
UnterminatedStringConstant=559 StringConstant=559
UnicodeEscapeStringConstant=560 UnterminatedStringConstant=560
UnterminatedUnicodeEscapeStringConstant=561 UnicodeEscapeStringConstant=561
BeginDollarStringConstant=562 UnterminatedUnicodeEscapeStringConstant=562
BinaryStringConstant=563 BeginDollarStringConstant=563
UnterminatedBinaryStringConstant=564 BinaryStringConstant=564
InvalidBinaryStringConstant=565 UnterminatedBinaryStringConstant=565
InvalidUnterminatedBinaryStringConstant=566 InvalidBinaryStringConstant=566
HexadecimalStringConstant=567 InvalidUnterminatedBinaryStringConstant=567
UnterminatedHexadecimalStringConstant=568 HexadecimalStringConstant=568
InvalidHexadecimalStringConstant=569 UnterminatedHexadecimalStringConstant=569
InvalidUnterminatedHexadecimalStringConstant=570 InvalidHexadecimalStringConstant=570
Integral=571 InvalidUnterminatedHexadecimalStringConstant=571
NumericFail=572 Integral=572
Numeric=573 NumericFail=573
PLSQLVARIABLENAME=574 Numeric=574
PLSQLIDENTIFIER=575 PLSQLVARIABLENAME=575
Whitespace=576 PLSQLIDENTIFIER=576
Newline=577 Whitespace=577
LineComment=578 Newline=578
BlockComment=579 LineComment=579
UnterminatedBlockComment=580 BlockComment=580
MetaCommand=581 UnterminatedBlockComment=581
EndMetaCommand=582 MetaCommand=582
ErrorCharacter=583 EndMetaCommand=583
EscapeStringConstant=584 ErrorCharacter=584
UnterminatedEscapeStringConstant=585 EscapeStringConstant=585
InvalidEscapeStringConstant=586 UnterminatedEscapeStringConstant=586
InvalidUnterminatedEscapeStringConstant=587 InvalidEscapeStringConstant=587
DollarText=588 InvalidUnterminatedEscapeStringConstant=588
EndDollarStringConstant=589 DollarText=589
AfterEscapeStringConstantWithNewlineMode_Continued=590 EndDollarStringConstant=590
AfterEscapeStringConstantWithNewlineMode_Continued=591
'$'=1 '$'=1
'('=2 '('=2
')'=3 ')'=3
@ -1134,5 +1135,6 @@ AfterEscapeStringConstantWithNewlineMode_Continued=590
'MAIN'=546 'MAIN'=546
'SKIP_LOCKED'=547 'SKIP_LOCKED'=547
'BUFFER_USAGE_LIMIT'=548 'BUFFER_USAGE_LIMIT'=548
'\\\\'=582 'DISTRIBUTED'=549
'\''=590 '\\\\'=583
'\''=591

File diff suppressed because it is too large Load Diff

File diff suppressed because one or more lines are too long

View File

@ -546,48 +546,49 @@ KW_EXTENDED=545
KW_MAIN=546 KW_MAIN=546
KW_SKIP_LOCKED=547 KW_SKIP_LOCKED=547
KW_BUFFER_USAGE_LIMIT=548 KW_BUFFER_USAGE_LIMIT=548
Identifier=549 KW_DISTRIBUTED=549
QuotedIdentifier=550 Identifier=550
UnterminatedQuotedIdentifier=551 QuotedIdentifier=551
InvalidQuotedIdentifier=552 UnterminatedQuotedIdentifier=552
InvalidUnterminatedQuotedIdentifier=553 InvalidQuotedIdentifier=553
UnicodeQuotedIdentifier=554 InvalidUnterminatedQuotedIdentifier=554
UnterminatedUnicodeQuotedIdentifier=555 UnicodeQuotedIdentifier=555
InvalidUnicodeQuotedIdentifier=556 UnterminatedUnicodeQuotedIdentifier=556
InvalidUnterminatedUnicodeQuotedIdentifier=557 InvalidUnicodeQuotedIdentifier=557
StringConstant=558 InvalidUnterminatedUnicodeQuotedIdentifier=558
UnterminatedStringConstant=559 StringConstant=559
UnicodeEscapeStringConstant=560 UnterminatedStringConstant=560
UnterminatedUnicodeEscapeStringConstant=561 UnicodeEscapeStringConstant=561
BeginDollarStringConstant=562 UnterminatedUnicodeEscapeStringConstant=562
BinaryStringConstant=563 BeginDollarStringConstant=563
UnterminatedBinaryStringConstant=564 BinaryStringConstant=564
InvalidBinaryStringConstant=565 UnterminatedBinaryStringConstant=565
InvalidUnterminatedBinaryStringConstant=566 InvalidBinaryStringConstant=566
HexadecimalStringConstant=567 InvalidUnterminatedBinaryStringConstant=567
UnterminatedHexadecimalStringConstant=568 HexadecimalStringConstant=568
InvalidHexadecimalStringConstant=569 UnterminatedHexadecimalStringConstant=569
InvalidUnterminatedHexadecimalStringConstant=570 InvalidHexadecimalStringConstant=570
Integral=571 InvalidUnterminatedHexadecimalStringConstant=571
NumericFail=572 Integral=572
Numeric=573 NumericFail=573
PLSQLVARIABLENAME=574 Numeric=574
PLSQLIDENTIFIER=575 PLSQLVARIABLENAME=575
Whitespace=576 PLSQLIDENTIFIER=576
Newline=577 Whitespace=577
LineComment=578 Newline=578
BlockComment=579 LineComment=579
UnterminatedBlockComment=580 BlockComment=580
MetaCommand=581 UnterminatedBlockComment=581
EndMetaCommand=582 MetaCommand=582
ErrorCharacter=583 EndMetaCommand=583
EscapeStringConstant=584 ErrorCharacter=584
UnterminatedEscapeStringConstant=585 EscapeStringConstant=585
InvalidEscapeStringConstant=586 UnterminatedEscapeStringConstant=586
InvalidUnterminatedEscapeStringConstant=587 InvalidEscapeStringConstant=587
DollarText=588 InvalidUnterminatedEscapeStringConstant=588
EndDollarStringConstant=589 DollarText=589
AfterEscapeStringConstantWithNewlineMode_Continued=590 EndDollarStringConstant=590
AfterEscapeStringConstantWithNewlineMode_Continued=591
'$'=1 '$'=1
'('=2 '('=2
')'=3 ')'=3
@ -1134,5 +1135,6 @@ AfterEscapeStringConstantWithNewlineMode_Continued=590
'MAIN'=546 'MAIN'=546
'SKIP_LOCKED'=547 'SKIP_LOCKED'=547
'BUFFER_USAGE_LIMIT'=548 'BUFFER_USAGE_LIMIT'=548
'\\\\'=582 'DISTRIBUTED'=549
'\''=590 '\\\\'=583
'\''=591

File diff suppressed because it is too large Load Diff

View File

@ -103,6 +103,7 @@ import { Copy_generic_opt_argContext } from "./PostgreSqlParser.js";
import { Copy_generic_opt_arg_listContext } from "./PostgreSqlParser.js"; import { Copy_generic_opt_arg_listContext } from "./PostgreSqlParser.js";
import { Copy_generic_opt_arg_list_itemContext } from "./PostgreSqlParser.js"; import { Copy_generic_opt_arg_list_itemContext } from "./PostgreSqlParser.js";
import { ColumnCreateTableContext } from "./PostgreSqlParser.js"; import { ColumnCreateTableContext } from "./PostgreSqlParser.js";
import { OptdistributedContext } from "./PostgreSqlParser.js";
import { OpttempContext } from "./PostgreSqlParser.js"; import { OpttempContext } from "./PostgreSqlParser.js";
import { Table_column_listContext } from "./PostgreSqlParser.js"; import { Table_column_listContext } from "./PostgreSqlParser.js";
import { OpttableelementlistContext } from "./PostgreSqlParser.js"; import { OpttableelementlistContext } from "./PostgreSqlParser.js";
@ -1852,6 +1853,16 @@ export class PostgreSqlParserListener implements ParseTreeListener {
* @param ctx the parse tree * @param ctx the parse tree
*/ */
exitColumnCreateTable?: (ctx: ColumnCreateTableContext) => void; exitColumnCreateTable?: (ctx: ColumnCreateTableContext) => void;
/**
* Enter a parse tree produced by `PostgreSqlParser.optdistributed`.
* @param ctx the parse tree
*/
enterOptdistributed?: (ctx: OptdistributedContext) => void;
/**
* Exit a parse tree produced by `PostgreSqlParser.optdistributed`.
* @param ctx the parse tree
*/
exitOptdistributed?: (ctx: OptdistributedContext) => void;
/** /**
* Enter a parse tree produced by `PostgreSqlParser.opttemp`. * Enter a parse tree produced by `PostgreSqlParser.opttemp`.
* @param ctx the parse tree * @param ctx the parse tree

View File

@ -103,6 +103,7 @@ import { Copy_generic_opt_argContext } from "./PostgreSqlParser.js";
import { Copy_generic_opt_arg_listContext } from "./PostgreSqlParser.js"; import { Copy_generic_opt_arg_listContext } from "./PostgreSqlParser.js";
import { Copy_generic_opt_arg_list_itemContext } from "./PostgreSqlParser.js"; import { Copy_generic_opt_arg_list_itemContext } from "./PostgreSqlParser.js";
import { ColumnCreateTableContext } from "./PostgreSqlParser.js"; import { ColumnCreateTableContext } from "./PostgreSqlParser.js";
import { OptdistributedContext } from "./PostgreSqlParser.js";
import { OpttempContext } from "./PostgreSqlParser.js"; import { OpttempContext } from "./PostgreSqlParser.js";
import { Table_column_listContext } from "./PostgreSqlParser.js"; import { Table_column_listContext } from "./PostgreSqlParser.js";
import { OpttableelementlistContext } from "./PostgreSqlParser.js"; import { OpttableelementlistContext } from "./PostgreSqlParser.js";
@ -1473,6 +1474,12 @@ export class PostgreSqlParserVisitor<Result> extends AbstractParseTreeVisitor<Re
* @return the visitor result * @return the visitor result
*/ */
visitColumnCreateTable?: (ctx: ColumnCreateTableContext) => Result; visitColumnCreateTable?: (ctx: ColumnCreateTableContext) => Result;
/**
* Visit a parse tree produced by `PostgreSqlParser.optdistributed`.
* @param ctx the parse tree
* @return the visitor result
*/
visitOptdistributed?: (ctx: OptdistributedContext) => Result;
/** /**
* Visit a parse tree produced by `PostgreSqlParser.opttemp`. * Visit a parse tree produced by `PostgreSqlParser.opttemp`.
* @param ctx the parse tree * @param ctx the parse tree