Search code examples
hivehdfs

Delete data from .Trash in hdfs


When I delete data from hdfs if goes to .Trash.

I can either use

hdfs dfs -rm -skipTrash /path_to_directory

or use

hdfs dfs -expunge

to remove data already in .Trash

Two questions:

  1. While dropping table in Hive - do the tables go to .Trash or they are removed permanently?

  2. Is this possible to remove data from .Trash for all users? Assuming I have required privileges...


Solution

  • If you are dropping an external table, nothing is going to happen as it doesn't delete any data.

    For managed tables, yes all the data files will go to the .Trash directory of the user who ran the drop command. However it's only data and not the metadata.

    For other part of your question, yes you could delete the .Trash directory of any user if you have required privilege.