yogesh
yogesh

Reputation: 231

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');

Upvotes: 1

Views: 1385

Answers (2)

Bhaskar Das
Bhaskar Das

Reputation: 682

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.

Upvotes: 1

Ari
Ari

Reputation: 2378

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

Upvotes: 2

Related Questions