简体   繁体   English

如何删除 Hive 默认分区值,__HIVE_DEFAULT_PARTITION__

[英]How to delete Hive default partition value, __HIVE_DEFAULT_PARTITION__

I am using Glue metestore for Hive and I have AWS EMR cluster to query and modify Hive tables.我正在将 Glue metestore 用于 Hive,并且我有 AWS EMR 集群来查询和修改 Hive 表。

My data for this resides in S3我的数据位于 S3 中

I have 3 partition columns:我有 3 个分区列:

yr_no: int, month_no: int, uniq_id: int

However I have some files that have NULL values for these which Hive sets the partition value for yr_no and month_no as HIVE_DEFAULT_PARTITION但是,我有一些文件具有 NULL 值,其中 Hive 将 yr_no 和 month_no 的分区值设置为HIVE_DEFAULT_PARTITION

But since yr_no and month_no are both ints, I cannot easily drop those partitions.但由于 yr_no 和 month_no 都是整数,我不能轻易删除这些分区。

I tried below formats:我尝试了以下格式:

ALTER TABLE table DROP PARTITION(yr_no=__HIVE_DEFAULT_PARTITION__);
ALTER TABLE table DROP PARTITION(yr_no<1);

First command complained since the column is int and 2nd complained about the syntax <第一个命令抱怨,因为列是 int,第二个命令抱怨语法 <

Is there a simple way to drop it on yr_no= HIVE_DEFAULT_PARTITION or month_no= HIVE_DEFAULT_PARTITION有没有一种简单的方法可以将它放在 yr_no= HIVE_DEFAULT_PARTITION或 month_no= HIVE_DEFAULT_PARTITION 上

Maybe you can use show partitons at first.也许您可以首先使用show partitons And then, use desc formatted partition(yr_no=xxx,month_no=xxxx) to see the detail informations.然后,使用desc formatted partition(yr_no=xxx,month_no=xxxx)查看详细信息。

您可以执行以下操作,它会起作用。

ALTER TABLE table DROP PARTITION(yr_no='__HIVE_DEFAULT_PARTITION__');

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM