Support Questions

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

Hive: INSERT OVERWRITE does not work

avatar
Expert Contributor

I cannot get the following query run using PutHiveQL processor, it fails with the permission denied exception. I see that the processor emulates the same behavior as in Beeline.

But, I have been able to run the query from Hive CLI and writes to a file as expected. So, we know that Hive shell is an option, but can you let me know if there is any specific settings that causes this behavior in Beeline (Hive2) preventing to write to local filesystem?

insert overwrite local directory '/tmp' select current_date from dual

Error: Error while compiling statement: FAILED: HiveAccessControlException Permission denied: user [xxxxx] does not have [WRITE] privilege on [/tmp] (state=42000,code=40000)

1 ACCEPTED SOLUTION

avatar
Super Collaborator

Regardless the reason you've decided to use PutHiveQL for select statement (I would use SelectHiveQL and then PutFile processor to store a result of select)...

But... back to the use case. Both PutHiveQL and Beeline are JDBC based clients. Using "insert overwrite LOCAL directory" doesn't seem to have a sense, as you never know what LOCAL directory (which node, etc) will be in the context. If still temp files are required to be created, you can go with:

1. PutHiveQL (insert overwrite directory, not local).

2. GetHDFS

... continue your processes/transformations with FlowFiles as usual.

Please note, HDFS files will be deleted after GetHDFS will finish.

View solution in original post

10 REPLIES 10

avatar
Super Collaborator

When using JDBC, local files will be created in local directories of a host running HiveServer2 you are connecting to (if you have more than one and connecting thru zookeeper - check all server hosts). So make sure you have writing permissions on those hosts, not on Nifi's one.

Note, the story is totally different when you are using Hive CLI of Beeline embedded mode.