如何在Hive中删除一个外部表,当hdfs路径已被删除?

nwwlzxa7  于 2022-12-09  发布在  HDFS
关注(0)|答案(1)|浏览(343)

我已经删除了HDFS路径/user/abc,并且使用rm -R命令将一些配置单元表存储在/user/abc/data/abc.db中。
尽管使用Hive SQL正确删除了我的常规表,但我的external表没有删除,并出现以下错误:

[Code: 1, SQL State: 08S01]  Error while processing statement: FAILED: Execution Error, return code 1 from org.apache.hadoop.hive.ql.exec.DDLTask. MetaException(message:Failed to load storage handler:  Error in loading storage handler.org.apache.phoenix.hive.PhoenixStorageHandler)

如何安全地删除表?

我尝试使用:

delete from TBL_COL_PRIVS where TBL_ID=[myexternaltableID];
 delete from TBL_PRIVS where TBL_ID=[myexternaltableID];
 delete from TBLS where TBL_ID=[myexternaltableID];

但它不工作,并显示以下错误消息:

[Code: 10297, SQL State: 42000]  Error while compiling statement: FAILED: SemanticException [Error 10297]: Attempt to do update or delete on table sys.TBLS that is not transactional

谢谢你的好意,

  • NB:我知道使用HiveQL删除模式应该更安全,但在这个特定的情况下,这不是这样做的。*
hlswsv35

hlswsv351#

解决方案是使用以下命令从配置单元元存储(PostgreSQL)中删除表

delete from "TABLE_PARAMS" where "TBL_ID"='[myexternaltableID]';
delete from "TBL_COL_PRIVS" where "TBL_ID"='[myexternaltableID]';
delete from "TBL_PRIVS" where "TBL_ID"='[myexternaltableID]';
delete from "TBLS" where "TBL_ID"='[myexternaltableID]';
  • 注意:顺序很重要。*

相关问题