feat: use SLL mode (#269)

* feat: use SLL(*) PredictionMode for better performance

* feat: optimize mysql grammar to fit SLL mode

* feat: optimize postgre grammmar to fit SLL mode

* feat: optimize spark grammar to fit SLL mode

* test: correct unit tests

* feat: optimize pgsql grammar
This commit is contained in:
Hayden 2024-03-19 11:27:23 +08:00 committed by GitHub
parent a05f099aa1
commit 3f62ad0d32
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
17 changed files with 29027 additions and 29449 deletions

View File

@ -902,18 +902,27 @@ replaceStatement
)? (('(' columnNames ')')? replaceStatementValuesOrSelectOrTable | setAssignmentList)
;
// into clause within a given statement can appear only once
// selectStatement
// : querySpecification lockClause? # simpleSelect
// | querySpecificationNointo lockClause? intoClause? # simpleSelect
// | queryExpression lockClause? # parenthesisSelect
// | querySpecificationNointo unionStatement+ (
// KW_UNION unionType=(KW_ALL | KW_DISTINCT)? (querySpecification | queryExpression)
// )? orderByClause? limitClause? lockClause? # unionSelect
// | queryExpressionNointo unionParenthesis+ (
// KW_UNION unionType=(KW_ALL | KW_DISTINCT)? queryExpression
// )? orderByClause? limitClause? lockClause? # unionParenthesisSelect
// | querySpecificationNointo (',' lateralStatement)+ # withLateralStatement
// ;
// TODO: Simplify the rules to fit SLL(*) Mode
selectStatement
: querySpecification lockClause? # simpleSelect
| querySpecificationNointo lockClause? intoClause? # simpleSelect
| queryExpression lockClause? # parenthesisSelect
| querySpecificationNointo unionStatement+ (
: querySpecification unionStatement* (
KW_UNION unionType=(KW_ALL | KW_DISTINCT)? (querySpecification | queryExpression)
)? orderByClause? limitClause? lockClause? # unionSelect
| queryExpressionNointo unionParenthesis+ (
)? (',' lateralStatement)* orderByClause? limitClause? lockClause? intoClause? # unionAndLateralSelect
| queryExpression unionStatement* (
KW_UNION unionType=(KW_ALL | KW_DISTINCT)? queryExpression
)? orderByClause? limitClause? lockClause? # unionParenthesisSelect
| querySpecificationNointo (',' lateralStatement)+ # withLateralStatement
)? orderByClause? limitClause? lockClause? # selectExpression
;
// https://dev.mysql.com/doc/refman/8.0/en/set-operations.html
@ -1106,34 +1115,24 @@ queryExpression
| '(' queryExpression ')'
;
queryExpressionNointo
: '(' querySpecificationNointo ')'
| '(' queryExpressionNointo ')'
;
// into clause within a given statement can appear only once
/**
* TODO: intoClause is allowed to appear multiple times,
* which is inconsistent with the actual syntax,
* but is currently unsolvable because the correct syntax cannot be handled by SLL(*) Mode
*/
querySpecification
: KW_SELECT selectSpec* selectElements intoClause? fromClause groupByClause? havingClause? windowClause? orderByClause? limitClause?
| KW_SELECT selectSpec* selectElements fromClause groupByClause? havingClause? windowClause? orderByClause? limitClause? intoClause?
;
querySpecificationNointo
: KW_SELECT selectSpec* selectElements fromClause groupByClause? havingClause? windowClause? orderByClause? limitClause?
;
unionParenthesis
: KW_UNION unionType=(KW_ALL | KW_DISTINCT)? queryExpressionNointo
: KW_SELECT selectSpec* selectElements intoClause? fromClause groupByClause? havingClause? windowClause? orderByClause? limitClause? intoClause?
;
unionStatement
: KW_UNION unionType=(KW_ALL | KW_DISTINCT)? (querySpecificationNointo | queryExpressionNointo)
: KW_UNION unionType=(KW_ALL | KW_DISTINCT)? (querySpecification | queryExpression)
;
lateralStatement
: KW_LATERAL (
querySpecificationNointo
| queryExpressionNointo
| ('(' (querySpecificationNointo | queryExpressionNointo) ')' (KW_AS? alias=uid)?)
querySpecification
| queryExpression
| ('(' (querySpecification | queryExpression) ')' (KW_AS? alias=uid)?)
)
;
@ -1187,10 +1186,10 @@ selectElements
;
selectElement
: select_element=fullId '.' '*' # selectStarElement
| columnName (KW_AS? alias=uid)? # selectColumnElement
: (LOCAL_ID VAR_ASSIGN)? expression (KW_AS? alias=uid)? # selectExpressionElement
| functionCall (KW_AS? alias=uid)? # selectFunctionElement
| (LOCAL_ID VAR_ASSIGN)? expression (KW_AS? alias=uid)? # selectExpressionElement
| select_element=fullId '.' '*' # selectStarElement
| columnName (KW_AS? alias=uid)? # selectColumnElement
;
intoClause
@ -1767,13 +1766,14 @@ userSpecification
;
alterUserAuthOption
: userName KW_IDENTIFIED KW_BY STRING_LITERAL authOptionClause
| userName KW_IDENTIFIED KW_BY KW_RANDOM KW_PASSWORD authOptionClause
| userName KW_IDENTIFIED KW_WITH authenticationRule
| userName KW_DISCARD KW_OLD KW_PASSWORD
| userName ((KW_ADD | KW_MODIFY | KW_DROP) factor factorAuthOption?)+
| userName registrationOption?
| userName
: userName (
KW_IDENTIFIED KW_BY STRING_LITERAL authOptionClause
| KW_IDENTIFIED KW_BY KW_RANDOM KW_PASSWORD authOptionClause
| KW_IDENTIFIED KW_WITH authenticationRule
| KW_DISCARD KW_OLD KW_PASSWORD
| ((KW_ADD | KW_MODIFY | KW_DROP) factor factorAuthOption?)+
| registrationOption
)?
;
// createUser auth_option, 2fa_auth_option, 3fa_auth_option

View File

