This commit is contained in:
Kijin-Seija 2024-06-19 20:14:16 +08:00
parent fe2b0fd9ea
commit a5c6d2e1f8
11 changed files with 18442 additions and 18342 deletions

View File

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

View File

@ -672,6 +672,7 @@ KW_BUFFER_USAGE_LIMIT : 'BUFFER_USAGE_LIMIT';
// My custom keywords // My custom keywords
KW_DISTRIBUTED : 'DISTRIBUTED'; KW_DISTRIBUTED : 'DISTRIBUTED';
KW_WRITABLE : 'WRITABLE';
// //
// IDENTIFIERS (4.1.1) // IDENTIFIERS (4.1.1)

View File

@ -722,14 +722,18 @@ copy_generic_opt_arg_list_item
; ;
createstmt createstmt
: KW_CREATE opttemp? KW_TABLE opt_if_not_exists? table_name_create ( : create_table_clause opt_if_not_exists? table_name_create (
OPEN_PAREN table_column_list? CLOSE_PAREN optinherit? optpartitionspec? table_access_method_clause? optwith? oncommitoption? opttablespace? OPEN_PAREN table_column_list? CLOSE_PAREN optinherit? optpartitionspec? table_access_method_clause? optwith? oncommitoption? opttablespace? optdistributed?
| KW_OF any_name opttypedtableelementlist? optpartitionspec? table_access_method_clause? optwith? oncommitoption? opttablespace? | KW_OF any_name opttypedtableelementlist? optpartitionspec? table_access_method_clause? optwith? oncommitoption? opttablespace?
| KW_PARTITION KW_OF qualified_name opttypedtableelementlist? partitionboundspec optpartitionspec? table_access_method_clause? optwith? | KW_PARTITION KW_OF qualified_name opttypedtableelementlist? partitionboundspec optpartitionspec? table_access_method_clause? optwith?
oncommitoption? opttablespace? oncommitoption? opttablespace?
) # columnCreateTable ) # columnCreateTable
; ;
create_table_clause
: KW_CREATE opttemp? KW_WRITABLE? KW_EXTERNAL? KW_TABLE
;
optdistributed optdistributed
: KW_DISTRIBUTED KW_BY OPEN_PAREN column_list CLOSE_PAREN : KW_DISTRIBUTED KW_BY OPEN_PAREN column_list CLOSE_PAREN
; ;
@ -1001,7 +1005,7 @@ alterstatsstmt
; ;
createasstmt createasstmt
: KW_CREATE opttemp? KW_TABLE opt_if_not_exists? create_as_target KW_AS selectstmt opt_with_data? # queryCreateTable : create_table_clause opt_if_not_exists? create_as_target KW_AS selectstmt opt_with_data? # queryCreateTable
; ;
create_as_target create_as_target
@ -2842,7 +2846,7 @@ preparablestmt
executestmt executestmt
: KW_EXECUTE name execute_param_clause? : KW_EXECUTE name execute_param_clause?
| KW_CREATE opttemp? KW_TABLE opt_if_not_exists? create_as_target KW_AS KW_EXECUTE name execute_param_clause? opt_with_data? | create_table_clause opt_if_not_exists? create_as_target KW_AS KW_EXECUTE name execute_param_clause? opt_with_data?
; ;
execute_param_clause execute_param_clause

File diff suppressed because one or more lines are too long

View File

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

File diff suppressed because it is too large Load Diff

File diff suppressed because one or more lines are too long

View File

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

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 { Create_table_clauseContext } from "./PostgreSqlParser.js";
import { OptdistributedContext } 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";
@ -1853,6 +1854,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.create_table_clause`.
* @param ctx the parse tree
*/
enterCreate_table_clause?: (ctx: Create_table_clauseContext) => void;
/**
* Exit a parse tree produced by `PostgreSqlParser.create_table_clause`.
* @param ctx the parse tree
*/
exitCreate_table_clause?: (ctx: Create_table_clauseContext) => void;
/** /**
* Enter a parse tree produced by `PostgreSqlParser.optdistributed`. * Enter a parse tree produced by `PostgreSqlParser.optdistributed`.
* @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 { Create_table_clauseContext } from "./PostgreSqlParser.js";
import { OptdistributedContext } 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";
@ -1474,6 +1475,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.create_table_clause`.
* @param ctx the parse tree
* @return the visitor result
*/
visitCreate_table_clause?: (ctx: Create_table_clauseContext) => Result;
/** /**
* Visit a parse tree produced by `PostgreSqlParser.optdistributed`. * Visit a parse tree produced by `PostgreSqlParser.optdistributed`.
* @param ctx the parse tree * @param ctx the parse tree