当前位置:   article > 正文

hive Error SemanticException Unable to fetch table

unable to fetch table

一、背景

二、现象

在hive中对某个表执行任何操作,都会报错:

hive Error SemanticException Unable to fetch table
  • 1

而同库内其他表,其他库的表,均可以正常查询。

三、问题排查过程

四、原因分析

hive的mysql元数据表内存在脏数据导致

五、解决

1. select DB_ID from DBS where NAME='your-database-name'
2. select tbl_id from TBLS where TBL_NAME='your-table-name' and DB_ID=<id from step 1>;
3. delete from PARTITION_KEY_VALS WHERE PART_ID in (select PART_ID from PARTITIONS where TBL_ID=<id from step 2>);
4. delete from PARTITION_PARAMS WHERE PART_ID in (select PART_ID from PARTITIONS where TBL_ID=<id from step 2>); 
5. delete from PARTITIONS where TBL_ID=<id from step 2>; 
6. delete from TBL_COL_PRIVS where TBL_ID=<id from step 2>;
7. delete from TBL_PRIVS where TBL_ID=<id from step 2>; 
8. delete from TBLS where TBL_ID=<id from step 2>; 
9. COMMIT; 
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9

六、反思与规避

问题发生的原因还没找到。

好记性不如赖笔头。
与君共勉。
  • 1
  • 2
声明:本文内容由网友自发贡献,不代表【wpsshop博客】立场,版权归原作者所有,本站不承担相应法律责任。如您发现有侵权的内容,请联系我们。转载请注明出处:https://www.wpsshop.cn/w/繁依Fanyi0/article/detail/634806
推荐阅读
相关标签
  

闽ICP备14008679号