【问题标题】:SemanticException Unable to fetch tableSemanticException 无法获取表
【发布时间】:2021-06-04 12:13:34
【问题描述】:

请问有没有人快速解决掉这样的表?

  • 我想使用 hive shell 删除表时遇到问题。
 hive>> drop table table_1;

错误:编译语句时出错:失败:SemanticException 无法获取表 table_1。空(状态=42000,代码=40000)

这些请求都不起作用:desc\select\

【问题讨论】:

  • 很抱歉,您可以试试drop table database.table_1; 并检查您是否有删除访问权限

标签: hadoop hive


【解决方案1】:

我遇到了同样的问题。当我尝试删除并重新创建该表时,该表已损坏。

我无法找到真正的根本原因,但通过删除表的元数据(在 MySQL 中)已修复,如 here 所述。

在 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; 

其他参考资料:

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2018-01-03
    • 2014-12-05
    • 2020-08-23
    • 2020-04-24
    • 1970-01-01
    • 2021-08-18
    • 1970-01-01
    • 2016-12-19
    相关资源
    最近更新 更多