@ -325,13 +325,11 @@ set_rest
;
generic_set
: (var_name | KW_ALL) (KW_TO | EQUAL)? (var_list | KW_DEFAULT)?
: (KW_ALL | var_name) (KW_TO | EQUAL)? (KW_DEFAULT | var_list)?
;
set_rest_more
: generic_set
| var_name KW_FROM KW_CURRENT
| KW_TIME KW_ZONE zone_value
: KW_TIME KW_ZONE zone_value
| KW_CATALOG sconst
| KW_SCHEMA schema_name
| KW_NAMES opt_encoding?
@ -339,6 +337,8 @@ set_rest_more
| KW_SESSION KW_AUTHORIZATION nonreservedword_or_sconst
| KW_XML KW_OPTION document_or_content
| KW_TRANSACTION KW_SNAPSHOT sconst
| var_name KW_FROM KW_CURRENT
| generic_set
;
var_name
@ -404,15 +404,15 @@ variableresetstmt
;
reset_rest
: generic_reset
| KW_TIME KW_ZONE
: KW_TIME KW_ZONE
| KW_TRANSACTION KW_ISOLATION KW_LEVEL
| KW_SESSION KW_AUTHORIZATION
| generic_reset
;
generic_reset
: var_name
| KW_ALL
: KW_ALL
| var_name
;
setresetclause
@ -513,45 +513,19 @@ index_partition_cmd
;
alter_table_cmd
: KW_ADD opt_column? opt_if_not_exists? columnDefCluase
| KW_ALTER opt_column? column_name alter_column_default
| KW_ALTER opt_column? column_name KW_DROP KW_NOT KW_NULL
| KW_ALTER opt_column? column_name KW_SET KW_NOT KW_NULL
| KW_ALTER opt_column? column_name KW_DROP KW_EXPRESSION opt_if_exists?
| KW_ALTER opt_column? column_name KW_SET KW_STATISTICS signediconst
| KW_ALTER opt_column? column_name KW_SET KW_STATISTICS signediconst
| KW_ALTER opt_column? column_name KW_SET reloptions
| KW_ALTER opt_column? column_name KW_RESET reloptions
| KW_ALTER opt_column? column_name KW_SET KW_STORAGE colid
| KW_ALTER opt_column? column_name KW_ADD KW_GENERATED generated_when KW_AS KW_IDENTITY optparenthesizedseqoptlist?
| KW_ALTER opt_column? column_name alter_identity_column_option_list
| KW_ALTER opt_column? column_name KW_DROP KW_IDENTITY opt_if_exists?
| KW_DROP opt_column? opt_if_exists? column_name opt_drop_behavior?
| KW_ALTER opt_column? column_name opt_set_data? KW_TYPE typename opt_collate_clause? alter_using?
| KW_ALTER opt_column? column_name alter_generic_options
| KW_ADD tableconstraint
: KW_ADD (KW_CONSTRAINT name)? constraintelem
| KW_ALTER KW_CONSTRAINT name constraintattributespec
| KW_VALIDATE KW_CONSTRAINT name
| KW_DROP KW_CONSTRAINT opt_if_exists? name opt_drop_behavior?
| KW_SET KW_WITHOUT KW_OIDS
| KW_CLUSTER KW_ON name
| KW_SET KW_WITHOUT KW_CLUSTER
| KW_SET KW_LOGGED
| KW_SET KW_UNLOGGED
| KW_ENABLE KW_TRIGGER name
| KW_ENABLE KW_ALWAYS KW_TRIGGER name
| KW_ENABLE KW_REPLICA KW_TRIGGER name
| KW_ENABLE KW_TRIGGER KW_ALL
| KW_ENABLE KW_TRIGGER KW_USER
| KW_DISABLE KW_TRIGGER name
| KW_DISABLE KW_TRIGGER KW_ALL
| KW_DISABLE KW_TRIGGER KW_USER
| KW_ENABLE KW_RULE name
| KW_ENABLE KW_ALWAYS KW_RULE name
| KW_ENABLE KW_REPLICA KW_RULE name
| KW_SET (KW_LOGGED | KW_UNLOGGED)
| KW_ENABLE (KW_REPLICA | KW_ALWAYS)? KW_TRIGGER
| KW_DISABLE KW_TRIGGER (KW_ALL | KW_USER | name)
| KW_ENABLE (KW_ALWAYS | KW_REPLICA) KW_RULE name
| KW_DISABLE KW_RULE name
| KW_INHERIT qualified_name
| KW_NO KW_INHERIT qualified_name
| KW_NO? KW_INHERIT qualified_name
| KW_OF any_name
| KW_NOT KW_OF
| KW_OWNER KW_TO rolespec
@ -563,6 +537,19 @@ alter_table_cmd
| KW_DISABLE KW_ROW KW_LEVEL KW_SECURITY
| KW_FORCE KW_ROW KW_LEVEL KW_SECURITY
| KW_NO KW_FORCE KW_ROW KW_LEVEL KW_SECURITY
| KW_DROP KW_COLUMN? opt_if_exists? column_name opt_drop_behavior?
| KW_ADD KW_COLUMN? opt_if_not_exists? columnDefCluase
| KW_ALTER KW_COLUMN? column_name alter_column_default
| KW_ALTER KW_COLUMN? column_name (KW_DROP | KW_SET) KW_NOT KW_NULL
| KW_ALTER KW_COLUMN? column_name KW_DROP KW_EXPRESSION opt_if_exists?
| KW_ALTER KW_COLUMN? column_name KW_SET KW_STATISTICS signediconst
| KW_ALTER KW_COLUMN? column_name (KW_SET | KW_RESET) reloptions
| KW_ALTER KW_COLUMN? column_name KW_SET KW_STORAGE colid
| KW_ALTER KW_COLUMN? column_name KW_ADD KW_GENERATED generated_when KW_AS KW_IDENTITY optparenthesizedseqoptlist?
| KW_ALTER KW_COLUMN? column_name alter_identity_column_option_list
| KW_ALTER KW_COLUMN? column_name KW_DROP KW_IDENTITY opt_if_exists?
| KW_ALTER KW_COLUMN? column_name opt_set_data? KW_TYPE typename opt_collate_clause? alter_using?
| KW_ALTER KW_COLUMN? column_name alter_generic_options
| alter_generic_options
;
@ -1058,7 +1045,7 @@ seqoptelem
| KW_MAXVALUE numericonly
| KW_MINVALUE numericonly
| KW_NO (KW_MAXVALUE | KW_MINVALUE | KW_CYCLE)
| KW_OWNED KW_BY table_column_name
| KW_OWNED KW_BY column_name
| KW_SEQUENCE KW_NAME any_name
| KW_START opt_with? numericonly
| KW_RESTART opt_with? numericonly?
@ -1478,9 +1465,7 @@ altereventtrigstmt
;
enable_trigger
: KW_ENABLE
| KW_ENABLE KW_REPLICA
| KW_ENABLE KW_ALWAYS
: KW_ENABLE (KW_REPLICA | KW_ALWAYS)?
| KW_DISABLE
;
@ -1547,9 +1532,9 @@ enum_val_list
;
alterenumstmt
: KW_ALTER KW_TYPE any_name KW_ADD KW_VALUE opt_if_not_exists? sconst
| KW_ALTER KW_TYPE any_name KW_ADD KW_VALUE opt_if_not_exists? sconst KW_BEFORE sconst
| KW_ALTER KW_TYPE any_name KW_ADD KW_VALUE opt_if_not_exists? sconst KW_AFTER sconst
: KW_ALTER KW_TYPE any_name KW_ADD KW_VALUE opt_if_not_exists? sconst (
(KW_BEFORE | KW_AFTER) sconst
)?
| KW_ALTER KW_TYPE any_name KW_RENAME KW_VALUE sconst KW_TO sconst
;
@ -1660,19 +1645,14 @@ view_nameList
;
object_type_any_name
: KW_TABLE table_name
| KW_SEQUENCE any_name
| KW_VIEW view_name
| KW_MATERIALIZED KW_VIEW view_name
: KW_FOREIGN? KW_TABLE table_name
| KW_MATERIALIZED? KW_VIEW view_name
| KW_INDEX any_name
| KW_FOREIGN KW_TABLE table_name
| KW_COLLATION any_name
| KW_CONVERSION any_name
| KW_STATISTICS any_name
| KW_TEXT KW_SEARCH KW_PARSER any_name
| KW_TEXT KW_SEARCH KW_DICTIONARY any_name
| KW_TEXT KW_SEARCH KW_TEMPLATE any_name
| KW_TEXT KW_SEARCH KW_CONFIGURATION any_name
| KW_SEQUENCE any_name
| KW_TEXT KW_SEARCH (KW_PARSER | KW_DICTIONARY | KW_TEMPLATE | KW_CONFIGURATION) any_name
;
object_type_name
@ -1700,10 +1680,6 @@ any_name_list
: any_name (COMMA any_name)*
;
table_column_name
: table_name DOT column_name
;
relation_column_name
: relation_name DOT column_name
;
@ -1725,12 +1701,13 @@ type_name_list
;
truncatestmt
: KW_TRUNCATE opt_table? relation_expr_list opt_restart_seqs? opt_drop_behavior?
: KW_TRUNCATE KW_TABLE? truncate_table (COMMA truncate_table)* (
(KW_CONTINUE | KW_RESTART) KW_IDENTITY
)? opt_drop_behavior?
;
opt_restart_seqs
: KW_CONTINUE KW_IDENTITY
| KW_RESTART KW_IDENTITY
truncate_table
: KW_ONLY? table_name STAR?
;
commentstmt
@ -1762,9 +1739,7 @@ comment_text
;
seclabelstmt
: KW_SECURITY KW_LABEL opt_provider? KW_ON object_type_any_name KW_IS security_label
| KW_SECURITY KW_LABEL opt_provider? KW_ON KW_COLUMN table_column_name KW_IS security_label
| KW_SECURITY KW_LABEL opt_provider? KW_ON object_type_name KW_IS security_label
: KW_SECURITY KW_LABEL opt_provider? KW_ON KW_COLUMN column_name KW_IS security_label
| KW_SECURITY KW_LABEL opt_provider? KW_ON KW_TYPE typename KW_IS security_label
| KW_SECURITY KW_LABEL opt_provider? KW_ON KW_DOMAIN typename KW_IS security_label
| KW_SECURITY KW_LABEL opt_provider? KW_ON KW_AGGREGATE aggregate_with_argtypes KW_IS security_label
@ -1772,6 +1747,8 @@ seclabelstmt
| KW_SECURITY KW_LABEL opt_provider? KW_ON KW_LARGE KW_OBJECT numericonly KW_IS security_label
| KW_SECURITY KW_LABEL opt_provider? KW_ON KW_PROCEDURE procedure_with_argtypes KW_IS security_label
| KW_SECURITY KW_LABEL opt_provider? KW_ON KW_ROUTINE routine_with_argtypes KW_IS security_label
| KW_SECURITY KW_LABEL opt_provider? KW_ON object_type_any_name KW_IS security_label
| KW_SECURITY KW_LABEL opt_provider? KW_ON object_type_name KW_IS security_label
;
opt_provider
@ -2335,11 +2312,11 @@ renamestmt
| KW_ALTER KW_MATERIALIZED KW_VIEW opt_if_exists? view_name KW_RENAME KW_TO view_name_create
| KW_ALTER KW_INDEX opt_if_exists? qualified_name KW_RENAME KW_TO name
| KW_ALTER KW_FOREIGN KW_TABLE opt_if_exists? relation_expr KW_RENAME KW_TO table_name_create
| KW_ALTER KW_TABLE opt_if_exists? relation_expr KW_RENAME opt_column? column_name KW_TO column_name_create
| KW_ALTER KW_VIEW opt_if_exists? view_name KW_RENAME opt_column? column_name KW_TO column_name_create
| KW_ALTER KW_MATERIALIZED KW_VIEW opt_if_exists? view_name KW_RENAME opt_column? column_name KW_TO column_name_create
| KW_ALTER KW_TABLE opt_if_exists? relation_expr KW_RENAME KW_COLUMN? column_name KW_TO column_name_create
| KW_ALTER KW_VIEW opt_if_exists? view_name KW_RENAME KW_COLUMN? column_name KW_TO column_name_create
| KW_ALTER KW_MATERIALIZED KW_VIEW opt_if_exists? view_name KW_RENAME KW_COLUMN? column_name KW_TO column_name_create
| KW_ALTER KW_TABLE opt_if_exists? relation_expr KW_RENAME KW_CONSTRAINT name KW_TO name
| KW_ALTER KW_FOREIGN KW_TABLE opt_if_exists? relation_expr KW_RENAME opt_column? column_name KW_TO column_name_create
| KW_ALTER KW_FOREIGN KW_TABLE opt_if_exists? relation_expr KW_RENAME KW_COLUMN? column_name KW_TO column_name_create
| KW_ALTER KW_RULE name KW_ON qualified_name KW_RENAME KW_TO name
| KW_ALTER KW_TRIGGER name KW_ON qualified_name KW_RENAME KW_TO name
| KW_ALTER KW_EVENT KW_TRIGGER name KW_RENAME KW_TO name
@ -2355,10 +2332,6 @@ renamestmt
| KW_ALTER KW_TYPE any_name KW_RENAME KW_ATTRIBUTE name KW_TO name opt_drop_behavior?
;
opt_column
: KW_COLUMN
;
opt_set_data
: KW_SET KW_DATA
;
@ -2560,17 +2533,15 @@ transactionstmt
: KW_ABORT opt_transaction? opt_transaction_chain?
| KW_BEGIN opt_transaction? transaction_mode_list_or_empty?
| KW_START KW_TRANSACTION transaction_mode_list_or_empty?
| KW_COMMIT opt_transaction? opt_transaction_chain?
| KW_END opt_transaction? opt_transaction_chain?
| KW_ROLLBACK opt_transaction? opt_transaction_chain?
| KW_SAVEPOINT colid
| KW_RELEASE KW_SAVEPOINT colid
| KW_RELEASE colid
| KW_ROLLBACK opt_transaction? KW_TO KW_SAVEPOINT colid
| KW_ROLLBACK opt_transaction? KW_TO colid
| KW_RELEASE KW_SAVEPOINT? colid
| KW_PREPARE KW_TRANSACTION sconst
| KW_COMMIT KW_PREPARED sconst
| KW_COMMIT opt_transaction? opt_transaction_chain?
| KW_ROLLBACK KW_PREPARED sconst
| KW_ROLLBACK opt_transaction? KW_TO KW_SAVEPOINT? colid
| KW_ROLLBACK opt_transaction? opt_transaction_chain?
;
opt_transaction
@ -2630,13 +2601,13 @@ createdb_opt_item
;
createdb_opt_name
: identifier
| KW_CONNECTION KW_LIMIT
: KW_CONNECTION KW_LIMIT
| KW_ENCODING
| KW_LOCATION
| KW_OWNER
| KW_TABLESPACE
| KW_TEMPLATE
| identifier
;
opt_equal
@ -2645,9 +2616,8 @@ opt_equal
alterdatabasestmt
: KW_ALTER KW_DATABASE database_name (
(KW_WITH? createdb_opt_list)?
| createdb_opt_list?
| (KW_SET KW_TABLESPACE tablespace_name_create)?
(KW_SET KW_TABLESPACE tablespace_name_create)?
| (KW_WITH? createdb_opt_list)?
)
;
@ -2869,10 +2839,7 @@ execute_param_clause
;
deallocatestmt
: KW_DEALLOCATE name
| KW_DEALLOCATE KW_PREPARE name
| KW_DEALLOCATE KW_ALL
| KW_DEALLOCATE KW_PREPARE KW_ALL
: KW_DEALLOCATE KW_PREPARE? (name | KW_ALL)
;
insertstmt
@ -3150,7 +3117,7 @@ fetch_clause
;
offset_clause
: KW_OFFSET (select_offset_value | select_fetch_first_value row_or_rows)
: KW_OFFSET (select_fetch_first_value row_or_rows | select_offset_value)
;
select_limit_value
@ -3163,9 +3130,9 @@ select_offset_value
;
select_fetch_first_value
: c_expr
| PLUS i_or_f_const
: PLUS i_or_f_const
| MINUS i_or_f_const
| c_expr
;
i_or_f_const
@ -3303,13 +3270,13 @@ join_qual
;
relation_expr
: KW_ONLY? table_name STAR? columnlist? where_clause?
: KW_ONLY? table_name STAR?
| KW_ONLY ( table_name | OPEN_PAREN table_name CLOSE_PAREN)
| KW_IN KW_SCHEMA (schema_name | KW_CURRENT_SCHEMA)
;
view_relation_expr
: KW_ONLY? view_name STAR? columnlist? where_clause?
: KW_ONLY? view_name STAR?
;
publication_relation_expr
@ -3737,7 +3704,6 @@ c_expr
| PARAM opt_indirection # c_expr_expr
| KW_GROUPING OPEN_PAREN expr_list CLOSE_PAREN # c_expr_expr
| /*22*/ KW_UNIQUE select_with_parens # c_expr_expr
| columnref # c_expr_expr
| aexprconst # c_expr_expr
| plsqlvariablename # c_expr_expr
| OPEN_PAREN a_expr_in_parens= a_expr CLOSE_PAREN opt_indirection # c_expr_expr
@ -3747,6 +3713,7 @@ c_expr
| explicit_row # c_expr_expr
| implicit_row # c_expr_expr
| row KW_OVERLAPS row /* 14*/ # c_expr_expr
| columnref # c_expr_expr
;
plsqlvariablename
@ -3921,7 +3888,7 @@ explicit_row
;
implicit_row
: OPEN_PAREN expr_list COMMA a_expr CLOSE_PAREN
: OPEN_PAREN a_expr COMMA expr_list CLOSE_PAREN
;
sub_type
@ -4203,7 +4170,7 @@ procedure_name_create
;
column_name
: colid
: colid indirection_el*
;
column_name_create
@ -5509,7 +5476,6 @@ plsql_unreserved_keyword
| KW_CHAIN
| KW_CLOSE
| KW_COLLATE
| KW_COLUMN
//| COLUMN_NAME
| KW_COMMIT
| KW_CONSTANT

