Sumit D
Sumit D

Reputation: 171

How to exchange partition within same hive table

I need help in exchanging the partition within the same table.Let us assume that I have one table with the below definition.

create table test (ID STRING) partitioned by (data_processed string,date1 string);

id data_processed date1

1 0 2018-07-17

1 1 2018-07-16

Now , I want to move the data for partiton(2018-07-17) under data_processed partition '1'.

Desired result:

id data_processed date1

1 1 2018-07-17

1 1 2018-07-16

How to achieve this. Does hive exchange partition supports multi level exchange partition.

Upvotes: 0

Views: 435

Answers (1)

Manivas
Manivas

Reputation: 11

You can use hive rename partition command.

Here you can run -->

alter table test partition (data_processed='0',date1='2018-07-17') 
            rename to partition(data_processed='1',date1='2018-07-17');

Upvotes: 1

Related Questions