check alter sql and syntax (#156)

* check and update abort and alter sql

* delete superfluous space

* update grammar lib after change alter parser

* update alter parser to be compatible

---------

Co-authored-by: zhaoge <>
This commit is contained in:
XCynthia
2023-09-06 11:46:46 +08:00
committed by GitHub
parent ded9f28e36
commit 6dad62ddf4
17 changed files with 12348 additions and 11838 deletions

View File

@ -121,6 +121,7 @@ KW_DISTRIBUTED : 'DISTRIBUTED';
KW_DO : 'DO';
KW_DOUBLE : 'DOUBLE';
KW_DROP : 'DROP';
KW_RECOVER : 'RECOVER';
KW_DUMP : 'DUMP';
KW_ELEM_TYPE : '$ELEM$';
KW_ELSE : 'ELSE';

View File

@ -83,6 +83,10 @@ loadStatement
: KW_LOAD KW_DATA KW_LOCAL? KW_INPATH StringLiteral KW_OVERWRITE? KW_INTO KW_TABLE tableOrPartition inputFileFormat?
;
dropPartitionsIgnoreClause
: KW_IGNORE KW_PROTECTION
;
replicationClause
: KW_FOR KW_METADATA? KW_REPLICATION LPAREN StringLiteral RPAREN
;
@ -483,6 +487,12 @@ principalName
| KW_ROLE id_
;
principalAlterName
: KW_USER principalIdentifier
| KW_ROLE id_
| id_
;
withGrantOption
: KW_WITH KW_GRANT KW_OPTION
;
@ -1337,6 +1347,7 @@ alterStatement
alterTableStatementSuffix
: alterStatementSuffixRename
| alterStatementSuffixRecoverPartitions
| alterStatementSuffixDropPartitions
| alterStatementSuffixAddPartitions
| alterStatementSuffixTouch
@ -1349,7 +1360,7 @@ alterTableStatementSuffix
| alterStatementSuffixDropConstraint
| alterStatementSuffixAddConstraint
| alterTblPartitionStatementSuffix
| partitionSpec alterTblPartitionStatementSuffix
| partitionSpec? alterTblPartitionStatementSuffix
| alterStatementSuffixSetOwner
| alterStatementSuffixSetPartSpec
| alterStatementSuffixExecute
@ -1410,7 +1421,7 @@ alterDatabaseSuffixProperties
;
alterDatabaseSuffixSetOwner
: dbName=id_ KW_SET KW_OWNER principalName
: dbName=id_ KW_SET KW_OWNER principalAlterName
;
alterDatabaseSuffixSetLocation
@ -1488,8 +1499,12 @@ partitionLocation
: KW_LOCATION locn=StringLiteral
;
alterStatementSuffixRecoverPartitions
: KW_RECOVER KW_PARTITIONS
;
alterStatementSuffixDropPartitions
: KW_DROP ifExists? KW_PARTITION partitionSelectorSpec (COMMA KW_PARTITION partitionSelectorSpec)* KW_PURGE? replicationClause?
: KW_DROP ifExists? KW_PARTITION partitionSelectorSpec (COMMA KW_PARTITION partitionSelectorSpec)* dropPartitionsIgnoreClause? KW_PURGE? replicationClause?
;
alterStatementSuffixProperties
@ -1616,7 +1631,7 @@ alterDataConnectorSuffixProperties
;
alterDataConnectorSuffixSetOwner
: dcName=id_ KW_SET KW_OWNER principalName
: dcName=id_ KW_SET KW_OWNER principalAlterName
;
alterDataConnectorSuffixSetUrl