【发布时间】:2018-05-14 09:36:26
【问题描述】:
我们的 hadoop 集群存在数据损坏问题。我们在 hive 上有一个托管表,其中包含按年份划分的三年数据。
以下两个查询运行良好,没有任何问题
select count(*) from tkt_hist table where yr=2015
select count(*) from tkt_hist table where yr=2016
select count(*) from tkt_hist table where yr=2017
但是,当我们尝试每年进行分组时,会显示以下错误。
Error while compiling statement: FAILED: SemanticException java.io.FileNotFoundException: File hdfs://ASIACELLHDP/apps/hive/warehouse/gprod1t_base.db/toll_tkt_hist_old/yr=2015/mn=01/dy=01 does not exist. [ERROR_STATUS]
当我们指定 2015 年以外的年份时,即使选择也不起作用。
//this works fine
Select * from tkt_hist where yr=2015 limit 10;
// below throws same error mentioned above.
Select * from tkt_hist where yr=2016;
【问题讨论】:
-
好像物理分区不存在,但metastore中存在分区:使用这些命令修复表:msck repair table mytable;
-
执行这个命令安全吗?它的实际生产数据。导致这个问题的原因是我们不小心在创建受影响表的同一个 hdfs 文件夹中创建了另一个托管表。
-
这个命令将为所有丢失的分区创建一个物理目录。换句话说,一些分区信息在 Metastore 中可用,但实际的分区路径不存在。然后它只会创建分区文件路径。就这样。所以我认为它是安全的。
-
你检查了 hdfs 吗?对于您遇到错误的文件?
-
你用的是什么hive版本?
标签: hive hdfs hiveql hortonworks-data-platform