Learn Hadoop
Learn Hadoop

Reputation: 3060

Hive external table with location

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

Upvotes: 2

Views: 4537

Answers (1)

Neha Kumari
Neha Kumari

Reputation: 787

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.

Upvotes: 2

Related Questions