Support Questions
Find answers, ask questions, and share your expertise
Announcements
Alert: Welcome to the Unified Cloudera Community. Former HCC members be sure to read and learn how to activate your account here.

Drop partition remove data but not HDFS folder

Highlighted

Drop partition remove data but not HDFS folder

Explorer

Hi,

 

We have CDH 5.15 and when we drop partition in Hive it removes the partition and its data but the folder of the partition remains empty and is not removed.

 

How can I change this behavior?

 

Thanks

3 REPLIES 3

Re: Drop partition remove data but not HDFS folder

Rising Star
Hi,

If it is a External table we need to delete the directory manually.

ALTER TABLE table_name DROP [IF EXISTS] PARTITION <>;
hadoop fs -rm -r <partition file path>

Thanks
Jerry

Re: Drop partition remove data but not HDFS folder

Explorer

Hi,

 

It's an internal table with 4 levels of partitions,

But still, when I remove the partition the data and metadata is deleted but not the folder.

 

Thanks

Re: Drop partition remove data but not HDFS folder

Guru
Hi,

I assume that you work on the managed table instead of external table? This could be because of lack of permissions from the user who tried to run the DROP command to remove the underlining HDFS path. Check HMS server log to see if you can find any error messages.
Don't have an account?
Coming from Hortonworks? Activate your account here