How to truncate a partitioned external table in hive?

随声附和 提交于 2020-01-01 06:44:08

问题


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; 

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

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


回答1:


Make your table MANAGED first:

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

Then truncate:

truncate table abc;

And finally you can make it external again:

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


来源:https://stackoverflow.com/questions/53257144/how-to-truncate-a-partitioned-external-table-in-hive

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!