如何在Hive中截断分区的外部表? [英] How to truncate a partitioned external table in hive?

查看:294
本文介绍了如何在Hive中截断分区的外部表?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我打算截断具有一个分区的配置单元外部表.因此,我已使用以下命令截断该表:

I'm planning to truncate the hive external table which has one partition. So, I have used the following command to truncate the table :

 hive> truncate table abc; 

但是,它抛出了一个错误提示:无法截断非托管表abc.

But, it is throwing me an error stating : Cannot truncate non-managed table abc.

有人可以建议我就同一件事...

Can anyone please suggest me out regarding the same ...

推荐答案

首先创建表MANAGED:

ALTER TABLE abc SET TBLPROPERTIES('EXTERNAL'='FALSE');

然后截断:

truncate table abc;

最后,您可以再次将其设置为外部:

And finally you can make it external again:

ALTER TABLE abc SET TBLPROPERTIES('EXTERNAL'='TRUE');

这篇关于如何在Hive中截断分区的外部表?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