Hive alter location statement not working

2019-02-17 17:10发布

hive> alter table my_table_name set location "hdfs://nameservice1/foo";
OK
Time taken: 0.173 seconds
hive> alter table my_table_name set location "hdfs://nameservice1/foo/bar";
Authorization failed:org.apache.hadoop.security.AccessControlException: action WRITE not permitted on path hdfs://nameservice1/foo for user hadoop_user. Use show grant to get more details.

As seen in the above screen output, the alter table location is working exactly once on the external table and subsequently it is throwing an error. Please advice how I could get the alter table location statement to work.

标签: hive
3条回答
SAY GOODBYE
2楼-- · 2019-02-17 17:33

I think the best is to use a script to check that using

hdfs fs -ls ///

and then to call beeline with an external script

查看更多
叛逆
3楼-- · 2019-02-17 17:37

I figured out the error and fixed it. The issue was that during the creation of the table i set its location to a non existent path on hdfs. So when i was trying to alter its location,it wasn't allowing me to do so.

The resolution: I first created the directory to which the table was currently pointed to and then created the directory to which i wanted to point the table to. Then the alter table location statement worked as required.

查看更多
别忘想泡老子
4楼-- · 2019-02-17 17:53

on hive terminal run below command

alter table FpML_Data set location hdfs:/file_path_in_HDFS;

HDFS: is value against fs.defaultFS property in core-site.xml

Reply my comment if in case any query...

查看更多
登录 后发表回答