DV93
DV93

Reputation: 23

Unable to load data into hive table

In CDH 5.13, I was using Hive shell to create an internal table. But when I am trying to load data into it, I am getting the following error:

hive> LOAD DATA INPATH '/user/tom/data.txt' INTO TABLE managed_table;
Loading data to table demo.managed_table
FAILED: Execution Error, return code 1 from org.apache.hadoop.hive.ql.exec.MoveTask. org.apache.hadoop.hive.ql.metadata.HiveException: Access denied: Unable to move source hdfs://quickstart.cloudera:8020/user/tom/data.txt to destination hdfs://quickstart.cloudera:8020/user/hive/warehouse/demo.db/managed_table: Permission denied: user=cloudera, access=WRITE, inode="/user/tom":hdfs:supergroup:drwxr-xr-x

I tried to do the following, still not able to load the file.

[cloudera@quickstart /]$ sudo -u hdfs hadoop fs -chmod 777 /user/tom/data.txt
[cloudera@quickstart /]$ hdfs dfs -ls /user/tom/
Found 1 items
-rwxrwxrwx   1 hdfs supergroup         64 2020-01-24 00:57 /user/tom/data.txt

and

[cloudera@quickstart /]$ sudo -u hdfs hadoop fs -chmod 777 /user/hive/warehouse/demo.db/managed_table
[cloudera@quickstart /]$ hdfs dfs -ls /user/hive/warehouse/demo.db/
Found 1 items
drwxrwxrwx   - cloudera supergroup          0 2020-01-24 05:28 /user/hive/warehouse/demo.db/managed_table

Upvotes: 1

Views: 1639

Answers (1)

Gomz
Gomz

Reputation: 868

From the error, it looks like the access is required at the directory level /user/tom

Permission denied: user=cloudera, access=WRITE, inode="/user/tom":hdfs:supergroup:drwxr-xr-x

From the description, it looks like the chmod 777 was performed for the .txt file under the directory /user/tom and not on the directory itself.

Try running the below and see if it fixes the issue.

sudo -u hdfs hadoop fs -chmod -R 777 /user/tom/

Upvotes: 1

Related Questions