Support Questions

Find answers, ask questions, and share your expertise
Announcements
Celebrating as our community reaches 100,000 members! Thank you!

I am getting below error while creating external table

avatar
Explorer

FAILED: Execution Error, return code 1 from org.apache.hadoop.hive.ql.exec.DDLTask. MetaException(message:hdfs://quickstart.cloudera:8020/user/cloudera/emp1/emp.txt is not a directory or unable to create one)

1 ACCEPTED SOLUTION

avatar
Super Guru
@Ram M

can you try create table like this

create external table emp1(eno int,

ename string,

sal string)

row format delimited

fields terminate by '~'

location '/tmp';

this will create a table with name emp1 on hdfs under /tmp location. seems you are following some cloudera documentation to create table on hdp platform but user cloudera won't exist on HDP thats why you are facing problem.

View solution in original post

11 REPLIES 11

avatar
Super Guru

can you post me command which you are using to create table, do you have a permission on directory where you are creating external table

avatar

@Ram M

When you are trying to define the "LOCATION" then you should remember:

1. the "/user/cloudera/emp1" directory exist in your HDFS filesystem

2. The "/user/cloudera/emp1" in your HDFS has the file "emp.txt"

Can you please run the following command in your HDFS and share the results?

hdfs dfs -ls /user/cloudera/emp1

.

avatar
Explorer

Last login: Sat Dec 3 07:58:20 2016 from 192.168.203.1 [cloudera@quickstart ~]$ hdfs dfs -ls /user/cloudera Found 5 items -rwxrwxrwx 1 cloudera cloudera 28 2016-12-03 05:41 /user/cloudera/emp.txt drwxr-xr-x - cloudera cloudera 0 2016-12-03 08:08 /user/cloudera/emp1 -rw-r--r-- 1 cloudera cloudera 67 2016-12-03 01:35 /user/cloudera/file3.txt -rw-r--r-- 1 cloudera cloudera 0 2016-12-03 02:36 /user/cloudera/merge.txt drwxr-xr-x - cloudera cloudera 0 2016-12-03 02:21 /user/cloudera/ram

avatar
Explorer

Hi Raj,

create external table emp1(eno int,

ename string,

sal string)

row format delimited

fields terminate by '~'

location '/user/cloudera/hadoop_practise/emp1/emp.txt';

avatar
Super Guru

@Ram Mit seems you are trying cloudera distribution, can you try running the same command from cloudera user with a small change in table location like this /user/cloudera/hadoop_practise/emp1

avatar
Super Guru
@Ram M

can you try create table like this

create external table emp1(eno int,

ename string,

sal string)

row format delimited

fields terminate by '~'

location '/tmp';

this will create a table with name emp1 on hdfs under /tmp location. seems you are following some cloudera documentation to create table on hdp platform but user cloudera won't exist on HDP thats why you are facing problem.

avatar
Explorer

will it load data without loading from specified location?

avatar
Super Guru

sorry I could not get your ask,could you please clarify

avatar
Explorer

table is created...but data is not loaded from EMP1(DIRECT0RY)...In this directory there is emp.txt file