我在 hive 中有一个外部表,按年,月,日划分。因此,我删除了一个分区,但仍在show分区中看到它。
>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----
以 hive 为引擎从黑斑羚运行。
describe test1_raw col_name,data_type,comment ('amount_hold', 'int', '') ('id', 'int', '') ('transaction_id', 'string', '') ('recipient_id', 'string', '') ('year', 'string', '') ('month', 'string', '') ('day', 'string', '') ('', None, None) ('# Partition Information', None, None) ('# col_name ', 'data_type ', 'comment ') ('', None, None) ('year', 'string', '') ('month', 'string', '') ('day', 'string', '') location 'hdfs://localhost/sys/datalake/testing/test1_raw'
这里有什么问题?
删除该分区后,将删除该分区中hdfs中的数据。无法解决问题。
最佳答案
在表定义中,“年,月和日”列为字符串格式。
请尝试使用“2016”,“01”和“01”。
我用下面的代码,它的工作原理。
alter table test1_raw drop partition (year='2016', month='01', day='01');
关于hadoop - 分区仍显示在配置单元中,即使已将其删除用于外部表,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/43525769/