Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

Code Block
alter table <tablename> exchange partition (<(partial)?partition spec>) with table <tablename>

The semantics of the above statement is that the data between the above partitions are switched. Both the tables should have the same schema. The operation fails in the presence of an index. Consider the following examples:

Code Block

create table T1(a string, b string) partitioned by (ds string, hr string);
create table T2(a string, b string) partitioned by (ds string, hr string);