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.
I think the best is to use a script to check that using
and then to call
beeline
with an external scriptI 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.
on hive terminal run below command
HDFS: is value against fs.defaultFS property in core-site.xml
Reply my comment if in case any query...