HIVE> FAILED: SemanticException Line 1:23 Invalid path
Asked Answered
S

5

8

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
Slashing answered 22/10, 2016 at 3:16 Comment(1)
try with out LOCAL , your data is available in HDFS right ? and check for the path in VM , you have given forward slash , check if that actual path is having backward slash.Pinnule
S
6

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;
Slashing answered 23/10, 2016 at 13:52 Comment(0)
D
2

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

chmod -R 755 /home/user/
Desiree answered 8/8, 2019 at 6:48 Comment(0)
M
0

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.

Morphology answered 30/7, 2017 at 16:10 Comment(0)
S
0

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

Sense answered 13/5, 2022 at 19:37 Comment(0)
D
0

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.

Durban answered 31/8, 2022 at 7:5 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.