分区仍然显示在配置单元中,即使它们在外部表中丢失

问题描述:

我在蜂巢中有一个外部表,按年,月,日分区。所以我放弃了一个分区,但我仍然在显示分区中看到它。分区仍然显示在配置单元中,即使它们在外部表中丢失

>use test_raw_tables; 
>show partitions test1_raw; 
[year=2016/month=01/day=01] 
[year=2017/month=03/day=24] 

> alter table test1_raw drop partition (year=2016, month=01, day=01); 
> refresh test1_raw; 
> show partitions test1_raw; 
[year=2016/month=01/day=01] 
[year=2017/month=03/day=24]  ---Still see the dropped partition here---- 

> msck repair table test1_raw; 
> show partitions test1_raw; 
[year=2016/month=01/day=01] 
[year=2017/month=03/day=24] ---Still see the dropped partition here---- 

从带有蜂巢作为引擎的黑斑羚上运行。

描述test1_raw COL_NAME,DATA_TYPE,评论( 'amount_hold', '诠释', '')( '身份证', '诠释', '')( 'TRANSACTION_ID', '弦', '') ('''''''')'''''''''''''''''''''''''''''''''''''''''' ',None,None)('#Partition Information',None,None)('#col_name','data_type','comment')('',None,None)('year','string','' )( '月', '弦', '')( '天', '弦', '') 位置 'HDFS://本地主机/ SYS/datalake /测试/ test1_raw'

是什么这里的问题? 删除后,该分区中的hdfs中的数据将被删除。无法找出问题。

+0

**(1)**请添加表格定义**(2)**从哪里运行代码?黑斑羚壳?蜂巢?直线? –

+0

@DuduMarkovitz表是一个外部表。从配置单元shell运行查询。 –

+0

'refresh'是作为Impala命令,而不是配置单元。我需要知道你在哪里执行以及表定义,包括相关的分区定义。还请告诉我他们的路径在文件系统中的样子。 –

在您的表格定义列年,月和日是字符串格式。 请尝试'2016','01'和'01'。 我使用下面的代码,它的工作原理。

alter table test1_raw drop partition (year='2016', month='01', day='01'); 
+0

如果它适合您,请将其作为正确答案 –