hadoop - 分区仍显示在配置单元中,即使已将其删除用于外部表

标签 hadoop hive hiveql impala

我在 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/

相关文章:

hadoop - 将字符串 'ddMMMyyyy' 转换为 Hive 中的日期值

hive explain plan 哪里看全表扫描?

java - 启动NameNode失败

hadoop - 在使用 MapReduce 执行字数统计时,是否可以在 map 函数中将数据拆分为字词?

hadoop - 从 Windows 使用 Java 访问 HDFS

hadoop - 如何将级联作业的输出合并到特定大小

sql - 只需从配置单元表中获取列名

hadoop - 无法识别的 Hadoop 主要版本号 : 3. 0.0-beta1 在 org.apache.hadoop.hive.shims.ShimLoader.getMajorVersion

hadoop - HIVE ODBC - 故障转移

hadoop - 如何在HIVEQL中的特定列值上保留外部联接?