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
Anyone could help me with this? I'm completely lost. I mean, the file is right there.
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]
It sounds like a permission issue. Can you check if the user of hive has permission for that file?
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