ALTER TABLE PARTITION
This statement is used to modify the partition of an existing table.
This operation is synchronous, and the return of the command indicates the completion of the execution.
grammar:
ALTER TABLE [database.]table alter_clause;
The alter_clause of partition supports the following modification methods
grammar:
ADD PARTITION [IF NOT EXISTS] partition_name partition_desc ["key"="value"] [DISTRIBUTED BY HASH (k1[,k2 ...]) [BUCKETS num]]
Notice:
grammar:
DROP PARTITION [IF EXISTS] partition_name [FORCE]
Notice:
grammar:
MODIFY PARTITION p1|(p1[, p2, ...]) SET ("key" = "value", ...)
illustrate:
ALTER TABLE example_db.my_table ADD PARTITION p1 VALUES LESS THAN ("2014-01-01");
ALTER TABLE example_db.my_table ADD PARTITION p1 VALUES LESS THAN ("2015-01-01") DISTRIBUTED BY HASH(k1) BUCKETS 20;
ALTER TABLE example_db.my_table ADD PARTITION p1 VALUES LESS THAN ("2015-01-01") ("replication_num"="1");
ALTER TABLE example_db.my_table MODIFY PARTITION p1 SET("replication_num"="1");
ALTER TABLE example_db.my_table MODIFY PARTITION (p1, p2, p4) SET("in_memory"="true");
ALTER TABLE example_db.my_table MODIFY PARTITION (*) SET("storage_medium"="HDD");
ALTER TABLE example_db.my_table DROP PARTITION p1;
ALTER TABLE example_db.my_table ADD PARTITION p1 VALUES [("2014-01-01"), ("2014-02-01"));
ALTER, TABLE, PARTITION, ALTER TABLE