0
votes

Referred this url : Hive - External table creation

Created Hive external table with location keyword and value is pointing to my local disk.

create external table exemp(id int,name string,age int) 
row format delimited 
fields terminated by ','
lines terminated by '\n'
stored as textfile
location 'file:///home/user/data';

But i am getting this error.

FAILED: Execution Error, return code 1 from org.apache.hadoop.hive.ql.exec.DDLTask. MetaException(message:file:/home/user/data is not a directory or unable to create one)

But /home/user/data directory present in my local and have emp details. Any idea, why it is causing the issue

1
is file:///home/user/data a HDFS location? - Vamsi Prabhala
No.. it is my local directory. - Learn Hadoop
the location should be a HDFS location. - Vamsi Prabhala
Vamshi please refer this url :stackoverflow.com/questions/48893078/… . I thing we connect from exernal filesystem - Learn Hadoop
does the user you run hive as, have Write access to the local directory? - Vamsi Prabhala

1 Answers

0
votes

The location which you are using here while creating hive table seems to be a local file location. We need to have HDFS path(or other compatible data source) in order to create a hive table. If you can just scp your data file to HDFS and then try with the HDFS location this will work.