Hive drops all the partitions if the partition column name is not correct

落爺英雄遲暮 提交于 2019-12-12 03:38:46

问题


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.


回答1:


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.



来源:https://stackoverflow.com/questions/32093132/hive-drops-all-the-partitions-if-the-partition-column-name-is-not-correct

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!