Skip to main content
hive1
Gold ⭐️
Mar 20, 2023 12:49 AM UTC
Solved

Unable to delete partition having %01 in the name

Dear Members,

 

I have accidently created a partition having characters %01 in the name. %01 is start of header `as per the notepad++`.

When i am trying to delete the partition using ALTER statement, there is no error but partition also not getting deleted.

 

can anyone suggest how to delete such partitions with special characters.

 

ALTER TABLE <table_name> DROP IF EXISTS PARTITION (code='YATHAH%0188QW');

 

hive1
hive1Answer
Gold ⭐️
Mar 23, 2023 10:55 PM UTC

Found the solution - replace %01 --> \001 and it did the trick to delete the partition.

8 replies

asish
Gold ⭐️⭐️⭐️
Gold ⭐️⭐️⭐️
Mar 20, 2023 8:11 AM UTC

@hive1 

 

Can you set below param:

 

 set hive.msck.path.validation=skip;

Then use

 

MSCK REPAIR TABLE tablename DROP PARTITIONS;

 

Translate
hive1
hive1Author
Gold ⭐️
Mar 20, 2023 8:40 AM UTC

Hello Asish,

 

Thanks for response. I tried as per your comments still the result is same.

Partition is not getting dropped.

 

Translate
hive1
hive1Author
Gold ⭐️
Mar 21, 2023 5:31 AM UTC

Hello Asish, This also didn't work.

Translate
Shelton
Gold ⭐️⭐️⭐️
Mar 23, 2023 12:39 PM UTC

@hive1 
What is the hive version? Can you try the below and revert
Set  the below two properties before executing the rename partition

Spoiler
hive> set fs.hdfs.impl.disable.cache=false;
hive> set fs.file.impl.disable.cache=false;

Then run the rename partition command

Spoiler
hive> ALTER TABLE <table_name> (code='YATHAH%0188QW') RENAME TO PARTITION (code='new_name');

Share the output for further analysis

 

 

 

Translate
hive1
hive1AuthorAnswer
Gold ⭐️
Mar 23, 2023 10:55 PM UTC

Found the solution - replace %01 --> \001 and it did the trick to delete the partition.

Translate