View File

@ -716,8 +716,8 @@ setQuantifier
;
relation
: KW_LATERAL? relationPrimary relationExtension*
| tableName
: tableName
| KW_LATERAL? relationPrimary relationExtension*
;
relationExtension
@ -1940,7 +1940,6 @@ nonReserved
| KW_SCHEMAS
| KW_SECOND
| KW_SECONDS
| KW_SELECT
| KW_SEPARATED
| KW_SERDE
| KW_SERDEPROPERTIES

File diff suppressed because one or more lines are too long

File diff suppressed because it is too large Load Diff

View File

@ -219,11 +219,8 @@ import { LoadDataStatementContext } from "./MySqlParser.js";
import { LoadXmlStatementContext } from "./MySqlParser.js";
import { ParenthesizedQueryContext } from "./MySqlParser.js";
import { ReplaceStatementContext } from "./MySqlParser.js";
import { SimpleSelectContext } from "./MySqlParser.js";
import { ParenthesisSelectContext } from "./MySqlParser.js";
import { UnionSelectContext } from "./MySqlParser.js";
import { UnionParenthesisSelectContext } from "./MySqlParser.js";
import { WithLateralStatementContext } from "./MySqlParser.js";
import { UnionAndLateralSelectContext } from "./MySqlParser.js";
import { SelectExpressionContext } from "./MySqlParser.js";
import { SetOperationsContext } from "./MySqlParser.js";
import { QueryExpressionBodyContext } from "./MySqlParser.js";
import { QueryItemContext } from "./MySqlParser.js";
@ -265,10 +262,7 @@ import { OuterJoinContext } from "./MySqlParser.js";
import { NaturalJoinContext } from "./MySqlParser.js";
import { JoinSpecContext } from "./MySqlParser.js";
import { QueryExpressionContext } from "./MySqlParser.js";
import { QueryExpressionNointoContext } from "./MySqlParser.js";
import { QuerySpecificationContext } from "./MySqlParser.js";
import { QuerySpecificationNointoContext } from "./MySqlParser.js";
import { UnionParenthesisContext } from "./MySqlParser.js";
import { UnionStatementContext } from "./MySqlParser.js";
import { LateralStatementContext } from "./MySqlParser.js";
import { JsonTableContext } from "./MySqlParser.js";
@ -278,10 +272,10 @@ import { JsonOnEmptyContext } from "./MySqlParser.js";
import { JsonOnErrorContext } from "./MySqlParser.js";
import { SelectSpecContext } from "./MySqlParser.js";
import { SelectElementsContext } from "./MySqlParser.js";
import { SelectExpressionElementContext } from "./MySqlParser.js";
import { SelectFunctionElementContext } from "./MySqlParser.js";
import { SelectStarElementContext } from "./MySqlParser.js";
import { SelectColumnElementContext } from "./MySqlParser.js";
import { SelectFunctionElementContext } from "./MySqlParser.js";
import { SelectExpressionElementContext } from "./MySqlParser.js";
import { SelectIntoVariablesContext } from "./MySqlParser.js";
import { SelectIntoDumpFileContext } from "./MySqlParser.js";
import { SelectIntoTextFileContext } from "./MySqlParser.js";
@ -3099,65 +3093,29 @@ export class MySqlParserListener implements ParseTreeListener {
*/
exitReplaceStatement?: (ctx: ReplaceStatementContext) => void;
/**
* Enter a parse tree produced by the `simpleSelect`
* Enter a parse tree produced by the `unionAndLateralSelect`
* labeled alternative in `MySqlParser.selectStatement`.
* @param ctx the parse tree
*/
enterSimpleSelect?: (ctx: SimpleSelectContext) => void;
enterUnionAndLateralSelect?: (ctx: UnionAndLateralSelectContext) => void;
/**
* Exit a parse tree produced by the `simpleSelect`
* Exit a parse tree produced by the `unionAndLateralSelect`
* labeled alternative in `MySqlParser.selectStatement`.
* @param ctx the parse tree
*/
exitSimpleSelect?: (ctx: SimpleSelectContext) => void;
exitUnionAndLateralSelect?: (ctx: UnionAndLateralSelectContext) => void;
/**
* Enter a parse tree produced by the `parenthesisSelect`
* Enter a parse tree produced by the `selectExpression`
* labeled alternative in `MySqlParser.selectStatement`.
* @param ctx the parse tree
*/
enterParenthesisSelect?: (ctx: ParenthesisSelectContext) => void;
enterSelectExpression?: (ctx: SelectExpressionContext) => void;
/**
* Exit a parse tree produced by the `parenthesisSelect`
* Exit a parse tree produced by the `selectExpression`
* labeled alternative in `MySqlParser.selectStatement`.
* @param ctx the parse tree
*/
exitParenthesisSelect?: (ctx: ParenthesisSelectContext) => void;
/**
* Enter a parse tree produced by the `unionSelect`
* labeled alternative in `MySqlParser.selectStatement`.
* @param ctx the parse tree
*/
enterUnionSelect?: (ctx: UnionSelectContext) => void;
/**
* Exit a parse tree produced by the `unionSelect`
* labeled alternative in `MySqlParser.selectStatement`.
* @param ctx the parse tree
*/
exitUnionSelect?: (ctx: UnionSelectContext) => void;
/**
* Enter a parse tree produced by the `unionParenthesisSelect`
* labeled alternative in `MySqlParser.selectStatement`.
* @param ctx the parse tree
*/
enterUnionParenthesisSelect?: (ctx: UnionParenthesisSelectContext) => void;
/**
* Exit a parse tree produced by the `unionParenthesisSelect`
* labeled alternative in `MySqlParser.selectStatement`.
* @param ctx the parse tree
*/
exitUnionParenthesisSelect?: (ctx: UnionParenthesisSelectContext) => void;
/**
* Enter a parse tree produced by the `withLateralStatement`
* labeled alternative in `MySqlParser.selectStatement`.
* @param ctx the parse tree
*/
enterWithLateralStatement?: (ctx: WithLateralStatementContext) => void;
/**
* Exit a parse tree produced by the `withLateralStatement`
* labeled alternative in `MySqlParser.selectStatement`.
* @param ctx the parse tree
*/
exitWithLateralStatement?: (ctx: WithLateralStatementContext) => void;
exitSelectExpression?: (ctx: SelectExpressionContext) => void;
/**
* Enter a parse tree produced by `MySqlParser.setOperations`.
* @param ctx the parse tree
@ -3588,16 +3546,6 @@ export class MySqlParserListener implements ParseTreeListener {
* @param ctx the parse tree
*/
exitQueryExpression?: (ctx: QueryExpressionContext) => void;
/**
* Enter a parse tree produced by `MySqlParser.queryExpressionNointo`.
* @param ctx the parse tree
*/
enterQueryExpressionNointo?: (ctx: QueryExpressionNointoContext) => void;
/**
* Exit a parse tree produced by `MySqlParser.queryExpressionNointo`.
* @param ctx the parse tree
*/
exitQueryExpressionNointo?: (ctx: QueryExpressionNointoContext) => void;
/**
* Enter a parse tree produced by `MySqlParser.querySpecification`.
* @param ctx the parse tree
@ -3608,26 +3556,6 @@ export class MySqlParserListener implements ParseTreeListener {
* @param ctx the parse tree
*/
exitQuerySpecification?: (ctx: QuerySpecificationContext) => void;
/**
* Enter a parse tree produced by `MySqlParser.querySpecificationNointo`.
* @param ctx the parse tree
*/
enterQuerySpecificationNointo?: (ctx: QuerySpecificationNointoContext) => void;
/**
* Exit a parse tree produced by `MySqlParser.querySpecificationNointo`.
* @param ctx the parse tree
*/
exitQuerySpecificationNointo?: (ctx: QuerySpecificationNointoContext) => void;
/**
* Enter a parse tree produced by `MySqlParser.unionParenthesis`.
* @param ctx the parse tree
*/
enterUnionParenthesis?: (ctx: UnionParenthesisContext) => void;
/**
* Exit a parse tree produced by `MySqlParser.unionParenthesis`.
* @param ctx the parse tree
*/
exitUnionParenthesis?: (ctx: UnionParenthesisContext) => void;
/**
* Enter a parse tree produced by `MySqlParser.unionStatement`.
* @param ctx the parse tree
@ -3718,6 +3646,30 @@ export class MySqlParserListener implements ParseTreeListener {
* @param ctx the parse tree
*/
exitSelectElements?: (ctx: SelectElementsContext) => void;
/**
* Enter a parse tree produced by the `selectExpressionElement`
* labeled alternative in `MySqlParser.selectElement`.
* @param ctx the parse tree
*/
enterSelectExpressionElement?: (ctx: SelectExpressionElementContext) => void;
/**
* Exit a parse tree produced by the `selectExpressionElement`
* labeled alternative in `MySqlParser.selectElement`.
* @param ctx the parse tree
*/
exitSelectExpressionElement?: (ctx: SelectExpressionElementContext) => void;
/**
* Enter a parse tree produced by the `selectFunctionElement`
* labeled alternative in `MySqlParser.selectElement`.
* @param ctx the parse tree
*/
enterSelectFunctionElement?: (ctx: SelectFunctionElementContext) => void;
/**
* Exit a parse tree produced by the `selectFunctionElement`
* labeled alternative in `MySqlParser.selectElement`.
* @param ctx the parse tree
*/
exitSelectFunctionElement?: (ctx: SelectFunctionElementContext) => void;
/**
* Enter a parse tree produced by the `selectStarElement`
* labeled alternative in `MySqlParser.selectElement`.
@ -3742,30 +3694,6 @@ export class MySqlParserListener implements ParseTreeListener {
* @param ctx the parse tree
*/
exitSelectColumnElement?: (ctx: SelectColumnElementContext) => void;
/**
* Enter a parse tree produced by the `selectFunctionElement`
* labeled alternative in `MySqlParser.selectElement`.
* @param ctx the parse tree
*/
enterSelectFunctionElement?: (ctx: SelectFunctionElementContext) => void;
/**
* Exit a parse tree produced by the `selectFunctionElement`
* labeled alternative in `MySqlParser.selectElement`.
* @param ctx the parse tree
*/
exitSelectFunctionElement?: (ctx: SelectFunctionElementContext) => void;
/**
* Enter a parse tree produced by the `selectExpressionElement`
* labeled alternative in `MySqlParser.selectElement`.
* @param ctx the parse tree
*/
enterSelectExpressionElement?: (ctx: SelectExpressionElementContext) => void;
/**
* Exit a parse tree produced by the `selectExpressionElement`
* labeled alternative in `MySqlParser.selectElement`.
* @param ctx the parse tree
*/
exitSelectExpressionElement?: (ctx: SelectExpressionElementContext) => void;
/**
* Enter a parse tree produced by the `selectIntoVariables`
* labeled alternative in `MySqlParser.intoClause`.

View File

@ -219,11 +219,8 @@ import { LoadDataStatementContext } from "./MySqlParser.js";
import { LoadXmlStatementContext } from "./MySqlParser.js";
import { ParenthesizedQueryContext } from "./MySqlParser.js";
import { ReplaceStatementContext } from "./MySqlParser.js";
import { SimpleSelectContext } from "./MySqlParser.js";
import { ParenthesisSelectContext } from "./MySqlParser.js";
import { UnionSelectContext } from "./MySqlParser.js";
import { UnionParenthesisSelectContext } from "./MySqlParser.js";
import { WithLateralStatementContext } from "./MySqlParser.js";
import { UnionAndLateralSelectContext } from "./MySqlParser.js";
import { SelectExpressionContext } from "./MySqlParser.js";
import { SetOperationsContext } from "./MySqlParser.js";
import { QueryExpressionBodyContext } from "./MySqlParser.js";
import { QueryItemContext } from "./MySqlParser.js";
@ -265,10 +262,7 @@ import { OuterJoinContext } from "./MySqlParser.js";
import { NaturalJoinContext } from "./MySqlParser.js";
import { JoinSpecContext } from "./MySqlParser.js";
import { QueryExpressionContext } from "./MySqlParser.js";
import { QueryExpressionNointoContext } from "./MySqlParser.js";
import { QuerySpecificationContext } from "./MySqlParser.js";
import { QuerySpecificationNointoContext } from "./MySqlParser.js";
import { UnionParenthesisContext } from "./MySqlParser.js";
import { UnionStatementContext } from "./MySqlParser.js";
import { LateralStatementContext } from "./MySqlParser.js";
import { JsonTableContext } from "./MySqlParser.js";
@ -278,10 +272,10 @@ import { JsonOnEmptyContext } from "./MySqlParser.js";
import { JsonOnErrorContext } from "./MySqlParser.js";
import { SelectSpecContext } from "./MySqlParser.js";
import { SelectElementsContext } from "./MySqlParser.js";
import { SelectExpressionElementContext } from "./MySqlParser.js";
import { SelectFunctionElementContext } from "./MySqlParser.js";
import { SelectStarElementContext } from "./MySqlParser.js";
import { SelectColumnElementContext } from "./MySqlParser.js";
import { SelectFunctionElementContext } from "./MySqlParser.js";
import { SelectExpressionElementContext } from "./MySqlParser.js";
import { SelectIntoVariablesContext } from "./MySqlParser.js";
import { SelectIntoDumpFileContext } from "./MySqlParser.js";
import { SelectIntoTextFileContext } from "./MySqlParser.js";
@ -2112,40 +2106,19 @@ export class MySqlParserVisitor<Result> extends AbstractParseTreeVisitor<Result>
*/
visitReplaceStatement?: (ctx: ReplaceStatementContext) => Result;
/**
* Visit a parse tree produced by the `simpleSelect`
* Visit a parse tree produced by the `unionAndLateralSelect`
* labeled alternative in `MySqlParser.selectStatement`.
* @param ctx the parse tree
* @return the visitor result
*/
visitSimpleSelect?: (ctx: SimpleSelectContext) => Result;
visitUnionAndLateralSelect?: (ctx: UnionAndLateralSelectContext) => Result;
/**
* Visit a parse tree produced by the `parenthesisSelect`
* Visit a parse tree produced by the `selectExpression`
* labeled alternative in `MySqlParser.selectStatement`.
* @param ctx the parse tree
* @return the visitor result
*/
visitParenthesisSelect?: (ctx: ParenthesisSelectContext) => Result;
/**
* Visit a parse tree produced by the `unionSelect`
* labeled alternative in `MySqlParser.selectStatement`.
* @param ctx the parse tree
* @return the visitor result
*/
visitUnionSelect?: (ctx: UnionSelectContext) => Result;
/**
* Visit a parse tree produced by the `unionParenthesisSelect`
* labeled alternative in `MySqlParser.selectStatement`.
* @param ctx the parse tree
* @return the visitor result
*/
visitUnionParenthesisSelect?: (ctx: UnionParenthesisSelectContext) => Result;
/**
* Visit a parse tree produced by the `withLateralStatement`
* labeled alternative in `MySqlParser.selectStatement`.
* @param ctx the parse tree
* @return the visitor result
*/
visitWithLateralStatement?: (ctx: WithLateralStatementContext) => Result;
visitSelectExpression?: (ctx: SelectExpressionContext) => Result;
/**
* Visit a parse tree produced by `MySqlParser.setOperations`.
* @param ctx the parse tree
@ -2402,30 +2375,12 @@ export class MySqlParserVisitor<Result> extends AbstractParseTreeVisitor<Result>
* @return the visitor result
*/
visitQueryExpression?: (ctx: QueryExpressionContext) => Result;
/**
* Visit a parse tree produced by `MySqlParser.queryExpressionNointo`.
* @param ctx the parse tree
* @return the visitor result
*/
visitQueryExpressionNointo?: (ctx: QueryExpressionNointoContext) => Result;
/**
* Visit a parse tree produced by `MySqlParser.querySpecification`.
* @param ctx the parse tree
* @return the visitor result
*/
visitQuerySpecification?: (ctx: QuerySpecificationContext) => Result;
/**
* Visit a parse tree produced by `MySqlParser.querySpecificationNointo`.
* @param ctx the parse tree
* @return the visitor result
*/
visitQuerySpecificationNointo?: (ctx: QuerySpecificationNointoContext) => Result;
/**
* Visit a parse tree produced by `MySqlParser.unionParenthesis`.
* @param ctx the parse tree
* @return the visitor result
*/
visitUnionParenthesis?: (ctx: UnionParenthesisContext) => Result;
/**
* Visit a parse tree produced by `MySqlParser.unionStatement`.
* @param ctx the parse tree
@ -2480,6 +2435,20 @@ export class MySqlParserVisitor<Result> extends AbstractParseTreeVisitor<Result>
* @return the visitor result
*/
visitSelectElements?: (ctx: SelectElementsContext) => Result;
/**
* Visit a parse tree produced by the `selectExpressionElement`
* labeled alternative in `MySqlParser.selectElement`.
* @param ctx the parse tree
* @return the visitor result
*/
visitSelectExpressionElement?: (ctx: SelectExpressionElementContext) => Result;
/**
* Visit a parse tree produced by the `selectFunctionElement`
* labeled alternative in `MySqlParser.selectElement`.
* @param ctx the parse tree
* @return the visitor result
*/
visitSelectFunctionElement?: (ctx: SelectFunctionElementContext) => Result;
/**
* Visit a parse tree produced by the `selectStarElement`
* labeled alternative in `MySqlParser.selectElement`.
@ -2494,20 +2463,6 @@ export class MySqlParserVisitor<Result> extends AbstractParseTreeVisitor<Result>
* @return the visitor result
*/
visitSelectColumnElement?: (ctx: SelectColumnElementContext) => Result;
/**
* Visit a parse tree produced by the `selectFunctionElement`
* labeled alternative in `MySqlParser.selectElement`.
* @param ctx the parse tree
* @return the visitor result
*/
visitSelectFunctionElement?: (ctx: SelectFunctionElementContext) => Result;
/**
* Visit a parse tree produced by the `selectExpressionElement`
* labeled alternative in `MySqlParser.selectElement`.
* @param ctx the parse tree
* @return the visitor result
*/
visitSelectExpressionElement?: (ctx: SelectExpressionElementContext) => Result;
/**
* Visit a parse tree produced by the `selectIntoVariables`
* labeled alternative in `MySqlParser.intoClause`.

File diff suppressed because one or more lines are too long

File diff suppressed because it is too large Load Diff

View File

@ -279,14 +279,13 @@ import { Object_type_any_nameContext } from "./PostgreSQLParser.js";
import { Object_type_nameContext } from "./PostgreSQLParser.js";
import { Object_type_name_on_any_nameContext } from "./PostgreSQLParser.js";
import { Any_name_listContext } from "./PostgreSQLParser.js";
import { Table_column_nameContext } from "./PostgreSQLParser.js";
import { Relation_column_nameContext } from "./PostgreSQLParser.js";
import { Relation_nameContext } from "./PostgreSQLParser.js";
import { Any_nameContext } from "./PostgreSQLParser.js";
import { AttrsContext } from "./PostgreSQLParser.js";
import { Type_name_listContext } from "./PostgreSQLParser.js";
import { TruncatestmtContext } from "./PostgreSQLParser.js";
import { Opt_restart_seqsContext } from "./PostgreSQLParser.js";
import { Truncate_tableContext } from "./PostgreSQLParser.js";
import { CommentstmtContext } from "./PostgreSQLParser.js";
import { Comment_textContext } from "./PostgreSQLParser.js";
import { SeclabelstmtContext } from "./PostgreSQLParser.js";
@ -387,7 +386,6 @@ import { Reindex_option_listContext } from "./PostgreSQLParser.js";
import { Reindex_option_elemContext } from "./PostgreSQLParser.js";
import { AltertblspcstmtContext } from "./PostgreSQLParser.js";
import { RenamestmtContext } from "./PostgreSQLParser.js";
import { Opt_columnContext } from "./PostgreSQLParser.js";
import { Opt_set_dataContext } from "./PostgreSQLParser.js";
import { AlterobjectdependsstmtContext } from "./PostgreSQLParser.js";
import { Opt_noContext } from "./PostgreSQLParser.js";
@ -3652,16 +3650,6 @@ export class PostgreSQLParserListener implements ParseTreeListener {
* @param ctx the parse tree
*/
exitAny_name_list?: (ctx: Any_name_listContext) => void;
/**
* Enter a parse tree produced by `PostgreSQLParser.table_column_name`.
* @param ctx the parse tree
*/
enterTable_column_name?: (ctx: Table_column_nameContext) => void;
/**
* Exit a parse tree produced by `PostgreSQLParser.table_column_name`.
* @param ctx the parse tree
*/
exitTable_column_name?: (ctx: Table_column_nameContext) => void;
/**
* Enter a parse tree produced by `PostgreSQLParser.relation_column_name`.
* @param ctx the parse tree
@ -3723,15 +3711,15 @@ export class PostgreSQLParserListener implements ParseTreeListener {
*/
exitTruncatestmt?: (ctx: TruncatestmtContext) => void;
/**
* Enter a parse tree produced by `PostgreSQLParser.opt_restart_seqs`.
* Enter a parse tree produced by `PostgreSQLParser.truncate_table`.
* @param ctx the parse tree
*/
enterOpt_restart_seqs?: (ctx: Opt_restart_seqsContext) => void;
enterTruncate_table?: (ctx: Truncate_tableContext) => void;
/**
* Exit a parse tree produced by `PostgreSQLParser.opt_restart_seqs`.
* Exit a parse tree produced by `PostgreSQLParser.truncate_table`.
* @param ctx the parse tree
*/
exitOpt_restart_seqs?: (ctx: Opt_restart_seqsContext) => void;
exitTruncate_table?: (ctx: Truncate_tableContext) => void;
/**
* Enter a parse tree produced by `PostgreSQLParser.commentstmt`.
* @param ctx the parse tree
@ -4732,16 +4720,6 @@ export class PostgreSQLParserListener implements ParseTreeListener {
* @param ctx the parse tree
*/
exitRenamestmt?: (ctx: RenamestmtContext) => void;
/**
* Enter a parse tree produced by `PostgreSQLParser.opt_column`.
* @param ctx the parse tree
*/
enterOpt_column?: (ctx: Opt_columnContext) => void;
/**
* Exit a parse tree produced by `PostgreSQLParser.opt_column`.
* @param ctx the parse tree
*/
exitOpt_column?: (ctx: Opt_columnContext) => void;
/**
* Enter a parse tree produced by `PostgreSQLParser.opt_set_data`.
* @param ctx the parse tree

View File

@ -279,14 +279,13 @@ import { Object_type_any_nameContext } from "./PostgreSQLParser.js";
import { Object_type_nameContext } from "./PostgreSQLParser.js";
import { Object_type_name_on_any_nameContext } from "./PostgreSQLParser.js";
import { Any_name_listContext } from "./PostgreSQLParser.js";
import { Table_column_nameContext } from "./PostgreSQLParser.js";
import { Relation_column_nameContext } from "./PostgreSQLParser.js";
import { Relation_nameContext } from "./PostgreSQLParser.js";
import { Any_nameContext } from "./PostgreSQLParser.js";
import { AttrsContext } from "./PostgreSQLParser.js";
import { Type_name_listContext } from "./PostgreSQLParser.js";
import { TruncatestmtContext } from "./PostgreSQLParser.js";
import { Opt_restart_seqsContext } from "./PostgreSQLParser.js";
import { Truncate_tableContext } from "./PostgreSQLParser.js";
import { CommentstmtContext } from "./PostgreSQLParser.js";
import { Comment_textContext } from "./PostgreSQLParser.js";
import { SeclabelstmtContext } from "./PostgreSQLParser.js";
@ -387,7 +386,6 @@ import { Reindex_option_listContext } from "./PostgreSQLParser.js";
import { Reindex_option_elemContext } from "./PostgreSQLParser.js";
import { AltertblspcstmtContext } from "./PostgreSQLParser.js";
import { RenamestmtContext } from "./PostgreSQLParser.js";
import { Opt_columnContext } from "./PostgreSQLParser.js";
import { Opt_set_dataContext } from "./PostgreSQLParser.js";
import { AlterobjectdependsstmtContext } from "./PostgreSQLParser.js";
import { Opt_noContext } from "./PostgreSQLParser.js";
@ -2551,12 +2549,6 @@ export class PostgreSQLParserVisitor<Result> extends AbstractParseTreeVisitor<Re
* @return the visitor result
*/
visitAny_name_list?: (ctx: Any_name_listContext) => Result;
/**
* Visit a parse tree produced by `PostgreSQLParser.table_column_name`.
* @param ctx the parse tree
* @return the visitor result
*/
visitTable_column_name?: (ctx: Table_column_nameContext) => Result;
/**
* Visit a parse tree produced by `PostgreSQLParser.relation_column_name`.
* @param ctx the parse tree
@ -2594,11 +2586,11 @@ export class PostgreSQLParserVisitor<Result> extends AbstractParseTreeVisitor<Re
*/
visitTruncatestmt?: (ctx: TruncatestmtContext) => Result;
/**
* Visit a parse tree produced by `PostgreSQLParser.opt_restart_seqs`.
* Visit a parse tree produced by `PostgreSQLParser.truncate_table`.
* @param ctx the parse tree
* @return the visitor result
*/
visitOpt_restart_seqs?: (ctx: Opt_restart_seqsContext) => Result;
visitTruncate_table?: (ctx: Truncate_tableContext) => Result;
/**
* Visit a parse tree produced by `PostgreSQLParser.commentstmt`.
* @param ctx the parse tree
@ -3199,12 +3191,6 @@ export class PostgreSQLParserVisitor<Result> extends AbstractParseTreeVisitor<Re
* @return the visitor result
*/
visitRenamestmt?: (ctx: RenamestmtContext) => Result;
/**
* Visit a parse tree produced by `PostgreSQLParser.opt_column`.
* @param ctx the parse tree
* @return the visitor result
*/
visitOpt_column?: (ctx: Opt_columnContext) => Result;
/**
* Visit a parse tree produced by `PostgreSQLParser.opt_set_data`.
* @param ctx the parse tree

File diff suppressed because one or more lines are too long

File diff suppressed because it is too large Load Diff

View File

@ -8,6 +8,7 @@ import {
ParserRuleContext,
ParseTreeWalker,
ParseTreeListener,
PredictionMode,
} from 'antlr4ng';
import { CandidatesCollection, CodeCompletionCore } from 'antlr4-c3';
import { findCaretTokenIndex } from './utils/findCaretTokenIndex';
@ -110,7 +111,7 @@ export default abstract class BasicParser<
const lexer = this.createLexer(input, errorListener);
const tokenStream = new CommonTokenStream(lexer);
const parser = this.createParserFromTokenStream(tokenStream);
parser.interpreter.predictionMode = PredictionMode.SLL;
if (errorListener) {
parser.removeErrorListeners();
parser.addErrorListener(new ParseErrorListener(errorListener));
@ -155,6 +156,7 @@ export default abstract class BasicParser<
this._tokenStream.fill();
this._parser = this.createParserFromTokenStream(this._tokenStream);
this._parser.interpreter.predictionMode = PredictionMode.SLL;
this._parser.buildParseTrees = true;
this._parser.errorHandler = new ErrorStrategy();
@ -340,6 +342,7 @@ export default abstract class BasicParser<
tokenStream.fill();
const parser = this.createParserFromTokenStream(tokenStream);
parser.interpreter.predictionMode = PredictionMode.SLL;
parser.removeErrorListeners();
parser.buildParseTrees = true;
parser.errorHandler = new ErrorStrategy();

View File

@ -405,7 +405,11 @@ describe('Postgre SQL Syntax Suggestion', () => {
(syn) => syn.syntaxContextType === SyntaxContextType.COLUMN
);
expect(suggestion).not.toBeUndefined();
expect(suggestion?.wordRanges.map((token) => token.text)).toEqual(['column_name']);
expect(suggestion?.wordRanges.map((token) => token.text)).toEqual([
'table_name',
'.',
'column_name',
]);
});
test('Alter Table With Column', () => {
@ -764,7 +768,11 @@ describe('Postgre SQL Syntax Suggestion', () => {
(syn) => syn.syntaxContextType === SyntaxContextType.COLUMN
);
expect(suggestion).not.toBeUndefined();
expect(suggestion?.wordRanges.map((token) => token.text)).toEqual(['columnname']);
expect(suggestion?.wordRanges.map((token) => token.text)).toEqual([
'tablename',
'.',
'columnname',
]);
});
test('Select With Column', () => {

View File

@ -9,10 +9,10 @@ describe('Spark SQL Listener Tests', () => {
const parseTree = parser.parse(sql);
test('Listener exitRelationPrimary', () => {
test('Listener exitTableName', () => {
let result = '';
class MyListener implements SparkSqlParserListener {
exitRelationPrimary = (ctx): void => {
exitTableName = (ctx): void => {
result = ctx.getText().toLowerCase();
};
visitTerminal() {}

View File

@ -11,7 +11,7 @@ describe('Spark SQL Visitor Tests', () => {
console.error('Parse error:', error);
});
test('Visitor visitRelationPrimary', () => {
test('Visitor visitTableName', () => {
class MyVisitor
extends AbstractParseTreeVisitor<any>
implements SparkSqlParserVisitor<any>
@ -20,7 +20,7 @@ describe('Spark SQL Visitor Tests', () => {
protected defaultResult() {
return this.result;
}
visitRelationPrimary = (ctx): void => {
visitTableName = (ctx): void => {
this.result = ctx.getText().toLowerCase();
};
}