0

I am facing a strange issue with hive, I have a table, partitioned on the basis of dept_key (its a integer eg.3212) table is created as follows

create external table dept_details (dept_key,dept_name,dept_location) PARTITIONED BY (dept_key_partition INT) ROW FORMAT DELIMITED FIELDS TERMINATED BY '~' LOCATION '/dept_details/dept/';

Now I have some partitions already added e.g: 1204,1203,1204 When I tried dropping the partition I by mistake typed only dept_key and not "dept_key_partition" this in turn dropped all my partition drop query alter table dept_details drop partition (dept_key=12), its a very strange issue which I am facing. Please let me know what can be the probable issue. Thank you.

Mayank
  • 165
  • 1
  • 5
  • 20

1 Answers1

0

From Hive LanguageManual DDL...

As of Hive 0.14 (HIVE-8411), users are able to provide a partial partition spec for certain above alter column statements, similar to dynamic partitioning (...) you can change many existing partitions at once using a single ALTER statement (...) Similar to dynamic partitioning, hive.exec.dynamic.partition must be set to true

Looks like the partial specification feature has been ported to other commands like DROP, TRUNCATE even if it's not explicit in the documentation.

In short: it's not a bug, it's a feature.

Samson Scharfrichter
  • 8,884
  • 1
  • 17
  • 36
  • But if specify other column name it shouldn't drop all the partition, correct me If I am wrong. I have put the drop query in the question now. – Mayank Aug 20 '15 at 06:50
  • Yes, indeed, if you have just 1 partition key and you specified a specific value for that key, Hive should have dropped that partition only. I have no idea of what happened in your case. – Samson Scharfrichter Aug 20 '15 at 08:39