Support Questions

Find answers, ask questions, and share your expertise

The Directory in HDFS goes in Trash when i drop a external table from hive.

avatar
Contributor

Hi All,

I copy the file from local to HDFS in " /data/folder1/file.gz" directory.

then i have created a external table "abc" using the same file location.

When i use command "drop table abc;" its drops the table and also the "folder1/file.gz" from HDFS.

Checked : No background process, no script, nothing running.

found the same in HDFS dir "/user/hiveuser/.Trash/Current/data/folder1/file.gz".

1 ACCEPTED SOLUTION

avatar
Super Guru
@Rohit Sharma

Can you please try creating table on your /data/folder1 table instead of the file?

View solution in original post

2 REPLIES 2

avatar
Super Guru
@Rohit Sharma

Can you please try creating table on your /data/folder1 table instead of the file?

avatar

Hi @Rohit Sharma. Did you use the 'EXTERNAL' keyword when you created the table? If you don't specify 'EXTERNAL' then it is an internal table and the data will be deleted, regardless of what location you specify for the data...