HDINSIGHT配置单元,MSCK REPAIR TABLE table_name抛出错误

时间:2016-10-14 13:07:40

标签: hive hadoop-partitioning bigdata

我有一个名为employee的外部分区表,其中包含分区(年,月,日),每天都会有一个新文件来到今天的特定日期位置呼叫,并且它将在2016/10/13

TABLE SCHEMA:
create External table employee(EMPID Int,FirstName String,.....)
partitioned by (year string,month string,day string)
ROW FORMAT DELIMITED FIELDS TERMINATED BY ',' LINES TERMINATED BY '\n' LOCATION '/.../emp';

所以我们每天都需要运行正常工作的命令

ALTER TABLE employee ADD IF NOT EXISTS PARTITION (year=2016,month=10,day=14) LOCATION '/.../emp/2016/10/14';

但是一旦我们尝试使用下面的命令,因为我们不想手动执行上面的alter table命令,它会抛出Error

hive> MSCK REPAIR TABLE employee;
FAILED: Execution Error, return code 1 from org.apache.hadoop.hive.ql.exec.DDLTask

注意:

hive> MSCK TABLE employee; //this show me that a partition has not added in the table
OK
Partitions not in metastore: employee:2016/10/14
Time taken: 1.066 seconds, Fetched: 1 row(s)

请帮助我,因为我坚持这一点。我们是否有针对此类情况的解决方法?

1 个答案:

答案 0 :(得分:24)

我为我的问题找到了一个解决方法,如果表格静态分区名称类似于'year = 2016 / month = 10 / day = 13'那么我们可以使用下面的命令,它正在工作......

set hive.msck.path.validation=ignore;
MSCK REPAIR TABLE table_name;