hadoop分区仍然显示在hive中,即使它们是为外部表删除的

aiazj4mn  于 2021-05-29  发布在  Hadoop
关注(0)|答案(1)|浏览(398)

我在Hive中有一个按年、月、日划分的外部表。所以我删除了一个分区,但在show分区中仍然可以看到它。

  1. >use test_raw_tables;
  2. >show partitions test1_raw;
  3. [year=2016/month=01/day=01]
  4. [year=2017/month=03/day=24]
  5. > alter table test1_raw drop partition (year=2016, month=01, day=01);
  6. > refresh test1_raw;
  7. > show partitions test1_raw;
  8. [year=2016/month=01/day=01]
  9. [year=2017/month=03/day=24] ---Still see the dropped partition here----
  10. > msck repair table test1_raw;
  11. > show partitions test1_raw;
  12. [year=2016/month=01/day=01]
  13. [year=2017/month=03/day=24] ---Still see the dropped partition here----

以Hive为引擎从 Impala 中奔跑。
描述test1的原始列名称、数据类型、注解('amount\u hold'、'int'、'')('id'、'int'、'')('transaction\u id'、'string'、'')('recipient\u id'、'string'、'')('year'、'string'、'')('month'、'string'、'')(''day'、'string'、'')(''dispartition information'、none、none)('col\u name'、'data\u type'、'comment')(''、none、none)('year','字符串',''('月','字符串','')('日','字符串','')位置'hdfs://localhost/sys/datalake/testing/test1_raw'
这里有什么问题?删除分区后,hdfs中的数据将被删除。我搞不懂这个问题。

4dbbbstv

4dbbbstv1#

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

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

相关问题