简体   繁体   中英

Hive Dynamic Partition table issue with altering partition

I Have table with dynamic partition "campaign" and static partitions year and month(that means I am giving there value while inserting/creating partitions).

'ABC' Partition by (year='2011', month='08', campaign)

As dynamic partition is only supported when its followed by static partitions namesly year and month. But my use case is opposite

I want something like this --> 'ABC' Partition by (campaign, year='2011', month='08')

So that i can see for campaigns results per year and month.

By any chance, OR any other option by which I can do that? something like this??

ALTER TABLE ABC PARTITION (y='2011', m='08',campaign) RENAME/ALTER PARTITIONs (campaign,y='2011', m='08');

A partition isn't defined as static or dynamic in the metastore; Just INSERT/LOAD queries define partitions as static or dynamic. You can run an insertion that uses all-dynamic partitions by using SET hive.exec.dynamic.partition=nonstrict .

See: https://cwiki.apache.org/confluence/display/Hive/Tutorial

if you set your partition to strict mode you can perform it

SET hive.exec.dynamic.partition=strict

BUT IF you set to nonstrict mode and perform dynamically then

SET hive.exec.dynamic.partition=nonstrict

We cannot perform ALTER on the Dynamic partition.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM