如何更新/删除 Hive 分区? [英] How to Update/Drop a Hive Partition?
本文介绍了如何更新/删除 Hive 分区?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
向Hive中的外部表添加分区后,如何更新/删除它?
After adding a partition to an external table in Hive, how can I update/drop it?
推荐答案
您可以通过以下方式更新 Hive 分区,例如:
You can update a Hive partition by, for example:
ALTER TABLE logs PARTITION(year = 2012, month = 12, day = 18)
SET LOCATION 'hdfs://user/darcy/logs/2012/12/18';
此命令不会移动旧数据,也不会删除旧数据.它只是将分区设置为新位置.
This command does not move the old data, nor does it delete the old data. It simply sets the partition to the new location.
要删除分区,您可以这样做
To drop a partition, you can do
ALTER TABLE logs DROP IF EXISTS PARTITION(year = 2012, month = 12, day = 18);
希望能帮到你!
这篇关于如何更新/删除 Hive 分区?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文