how to skip Trash while dropping partition from Managed Tables using alter drop partition command

10,943

Solution 1

No you can't do that with the current hive versions available. The data is always moved to trash and metadata is lost for ever.

How ever, the trash by default should be configured to delete the data after a day. I guess that should be fine for most cases.

Solution 2

Try this set.

SET hive.warehouse.data.skiptrash=true;

Solution 3

Here is a patch for skipTrash while dropping table, if that helps.

https://issues.apache.org/jira/browse/HIVE-6469 Its not accepted by the hive community yet but the patch should apply to HIVE-0.12 without any problem. The patch for HIVE-0.13 and trunk will be there as well. hope it helps.

Solution 4

Try:

ALTER TABLE tablename DROP IF EXISTS PARTITION partionspec PURGE
Share:
10,943
hjamali52
Author by

hjamali52

Updated on June 05, 2022

Comments

  • hjamali52
    hjamali52 almost 2 years

    Is there any way to skip Trash while dropping a partition using the command below from a Managed Table in Hive?

    ALTER TABLE <table> DROP PARITION (<partition_name>)
    

    Similar to what we do when removing files using hadoop fs command like hadoop fs -rmr -skipTrash

  • hjamali52
    hjamali52 almost 11 years
    In our case, volume for removal is huge, it is exceeding the limits. Can you please help how we can increase that
  • Eugene
    Eugene almost 9 years
    Hive 1.2 supports PURGE option to skip trash: cwiki.apache.org/confluence/display/Hive/…
  • Jay99
    Jay99 over 6 years
    Yes, this patch was rebased with HIVE-7100, that renames this functionality to PURGE, somehow hive community thought to follow the ORACLE naming convention than the Hadoop ones :)