Dipen
Dipen

Reputation: 1064

HIVE> FAILED: SemanticException Line 1:23 Invalid path

I tired to load the data into my table 'users' in LOCAL mode and i am using cloudera on my virtual box. I have a file placed my file inside /home/cloudera/Desktop/Hive/ directory but i am getting an error

FAILED: SemanticException Line 1:23 Invalid path ''/home/cloudera/Desktop/Hive/hive_input.txt'': No files matching path file:/home/cloudera/Desktop/Hive/hive_input.txt

My syntax to load data into table

Load DATA LOCAL INPATH '/home/cloudera/Desktop/Hive/hive_input.txt' INTO Table users

Upvotes: 8

Views: 18667

Answers (5)

Joshua Gloor
Joshua Gloor

Reputation: 13

My path to the file in HDFS was data/file.csv, note, it is not /data/file.csv.
I specified the LOCATION during table creation as data/file.csv.

Executing

LOAD DATA INPATH '/data/file.csv' INTO TABLE example_table;

failed with the mentioned exception. However, executing

LOAD DATA INPATH 'data/file.csv' INTO TABLE example_table;

worked as desired.

Upvotes: 0

Aboubakr MOUBARAK
Aboubakr MOUBARAK

Reputation: 1

Check if you are using a Sqoop import in your script, try to import data to hive from an empty table.

This may cause the scoop import to delete the HDFS location of the hive table.

to confirm run: hdfs dfs -ls before and after you execute the sqoop import, re-create the directory using hdfs dfs -mkdir

Upvotes: 0

Dipen
Dipen

Reputation: 1064

Yes I removed the Local as per @Bhaskar, and path is my HDFS path where file exists not underlying linux path.

Load DATA INPATH '/user/cloudera/input_project/' INTO Table users;

Upvotes: 6

Ratanak Phong
Ratanak Phong

Reputation: 21

You should change permission on the folder that contains your file.

chmod -R 755 /home/user/

Upvotes: 2

Hitender Razora
Hitender Razora

Reputation: 1

Another reason could be the file access issue. If you are running hive CLI from user01 and accessing a file (your INPATH) from user02 home directory, it will give you the same error.

So the solution could be 1. Move the file to a location where user01 can access the file. OR 2. Relaunch the Hive CLI after logging in with user02.

Upvotes: 0

Related Questions