清空hive表时报错Cannottruncatenon-managedtable怎么办

这篇文章将为大家详细讲解有关清空hive表时报错Cannot truncate non-managed table怎么办,小编觉得挺实用的,因此分享给大家做个参考,希望大家阅读完这篇文章后可以有所收获。

网站建设哪家好,找成都创新互联!专注于网页设计、网站建设、微信开发、微信小程序、集团企业网站建设等服务项目。为回馈新老客户创新互联还提供了汉阴免费建站欢迎大家使用!

在执行命令truncate 清空hive表时,

报错如下:FAILED: SemanticException [Error 10146]: Cannot truncate non-managed table mtime_qa.userorder_logs

我清空的是一个外部表。

如图:

清空hive表时报错Cannot truncate non-managed table怎么办

看hortontworks官方解释:

note:This error happens when you're trying to truncate an external table. Truncate needs to target a native/managed table or an exception will be thrown.

Here's a really great reference:

https://community.hortonworks.com/questions/38807/hive-overwrtite-table.html

以上大意是,要清空的表为外部表,外部表当然不被hive管理,hive只是维护了一个到外部表的引用关系,并不能清空外部的数据。所以,如果有清空表等表编辑表的操作,还是建内部表吧。

关于“清空hive表时报错Cannot truncate non-managed table怎么办”这篇文章就分享到这里了,希望以上内容可以对大家有一定的帮助,使各位可以学到更多知识,如果觉得文章不错,请把它分享出去让更多的人看到。


当前名称:清空hive表时报错Cannottruncatenon-managedtable怎么办
文章URL:http://csdahua.cn/article/gjjjpc.html
扫二维码与项目经理沟通

我们在微信上24小时期待你的声音

解答本文疑问/技术咨询/运营咨询/技术建议/互联网交流