THIS IS A TEST INSTANCE. ALL YOUR CHANGES WILL BE LOST!!!!
...
The tables have different schemas. Their partitions cannot be exchanged
Syntax
Code Block |
---|
alter table <tablename> exchange partition (<(partial)?partition spec>) with table <tablename> |
...
Example usage - Rolling Hourly to Daily Partitions
Code Block |
---|
--Create two tables, one with multiple partitions, one with a single partition. create table T1(a string, b string) partitioned by (ds string, hr string); create table T2(a string, b string) partitioned by (hr string); --Alter the table, moving partition data where ds='1' from table T2 to table T1 (ds=1) alter table T1 exchange partition (ds='1') with table T2 |
...