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:
parent
ded9f28e36
commit
6dad62ddf4
@ -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';
|
||||
|
@ -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
|
||||
|
File diff suppressed because one or more lines are too long
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because one or more lines are too long
File diff suppressed because it is too large
Load Diff
File diff suppressed because one or more lines are too long
@ -1,4 +1,4 @@
|
||||
// Generated from /Users/hayden/Desktop/dt-works/dt-sql-parser/src/grammar/hive/HiveSqlParser.g4 by ANTLR 4.9.0-SNAPSHOT
|
||||
// Generated from /Users/xuxiaoqi/Documents/dt-sql-parser-copy/src/grammar/hive/HiveSqlParser.g4 by ANTLR 4.9.0-SNAPSHOT
|
||||
|
||||
|
||||
import { ParseTreeListener } from "antlr4ts/tree/ParseTreeListener";
|
||||
@ -11,6 +11,7 @@ import { VectorizationOnlyContext } from "./HiveSqlParser";
|
||||
import { VectorizatonDetailContext } from "./HiveSqlParser";
|
||||
import { ExecStatementContext } from "./HiveSqlParser";
|
||||
import { LoadStatementContext } from "./HiveSqlParser";
|
||||
import { DropPartitionsIgnoreClauseContext } from "./HiveSqlParser";
|
||||
import { ReplicationClauseContext } from "./HiveSqlParser";
|
||||
import { ExportStatementContext } from "./HiveSqlParser";
|
||||
import { ImportStatementContext } from "./HiveSqlParser";
|
||||
@ -77,6 +78,7 @@ import { PrivlegeDefContext } from "./HiveSqlParser";
|
||||
import { PrivilegeTypeContext } from "./HiveSqlParser";
|
||||
import { PrincipalSpecificationContext } from "./HiveSqlParser";
|
||||
import { PrincipalNameContext } from "./HiveSqlParser";
|
||||
import { PrincipalAlterNameContext } from "./HiveSqlParser";
|
||||
import { WithGrantOptionContext } from "./HiveSqlParser";
|
||||
import { GrantOptionForContext } from "./HiveSqlParser";
|
||||
import { AdminOptionForContext } from "./HiveSqlParser";
|
||||
@ -268,6 +270,7 @@ import { AlterStatementSuffixTouchContext } from "./HiveSqlParser";
|
||||
import { AlterStatementSuffixArchiveContext } from "./HiveSqlParser";
|
||||
import { AlterStatementSuffixUnArchiveContext } from "./HiveSqlParser";
|
||||
import { PartitionLocationContext } from "./HiveSqlParser";
|
||||
import { AlterStatementSuffixRecoverPartitionsContext } from "./HiveSqlParser";
|
||||
import { AlterStatementSuffixDropPartitionsContext } from "./HiveSqlParser";
|
||||
import { AlterStatementSuffixPropertiesContext } from "./HiveSqlParser";
|
||||
import { AlterViewSuffixPropertiesContext } from "./HiveSqlParser";
|
||||
@ -609,6 +612,17 @@ export interface HiveSqlParserListener extends ParseTreeListener {
|
||||
*/
|
||||
exitLoadStatement?: (ctx: LoadStatementContext) => void;
|
||||
|
||||
/**
|
||||
* Enter a parse tree produced by `HiveSqlParser.dropPartitionsIgnoreClause`.
|
||||
* @param ctx the parse tree
|
||||
*/
|
||||
enterDropPartitionsIgnoreClause?: (ctx: DropPartitionsIgnoreClauseContext) => void;
|
||||
/**
|
||||
* Exit a parse tree produced by `HiveSqlParser.dropPartitionsIgnoreClause`.
|
||||
* @param ctx the parse tree
|
||||
*/
|
||||
exitDropPartitionsIgnoreClause?: (ctx: DropPartitionsIgnoreClauseContext) => void;
|
||||
|
||||
/**
|
||||
* Enter a parse tree produced by `HiveSqlParser.replicationClause`.
|
||||
* @param ctx the parse tree
|
||||
@ -1335,6 +1349,17 @@ export interface HiveSqlParserListener extends ParseTreeListener {
|
||||
*/
|
||||
exitPrincipalName?: (ctx: PrincipalNameContext) => void;
|
||||
|
||||
/**
|
||||
* Enter a parse tree produced by `HiveSqlParser.principalAlterName`.
|
||||
* @param ctx the parse tree
|
||||
*/
|
||||
enterPrincipalAlterName?: (ctx: PrincipalAlterNameContext) => void;
|
||||
/**
|
||||
* Exit a parse tree produced by `HiveSqlParser.principalAlterName`.
|
||||
* @param ctx the parse tree
|
||||
*/
|
||||
exitPrincipalAlterName?: (ctx: PrincipalAlterNameContext) => void;
|
||||
|
||||
/**
|
||||
* Enter a parse tree produced by `HiveSqlParser.withGrantOption`.
|
||||
* @param ctx the parse tree
|
||||
@ -3436,6 +3461,17 @@ export interface HiveSqlParserListener extends ParseTreeListener {
|
||||
*/
|
||||
exitPartitionLocation?: (ctx: PartitionLocationContext) => void;
|
||||
|
||||
/**
|
||||
* Enter a parse tree produced by `HiveSqlParser.alterStatementSuffixRecoverPartitions`.
|
||||
* @param ctx the parse tree
|
||||
*/
|
||||
enterAlterStatementSuffixRecoverPartitions?: (ctx: AlterStatementSuffixRecoverPartitionsContext) => void;
|
||||
/**
|
||||
* Exit a parse tree produced by `HiveSqlParser.alterStatementSuffixRecoverPartitions`.
|
||||
* @param ctx the parse tree
|
||||
*/
|
||||
exitAlterStatementSuffixRecoverPartitions?: (ctx: AlterStatementSuffixRecoverPartitionsContext) => void;
|
||||
|
||||
/**
|
||||
* Enter a parse tree produced by `HiveSqlParser.alterStatementSuffixDropPartitions`.
|
||||
* @param ctx the parse tree
|
||||
|
@ -1,4 +1,4 @@
|
||||
// Generated from /Users/hayden/Desktop/dt-works/dt-sql-parser/src/grammar/hive/HiveSqlParser.g4 by ANTLR 4.9.0-SNAPSHOT
|
||||
// Generated from /Users/xuxiaoqi/Documents/dt-sql-parser-copy/src/grammar/hive/HiveSqlParser.g4 by ANTLR 4.9.0-SNAPSHOT
|
||||
|
||||
|
||||
import { ParseTreeVisitor } from "antlr4ts/tree/ParseTreeVisitor";
|
||||
@ -11,6 +11,7 @@ import { VectorizationOnlyContext } from "./HiveSqlParser";
|
||||
import { VectorizatonDetailContext } from "./HiveSqlParser";
|
||||
import { ExecStatementContext } from "./HiveSqlParser";
|
||||
import { LoadStatementContext } from "./HiveSqlParser";
|
||||
import { DropPartitionsIgnoreClauseContext } from "./HiveSqlParser";
|
||||
import { ReplicationClauseContext } from "./HiveSqlParser";
|
||||
import { ExportStatementContext } from "./HiveSqlParser";
|
||||
import { ImportStatementContext } from "./HiveSqlParser";
|
||||
@ -77,6 +78,7 @@ import { PrivlegeDefContext } from "./HiveSqlParser";
|
||||
import { PrivilegeTypeContext } from "./HiveSqlParser";
|
||||
import { PrincipalSpecificationContext } from "./HiveSqlParser";
|
||||
import { PrincipalNameContext } from "./HiveSqlParser";
|
||||
import { PrincipalAlterNameContext } from "./HiveSqlParser";
|
||||
import { WithGrantOptionContext } from "./HiveSqlParser";
|
||||
import { GrantOptionForContext } from "./HiveSqlParser";
|
||||
import { AdminOptionForContext } from "./HiveSqlParser";
|
||||
@ -268,6 +270,7 @@ import { AlterStatementSuffixTouchContext } from "./HiveSqlParser";
|
||||
import { AlterStatementSuffixArchiveContext } from "./HiveSqlParser";
|
||||
import { AlterStatementSuffixUnArchiveContext } from "./HiveSqlParser";
|
||||
import { PartitionLocationContext } from "./HiveSqlParser";
|
||||
import { AlterStatementSuffixRecoverPartitionsContext } from "./HiveSqlParser";
|
||||
import { AlterStatementSuffixDropPartitionsContext } from "./HiveSqlParser";
|
||||
import { AlterStatementSuffixPropertiesContext } from "./HiveSqlParser";
|
||||
import { AlterViewSuffixPropertiesContext } from "./HiveSqlParser";
|
||||
@ -580,6 +583,13 @@ export interface HiveSqlParserVisitor<Result> extends ParseTreeVisitor<Result> {
|
||||
*/
|
||||
visitLoadStatement?: (ctx: LoadStatementContext) => Result;
|
||||
|
||||
/**
|
||||
* Visit a parse tree produced by `HiveSqlParser.dropPartitionsIgnoreClause`.
|
||||
* @param ctx the parse tree
|
||||
* @return the visitor result
|
||||
*/
|
||||
visitDropPartitionsIgnoreClause?: (ctx: DropPartitionsIgnoreClauseContext) => Result;
|
||||
|
||||
/**
|
||||
* Visit a parse tree produced by `HiveSqlParser.replicationClause`.
|
||||
* @param ctx the parse tree
|
||||
@ -1042,6 +1052,13 @@ export interface HiveSqlParserVisitor<Result> extends ParseTreeVisitor<Result> {
|
||||
*/
|
||||
visitPrincipalName?: (ctx: PrincipalNameContext) => Result;
|
||||
|
||||
/**
|
||||
* Visit a parse tree produced by `HiveSqlParser.principalAlterName`.
|
||||
* @param ctx the parse tree
|
||||
* @return the visitor result
|
||||
*/
|
||||
visitPrincipalAlterName?: (ctx: PrincipalAlterNameContext) => Result;
|
||||
|
||||
/**
|
||||
* Visit a parse tree produced by `HiveSqlParser.withGrantOption`.
|
||||
* @param ctx the parse tree
|
||||
@ -2379,6 +2396,13 @@ export interface HiveSqlParserVisitor<Result> extends ParseTreeVisitor<Result> {
|
||||
*/
|
||||
visitPartitionLocation?: (ctx: PartitionLocationContext) => Result;
|
||||
|
||||
/**
|
||||
* Visit a parse tree produced by `HiveSqlParser.alterStatementSuffixRecoverPartitions`.
|
||||
* @param ctx the parse tree
|
||||
* @return the visitor result
|
||||
*/
|
||||
visitAlterStatementSuffixRecoverPartitions?: (ctx: AlterStatementSuffixRecoverPartitionsContext) => Result;
|
||||
|
||||
/**
|
||||
* Visit a parse tree produced by `HiveSqlParser.alterStatementSuffixDropPartitions`.
|
||||
* @param ctx the parse tree
|
||||
|
@ -20,7 +20,7 @@ describe('Hive Alter Syntax Tests', () => {
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
|
||||
describe('ALTER CONNECTOR', () => {
|
||||
features.connectors.forEach((ctors) => {
|
||||
it(ctors, () => {
|
||||
|
@ -4,4 +4,6 @@ ALTER CONNECTOR pg_local SET URL 'jdbc:postgresql://localhost:5400';
|
||||
|
||||
ALTER CONNECTOR hbase_local SET OWNER USER `hayden`;
|
||||
|
||||
ALTER CONNECTOR hbase_local SET OWNER ROLE `admin`;
|
||||
ALTER CONNECTOR hbase_local SET OWNER ROLE `admin`;
|
||||
|
||||
ALTER CONNECTOR hbase_local SET OWNER `zhaoge`;
|
@ -4,11 +4,15 @@ ALTER SCHEMA myschema1 SET DBPROPERTIES ('creator'='hayden','date'='2023-07-07')
|
||||
|
||||
ALTER DATABASE database_name SET OWNER USER hayden;
|
||||
|
||||
ALTER SCHEMA database_name SET OWNER ROLE `admin`;
|
||||
ALTER SCHEMA database_name SET OWNER USER `admin`;
|
||||
|
||||
ALTER DATABASE database_name SET OWNER USER jack;
|
||||
ALTER DATABASE database_name SET OWNER ROLE jack;
|
||||
|
||||
ALTER SCHEMA database_name SET OWNER ROLE ddladmin;
|
||||
|
||||
ALTER DATABASE database_name SET OWNER zhaoge;
|
||||
|
||||
ALTER SCHEMA database_name SET OWNER zhaogeadmin;
|
||||
|
||||
ALTER DATABASE database_name SET LOCATION '/myhive/mydb';
|
||||
|
||||
|
@ -1,3 +1,6 @@
|
||||
ALTER INDEX table01_index ON table01
|
||||
PARTITION (pt1, pt2 = '2019-04-01')
|
||||
REBUILD;
|
||||
|
||||
ALTER INDEX table01_index ON table01
|
||||
REBUILD;
|
||||
|
@ -5,3 +5,9 @@ ALTER SCHEDULED QUERY sq_2 EXECUTED AS 'user2';
|
||||
ALTER SCHEDULED QUERY sq_3 DISABLED;
|
||||
|
||||
ALTER SCHEDULED QUERY sq_4 AS SELECT * FROM tbl1;
|
||||
|
||||
ALTER SCHEDULED QUERY sq_5 ENABLED;
|
||||
|
||||
ALTER SCHEDULED QUERY sq_6 EXECUTE;
|
||||
|
||||
ALTER SCHEDULED QUERY sq_7 DEFINED AS SELECT * FROM tbl1;
|
||||
|
@ -10,25 +10,45 @@ ALTER TABLE mydb.tb22 SET TBLPROPERTIES ('comment' = 'This is a new comment!');
|
||||
-- Add SerDe Properties
|
||||
ALTER TABLE employee_tb SET SERDE 'com.dt.test';
|
||||
|
||||
ALTER TABLE employee_tb PARTITION (
|
||||
`pt1`='1'
|
||||
) SET SERDE 'com.dt.test';
|
||||
|
||||
ALTER TABLE employee_tb
|
||||
SET SERDE 'com.dt.test'
|
||||
WITH SERDEPROPERTIES ('field.delim' = ',');
|
||||
|
||||
ALTER TABLE employee_tb PARTITION (
|
||||
`pt1`='1'
|
||||
)
|
||||
SET SERDE 'com.dt.test'
|
||||
WITH SERDEPROPERTIES ('field.delim' = ',');
|
||||
|
||||
ALTER TABLE sale_rbl
|
||||
PARTITION (
|
||||
`pt1`='1'
|
||||
)
|
||||
SET SERDEPROPERTIES ('field.delim' = ',');
|
||||
|
||||
ALTER TABLE sale_rbl SET SERDEPROPERTIES ('field.delim' = ',');
|
||||
|
||||
-- Remove SerDe Properties
|
||||
ALTER TABLE sale_rbl UNSET SERDEPROPERTIES ('field.delim');
|
||||
|
||||
ALTER TABLE sale_rbl PARTITION (
|
||||
`pt1`='1'
|
||||
) UNSET SERDEPROPERTIES ('field.delim');
|
||||
|
||||
-- Alter Table Storage Properties
|
||||
ALTER TABLE students
|
||||
CLUSTERED BY (id, `name`, age)
|
||||
SORTED BY (age)
|
||||
INTO 2 BUCKETS;
|
||||
|
||||
ALTER TABLE students
|
||||
CLUSTERED BY (id, `name`, age)
|
||||
INTO 2 BUCKETS;
|
||||
|
||||
-- Alter Table Skewed or Stored as Directories
|
||||
ALTER TABLE dt_shop
|
||||
SKEWED BY (id, cost)
|
||||
@ -80,10 +100,32 @@ CHECK (1) ENABLE;
|
||||
ALTER TABLE tbl7 DROP CONSTRAINT remove_const;
|
||||
|
||||
-- Alter Partition
|
||||
|
||||
ALTER TABLE add_par_tbl
|
||||
ADD
|
||||
PARTITION (`pt1` = 1);
|
||||
|
||||
ALTER TABLE add_par_tbl
|
||||
ADD
|
||||
PARTITION (`pt1` = 1) LOCATION '/pat/loc';
|
||||
|
||||
ALTER TABLE add_par_tbl
|
||||
ADD
|
||||
PARTITION (`pt1` = 1) LOCATION '/pat/loc'
|
||||
PARTITION (`pt2` = 2, `pt3`=3) LOCATION '/pat/loc' ;
|
||||
|
||||
ALTER TABLE add_par_tbl
|
||||
ADD IF NOT EXISTS
|
||||
PARTITION (`pt1` = 1);
|
||||
|
||||
ALTER TABLE add_par_tbl
|
||||
ADD IF NOT EXISTS
|
||||
PARTITION (`pt1` = 1) LOCATION '/pat/loc';
|
||||
|
||||
ALTER TABLE add_par_tbl
|
||||
ADD IF NOT EXISTS
|
||||
PARTITION (`pt1` = 1) LOCATION '/pat/loc'
|
||||
PARTITION (`pt2` = 2, `pt3`=3) LOCATION '/pat/loc'
|
||||
PARTITION (`pt2` = 2, `pt3`=3) LOCATION '/pat/loc';
|
||||
|
||||
-- Rename Partition
|
||||
ALTER TABLE ren_par_tbl
|
||||
@ -95,16 +137,36 @@ ALTER TABLE ex_part_tbl2
|
||||
EXCHANGE PARTITION (`pt1`=1)
|
||||
WITH TABLE ex_part_tbl1;
|
||||
|
||||
ALTER TABLE ex_part_tbl2
|
||||
EXCHANGE PARTITION (`pt1`=1, `pt2`=2)
|
||||
WITH TABLE ex_part_tbl1;
|
||||
|
||||
-- Recover Partitions
|
||||
MSCK TABLE rec_tbl;
|
||||
|
||||
MSCK REPAIR TABLE rec_tbl;
|
||||
|
||||
MSCK REPAIR TABLE rec_tbl SYNC PARTITIONS;
|
||||
|
||||
MSCK REPAIR TABLE rec_tbl ADD PARTITIONS;
|
||||
|
||||
MSCK REPAIR TABLE rec_tbl DROP PARTITIONS;
|
||||
|
||||
ALTER TABLE rec_tbl RECOVER PARTITIONS;
|
||||
|
||||
-- Drop Partitions
|
||||
ALTER TABLE dr_tbl1 DROP PARTITION (`pt1`=1);
|
||||
|
||||
ALTER TABLE dr_tbl1 DROP PARTITION (`pt1`=1, `pt2`=2);
|
||||
|
||||
ALTER TABLE dr_tbl1 DROP PARTITION (`pt1`=1) IGNORE PROTECTION;
|
||||
|
||||
ALTER TABLE dr_tbl1 DROP PARTITION (`pt1`=1) IGNORE PROTECTION PURGE;
|
||||
|
||||
ALTER TABLE dr_tbl2 DROP IF EXISTS PARTITION (`pt2`=2) PURGE;
|
||||
|
||||
ALTER TABLE dr_tbl2 DROP IF EXISTS PARTITION (`pt2`=2) IGNORE PROTECTION PURGE;
|
||||
|
||||
-- Archive Partition
|
||||
ALTER TABLE arch_pt_tbl1 ARCHIVE PARTITION (`pt1`=1);
|
||||
|
||||
@ -126,17 +188,54 @@ ALTER TABLE tbl5 TOUCH;
|
||||
ALTER TABLE tbl6 TOUCH PARTITION (`pt1`=1);
|
||||
|
||||
-- Alter Table/Partition Protections
|
||||
ALTER TABLE tbl7 ENABLE NO_DROP;
|
||||
|
||||
ALTER TABLE tbl7 DISABLE NO_DROP;
|
||||
|
||||
ALTER TABLE tbl7 ENABLE NO_DROP CASCADE;
|
||||
|
||||
ALTER TABLE tbl7 DISABLE NO_DROP CASCADE;
|
||||
|
||||
ALTER TABLE tbl8 PARTITION (`pt1`=1) DISABLE NO_DROP;
|
||||
|
||||
ALTER TABLE tbl8 PARTITION (`pt1`=1) ENABLE NO_DROP;
|
||||
|
||||
ALTER TABLE tbl8 PARTITION (`pt1`=1) DISABLE NO_DROP CASCADE;
|
||||
|
||||
ALTER TABLE tbl8 PARTITION (`pt1`=1) ENABLE NO_DROP CASCADE;
|
||||
|
||||
ALTER TABLE tbl9 DISABLE OFFLINE;
|
||||
|
||||
ALTER TABLE tbl9 ENABLE OFFLINE;
|
||||
|
||||
ALTER TABLE db1.tbl PARTITION (`pt1`=1) ENABLE OFFLINE;
|
||||
|
||||
ALTER TABLE db1.tbl PARTITION (`pt1`=1) DISABLE OFFLINE;
|
||||
|
||||
-- Alter Table/Partition Compact
|
||||
ALTER TABLE tbl_com COMPACT 'compaction_type';
|
||||
|
||||
ALTER TABLE tbl_com2 PARTITION (pt1 = 'partition_value')
|
||||
COMPACT 'compaction_type';
|
||||
|
||||
ALTER TABLE tbl_com2 PARTITION (pt1 = 'partition_value')
|
||||
COMPACT 'compaction_type' AND WAIT;
|
||||
|
||||
ALTER TABLE tbl_com2 PARTITION (pt1 = 'partition_value')
|
||||
COMPACT 'compaction_type' AND WAIT
|
||||
CLUSTERED INTO 1 BUCKETS;
|
||||
|
||||
ALTER TABLE tbl_com2 PARTITION (pt1 = 'partition_value')
|
||||
COMPACT 'compaction_type' AND WAIT
|
||||
CLUSTERED INTO 1 BUCKETS
|
||||
ORDER BY col1;
|
||||
|
||||
ALTER TABLE tbl_com2 PARTITION (pt1 = 'partition_value')
|
||||
COMPACT 'compaction_type' AND WAIT
|
||||
CLUSTERED INTO 1 BUCKETS
|
||||
ORDER BY col1
|
||||
POOL 'pool1';
|
||||
|
||||
ALTER TABLE tbl_com2 PARTITION (pt1 = 'partition_value')
|
||||
COMPACT 'compaction_type' AND WAIT
|
||||
CLUSTERED INTO 1 BUCKETS
|
||||
@ -149,16 +248,36 @@ ALTER TABLE tbl22 CONCATENATE;
|
||||
|
||||
ALTER TABLE tbl23 PARTITION (pt1 = 'anyValue') CONCATENATE;
|
||||
|
||||
ALTER TABLE tbl23 PARTITION (pt1 = 'anyValue', pt2 = 'anyValue2') CONCATENATE;
|
||||
|
||||
-- Alter Table/Partition Update columns
|
||||
ALTER TABLE tbl24 UPDATE COLUMNS;
|
||||
|
||||
ALTER TABLE tbl24 PARTITION (pt1 = 'partition_value') UPDATE COLUMNS;
|
||||
|
||||
ALTER TABLE tbl24 PARTITION (pt1 = 'partition_value', pt2 = 'partition_value2') UPDATE COLUMNS;
|
||||
|
||||
-- Change Column Name/Type/Position/Comment
|
||||
ALTER TABLE test_change CHANGE a a1 INT;
|
||||
|
||||
ALTER TABLE test_change CHANGE COLUMN a a1 INT;
|
||||
|
||||
ALTER TABLE test_change PARTITION (pt1 = 'partition_value') CHANGE c c1 INT FIRST;
|
||||
|
||||
ALTER TABLE test_change PARTITION (pt1 = 'partition_value') CHANGE c c1 INT FIRST;
|
||||
|
||||
ALTER TABLE test_change PARTITION (pt1 = 'partition_value') CHANGE COLUMN c c1 INT FIRST;
|
||||
|
||||
ALTER TABLE test_change PARTITION (pt1 = 'partition_value') CHANGE COLUMN c c1 INT FIRST;
|
||||
|
||||
ALTER TABLE test_change PARTITION (pt1 = 'partition_value') CHANGE COLUMN c c1 INT COMMENT 'this is comment1' FIRST;
|
||||
|
||||
ALTER TABLE test_change PARTITION (pt1 = 'partition_value') CHANGE COLUMN c c1 INT COMMENT 'this is comment1' AFTER cc;
|
||||
|
||||
ALTER TABLE test_change PARTITION (pt1 = 'partition_value') CHANGE COLUMN c c1 INT COMMENT 'this is comment1' FIRST CASCADE;
|
||||
|
||||
ALTER TABLE test_change PARTITION (pt1 = 'partition_value') CHANGE COLUMN c c1 INT COMMENT 'this is comment1' AFTER RESTRICT;
|
||||
|
||||
ALTER TABLE test_change CHANGE a1 a1 INT COMMENT 'this is column a1' RESTRICT;
|
||||
|
||||
ALTER TABLE test_change CHANGE a1 a2 STRING AFTER b CASCADE;
|
||||
@ -168,6 +287,14 @@ ALTER TABLE rp_col_tbl1 ADD COLUMNS (`col1` INT);
|
||||
|
||||
ALTER TABLE rp_col_tbl2 REPLACE COLUMNS (`col2` INT);
|
||||
|
||||
ALTER TABLE rp_col_tbl1 ADD COLUMNS (`col1` INT) CASCADE;
|
||||
|
||||
ALTER TABLE rp_col_tbl2 REPLACE COLUMNS (`col2` INT) RESTRICT;
|
||||
|
||||
ALTER TABLE rp_col_tbl1 PARTITION (`pt1`=1) ADD COLUMNS (`col1` INT) CASCADE;
|
||||
|
||||
ALTER TABLE rp_col_tbl2 PARTITION (`pt1`=1) REPLACE COLUMNS (`col2` INT) RESTRICT;
|
||||
|
||||
ALTER TABLE rp_col_tbl2
|
||||
PARTITION (`pt1`=1)
|
||||
ADD COLUMNS (`col3` INT COMMENT 'a new col')
|
||||
|
@ -1,9 +1,25 @@
|
||||
ALTER VIEW mydb.view1 SET TBLPROPERTIES ('author'='hayden','date'='2023-07-07')
|
||||
|
||||
ALTER VIEW view2
|
||||
ALTER VIEW myview1 SET TBLPROPERTIES ('author'='hayden','date'='2023-09-04')
|
||||
|
||||
ALTER VIEW mydb.view2
|
||||
AS SELECT DISTINCT id, `name`, runtime
|
||||
FROM task_tbl
|
||||
WHERE type='hour';
|
||||
|
||||
ALTER VIEW myview2
|
||||
AS SELECT DISTINCT id, `name`, runtime
|
||||
FROM task_tbl
|
||||
WHERE type='hour';
|
||||
|
||||
ALTER MATERIALIZED VIEW myschema1.materialized_view_1
|
||||
ENABLE REWRITE;
|
||||
ENABLE REWRITE;
|
||||
|
||||
ALTER MATERIALIZED VIEW myschema1.materialized_view_2
|
||||
DISABLE REWRITE;
|
||||
|
||||
ALTER MATERIALIZED VIEW my_materialized_view_1
|
||||
ENABLE REWRITE;
|
||||
|
||||
ALTER MATERIALIZED VIEW my_materialized_view_2
|
||||
DISABLE REWRITE;
|
Loading…
Reference in New Issue
Block a user