如果分区列名称不正确,Hive将删除所有分区 [英] Hive drops all the partitions if the partition column name is not correct

查看:230
本文介绍了如果分区列名称不正确,Hive将删除所有分区的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正遇到一个关于蜂巢的奇怪问题, 我有一张基于dept_key分区的表(它是一个整数,例如3212) 表创建如下

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

现在我已经添加了一些分区,例如:1204,1203,1204 当我尝试删除分区时,我错误地只输入了dept_key而不是"dept_key_partition",这反过来又删除了我所有的分区 删除查询alter table dept_details drop partition (dept_key=12),这是我面临的一个非常奇怪的问题.请让我知道可能是什么问题. 谢谢.

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.

推荐答案

来自

从Hive 0.14(HIVE-8411)开始,用户可以提供部分 某些上述alter column语句的分区规范,类似于 动态分区(...),您可以使用单个ALTER语句(...)一次更改许多现有分区hive.exec.dynamic.partition必须设置为true

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

即使文档中没有明确说明,部分规范功能也已经移植到了DROP,TRUNCATE等其他命令中.

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.

这篇关于如果分区列名称不正确,Hive将删除所有分区的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