Reputation: 11
How to merge existing Partitions and make it to one Partition. For ex : I have Partitions on Year column like year=2011,year=2012,year=2013,year=2014.
My requirement is to merge partitions from 2011 to 2013 partitions. So that I can have only 2 partitions 2013 and 2014.
Please help.
Regards, Manoj
Upvotes: 1
Views: 3317
Reputation: 9067
If your partitioning column year
is defined as STRING, then you can just...
year=History
(for instance).../year=2011/
to the new dir .../year=History/
Upvotes: 1
Reputation: 38290
1) create new target table
2) Insert data into target table with dynamic partition loading:
insert overwrite table partition (partition_year)
select col1, col2 ..., case when year between 2011 and 2013 then 2013
when year >=2014 then 2014
end as partition_year from source_table
3) drop source_table
Upvotes: 1