DROP PARTITION是否从HIVE的外部表中删除数据? [英] Does DROP PARTITION delete data from external table in HIVE?

查看:1852
本文介绍了DROP PARTITION是否从HIVE的外部表中删除数据?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

HIVE中的外部表按年,月和日划分.

An external table in HIVE is partitioned on year, month and day.

以下查询是否从该查询中引用的特定分区外部表中删除数据?:-

So does the following query delete data from external table for the specific partitioned referenced in this query?:-

ALTER TABLE MyTable DROP IF EXISTS PARTITION(year=2016,month=7,day=11);

推荐答案

分区方案不是数据.分区方案是存储在元数据中的表DDL的一部分(简单地说:分区键值+数据文件的存储位置).

Partitioning scheme is not data. Partitioning scheme is part of table DDL stored in metadata (simply saying: partition key value + location where the data-files are being stored).

数据本身存储在分区位置(文件夹)中的文件中. 如果删除外部表的分区,则该位置保持不变,但作为分区卸载(删除有关该分区的元数据).您可以卸载的分区位置版本很少(例如以前的版本).

Data itself are stored in files in the partition location(folder). If you drop partition of external table, the location remain untouched, but unmounted as partition (metadata about this partition is deleted). You can have few versions of partition location unmounted (for example previous versions).

您可以删除分区并将其他位置安装为分区(更改表添加分区)或更改现有分区位置.还要删除外部表,请不要删除其中包含文件的表/分区文件夹.然后,您可以在此位置的顶部创建表格.

You can drop partition and mount another location as partition (alter table add partition) or change existing partition location. Also drop external table do not delete table/partitions folders with files in it. And later you can create table on top of this location.

请查看以下答案以更好地了解外部表/分区概念:可以创建许多表(托管表和外部表)同时)在HDFS中相同位置的顶部.

Have a look at this answer for better understanding external table/partition concept: It is possible to create many tables (both managed and external at the same time) on top of the same location in HDFS.

这篇关于DROP PARTITION是否从HIVE的外部表中删除数据?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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