Created on 04-11-2014 12:42 PM - edited 09-16-2022 01:57 AM
I'm writing a program in Java, where I need to load a file from my local disk into Hive. I'm using the JDBC driver for this. The query my program generates looks like this:
load data local inpath '/home/cloudera/temp/testpart/90d0584c080a6607128e03c0cee8a2a666bf83f1b11882d24b72ae420e60e8a3.lzo' into table checkpoint_part partition(year=2014, month=04, day=03, hour=12, minute=17)
Yes, the program is running in the same machine where both the file and Hive are. I'm getting this exception:
java.sql.SQLException: Error while processing statement: FAILED: SemanticException Line 1:23 Invalid path '"/home/cloudera/temp/testpart/90d0584c080a6607128e03c0cee8a2a666bf83f1b11882d24b72ae420e60e8a3.lzo"': No files matching path file:/home/cloudera/temp/testpart/90d0584c080a6607128e03c0cee8a2a666bf83f1b11882d24b72ae420e60e8a3.lzo
at org.apache.hive.jdbc.Utils.verifySuccess(Utils.java:159)
at org.apache.hive.jdbc.Utils.verifySuccessWithInfo(Utils.java:147)
at org.apache.hive.jdbc.HiveStatement.execute(HiveStatement.java:182)
at Program.main(Program.java:230)
Anyone could help me with this? I'm completely lost. I mean, the file is right there.
Created 05-03-2014 09:02 AM
Created 12-13-2014 03:04 AM
Hello Harsh,
Even if I am using the Hive CLI, which i presume uses ODBC driver, still I get the same error if my path is /root/filename.csv.
hive> load data local inpath "/root/veraxinternal.csv" overwrite into table veraxexternal;
FAILED: SemanticException Line 1:23 Invalid path '"/root/veraxinternal.csv"': No files matching path file:/root/veraxinternal.csv
If I copy the same file to a different a location and do loadoperation it goes well. What's the logic here? does not hive accept files from /Root? By the way how can I trace this if I need to debug
hive> load data local inpath "/home/cloudera/veraxinternal.csv" overwrite into table veraxexternal;
Copying data from file:/home/cloudera/veraxinternal.csv
Copying file: file:/home/cloudera/veraxinternal.csv
Loading data to table default.veraxexternal
chgrp: changing ownership of 'hdfs://quickstart.cloudera:8020/user/hive/warehouse/veraxexternal': User does not belong to hive
Table default.veraxexternal stats: [numFiles=1, numRows=0, totalSize=113, rawDataSize=0]
OK
Created 12-16-2014 07:10 PM
It sounds like a permission issue. Can you check if the user of hive has permission for that file?
Created 09-03-2015 05:42 PM
Created 06-13-2016 12:01 PM
This is my testing result at the Hadoop master node which used for namenode and hive server2.
When I executing beeline for local file loading to a table, I met same error.
It was the permission issue on the file to the hive user which is the owner of HiveServer2 process.
It was solve when I grant read permission the file including whole path.
Please check the file accessible permission as this.
sudo -u hive cat ~/test.txt