3

How can I set the umask for an Hive HQL script? Either via statements within the script or via a client side configuration set before running the script? I want to make the change on the client side without changing the server side configuration.

I've found that this works from a shell prompt, but I'd like to do it from inside a hive script.

$ hdfs dfs -Dfs.permissions.umask-mode=000 -mkdir /user/jeff/foo
$ hdfs dfs -Dfs.permissions.umask-mode=000 -put bar /user/jeff/foo

These tries don't work:

hive> dfs -mkdir -Dfs.permissions.umask-mode=000 /user/jeff/foo;
-mkdir: Illegal option -Dfs.permissions.umask-mode=000

hive> dfs -Dfs.permissions.umask-mode=000 -mkdir  /user/jeff/foo;
-Dfs.permissions.umask-mode=000: Unknown command

Setting hive.files.umask.value in .hiverc doesn't have the desired effect (The g+w and o+w bits aren't set which was what I was trying to do with this umask.):

hive> set hive.files.umask.value;
hive.files.umask.value=000
hive> dfs -mkdir /user/jeff/foo;
hive> dfs -ls -d  /user/jeff/foo;
drwxr-xr-x   - jeff hadoop          0 2016-02-23 15:19 /user/jeff/foo

It looks like I'll need to sprinkle a bunch of "dfs -chmod 777 ..." statements in my HQL script.

Ideas??

Jeff Taylor
  • 471
  • 2
  • 4
  • 11
  • have you tried setting it up on hdfs? hdfs will take care of this for HIVE. – Vikas Hardia Feb 24 '16 at 09:05
  • Hi Vikas, I need better granularity than a global server side change would offer. Some HQL scripts need a different umask than other HQL scripts. For one script, I need to allow everybody to read and write the data (umask=000) but other scripts work with data that is more sensitive (umask=077). – Jeff Taylor Feb 24 '16 at 23:27

0 Answers0