Impala SQL: Unable to LOAD DATA from HDFS path due to WRITE permissions

Issue:

While you are using Impala Official docker image "cloudera/quickstart", following exception might be thrown while executing LOAD DATA command to do data migration.


Error:

[Simba]ImpalaJDBCDriver ERROR processing query/statement. Error Code: 0, SQL state: TStatus(statusCode:ERROR_STATUS, sqlState:HY000, errorMessage:AnalysisException: Unable to LOAD DATA from hdfs://quickstart.cloudera:8020/user/customer.tbl.1 because Impala does not have WRITE permissions on its parent directory hdfs://quickstart.cloudera:8020/user ), Query: load data inpath '/user/customer.tbl.1' overwrite into table my_table. [SQL State=HY000, DB Errorcode=500051]


Reason: (https://community.cloudera.com/t5/Interactive-Short-cycle-SQL/Impala-SQL-Unable-to-LOAD-DATA-from-HDFS-path-due-to-WRITE/m-p/51943#M2622)

The actual answer for your question is you need to change the owner/group of /user/customer.tbl.1 accessible by hive/impala

In addition to that, the default cloudera recommended path to maintain hive/impala table is "/user/hive/warehouse/"

So in your case, create a DB called customer in the default path as follows and make sure owner/group accessible by hive/impala and try again

hdfs dfs -ls /user/hive/warehouse/customer.db

hdfs dfs -ls /user/hive/warehouse

drwxrwxrwt   - hive       hive           0 2016-11-25 15:11 /user/hive/warehouse/customer.db


Solution:

Based on above explanation, try to move file to the /user/hive/warehouse, then everything should be OK.

If not, then try to change owner ship via following command:

hdfs dfs -chown -R hive:impala hdfs://quickstart.cloudera:8020/user/hive/warehouse/customer.tbl.2



猜你喜欢

转载自blog.csdn.net/yexianyi/article/details/60957088