Support Questions

Find answers, ask questions, and share your expertise
Announcements
Celebrating as our community reaches 100,000 members! Thank you!

How delete files created in user directory with hive queries in a secured cluster [impersonation disabled]?

avatar

How delete files created in user directory with hive queries in the next case:

If I execute this query:

INSERT OVERWRITE DIRECTORY 'hdfs://hdp_cluster/user/my_user/output_folder' SELECT * FROM table_x

I'll have a folder (output_folder) with "hive" as owner (hive:hdfs). How can the final handle this?

Data: We have kerberos + ranger with hive impersonation disabled.

4 REPLIES 4

avatar

@Rodrigo Mendez

I have just validated, if you set hive.server2.enable.doas=true. The end directory(hdfs://hdp_cluster/user/my_user/output_folder) will be created with user name who ever is running that job.

Please check your Kerberos ticket for that user and proxy configurations. Hope this helps you.

avatar

Hi Sridhar!

Impersonation in hive is disabled (you set hive.server2.enable.doas=false).

avatar
Guru

@Rodrigo Mendez what is the final result ? you need the files from user(s) directories to be removed ? Why do you want to perform this action from hive, you could easily do so by scripting (if you have multiple directories) from hdfs command.

avatar

Hi @Shyam Sunder Rai!

Yes, it's easy for me as admin but I want to know if the same user that executes the query has a way to delete these files.