0

I'm trying to load a text file from HDFS into Hive database using following command

hive> load data local inpath '/user/hive/input/emp_details.txt' into table emp;

I'm getting the following exception:

FAILED: SemanticException Line 1:23 Invalid path ''/user/hive/input/emp_details.txt'': No files matching path file:/user/hive/input/emp_details.txt

I'm using hive 1.2.2 on hadoop 2.7.2 on Centos7 OS

I gave the full permissions to the file path in HDFS using following command:

hdfs dfs -chmod -R 777 /user/hive/input

Not sure what else is missing, could anyone please suggest what to do. Thanks in advance!

arghtype
  • 4,376
  • 11
  • 45
  • 60
Usama Abdulrehman
  • 1,041
  • 3
  • 11
  • 21

1 Answers1

1

LOCAL keyword means you are trying to load data from local filesystem and not from HDFS.

You should use:

load data inpath '/user/hive/input/emp_details.txt' into table emp;

See also Difference between `load data inpath ` and `location` in hive?

arghtype
  • 4,376
  • 11
  • 45
  • 60
  • 1
    Thank you so much for your advise. Its loading the data properly now. hive> load data inpath '/user/hive/input/emp_details.txt' into table emp; Loading data to table payroll.emp Table payroll.emp stats: [numFiles=2, numRows=0, totalSize=243, rawDataSize=0] OK Time taken: 0.883 seconds hive> – Usama Abdulrehman May 09 '20 at 05:53