Support Questions

Find answers, ask questions, and share your expertise

Fail to load data from HDFS into Apachi Hive

avatar

Hi All,

After I tried to load data from a file in HDFS into Hive, I ran into a permission error as show below. Could you please help to let me know what I did wrong? 

Thank you, 

 

1) I uploaded a csv file: EMP.csv from my laptop into HDFS folder: /user/admin using admin credential.

2) I use Data Analytic studio to load the csv file into an external table in Hive using the code below:

CREATE EXTERNAL TABLE IF NOT EXISTS emp(
EmployeeID STRING,
FirstName STRING,
LastName STRING,
Email STRING,
PhoneNumber STRING,
HireDate STRING,
JobID STRING,
Salary STRING,
ManagerID STRING,
DepartmentID STRING
)
COMMENT 'My first Hive table'
ROW FORMAT DELIMITED FIELDS TERMINATED BY ','
STORED AS TEXTFILE
LOCATION '/user/admin/EMP.csv'
;

 

Here is the error:

"org.apache.hive.service.cli.HiveSQLException: Error while compiling statement: FAILED: HiveAccessControlException Permission denied: user [hive] does not have [ALL] privilege on [hdfs://sandbox-hdp.hortonworks.com:8020/user/admin/EMP.csv]"

5 REPLIES 5

avatar
Expert Contributor

Hello

 

a quick fix is to put the csv file under the hive folder instead of the admin folder

avatar

Hi Xue,

Thanks for replying my question. After I have tried the solution, I ran into another security issue as show in the screen shot.

TDStephanieSoft_0-1618806492794.png

 

I have tried the HDP_2.6.5. Everything works just fine and the Ambari user interface is more easier to use. 

Thanks again,

avatar
Expert Contributor

Hello 

 

A quick fix is to use hive user not admin user

avatar
Expert Contributor

@TDStephanieSoft  If you are using Ranger kindly check if you have necessary permission for hive user in the HDFS policy for the path '/user/admin/EMP.csv'. Also check whether the hive use has read, write and execute permission in the HDFS location '/user/admin/EMP.csv'

Thanks! 

avatar

After I have checked the permission in Ranger, I noticed that there isn't any policy setup for hive user. I did add a policy to allow access to the folder /user/admin in HDFS to hive user. The problem is I cannot save the new policy due to another security error as show below. 

I wonder if the Hortonworks Sandbox HDP 3.0 that I downloaded is working version 😞

 

 

TDStephanieSoft_0-1618847876296.png