Unable to create external table on HIVE

+1 vote

IN LMS I cannot create an external table using location I am getting error below. Could you please help?

hive> CREATE EXTERNAL TABLE IF NOT EXISTS edureka_762118.NYSE_daily 

> (exchange_name STRING, 

> stock_symbol STRING, 

> stock_date DATE, 

> stock_price_open FLOAT, 

> stock_price_high FLOAT, 

> stock_price_low FLOAT, 

> stock_price_close FLOAT, 

> stock_volume FLOAT, 

> stock_price_adj_close FLOAT 

> ) 

> ROW FORMAT DELIMITED 

> FIELDS TERMINATED BY ',' 

 > LINES TERMINATED BY '\n' 

 > STORED AS TEXTFILE 

> LOCATION '/user/edureka_762118/NYSE_daily_prices_Q.csv';

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

Thanks

Ozer

Oct 13 in Big Data Hadoop by Ozer
• 130 points

edited Oct 14 by Omkar 105 views

2 answers to this question.

0 votes

Hi @Ozer. The LOCATION is used to specify the location to store the table and this location overwrites the Hive's default location. The reason for your error is that you are specifying a csv file for the LOCATION option. Instead, mention a directory and it should work. 

answered Oct 14 by Kiran
0 votes

Hi @Ozer,

This error occurred because there is no need of specify the file name in the location, hive automatically take all the files in the directory that you specify in location. I hope your command without the file name will work.

hive> CREATE EXTERNAL TABLE IF NOT EXISTS edureka_762118.NYSE_daily 

> (exchange_name STRING, 

> stock_symbol STRING, 

> stock_date DATE, 

> stock_price_open FLOAT, 

> stock_price_high FLOAT, 

> stock_price_low FLOAT, 

> stock_price_close FLOAT, 

> stock_volume FLOAT, 

> stock_price_adj_close FLOAT 

> ) 

> ROW FORMAT DELIMITED 

> FIELDS TERMINATED BY ',' 

 > LINES TERMINATED BY '\n' 

 > STORED AS TEXTFILE 

> LOCATION '/user/edureka_762118
answered 5 days ago by Richa

Related Questions In Big Data Hadoop

0 votes
1 answer

How to create external Hive table?

It's simple. You just have to add external ...READ MORE

answered Dec 14, 2018 in Big Data Hadoop by Omkar
• 67,660 points
77 views
0 votes
1 answer

Not able to create Hive table from HDFS file

You dont have to specify the file name ...READ MORE

answered Dec 5, 2018 in Big Data Hadoop by Omkar
• 67,660 points
350 views
0 votes
1 answer

How to create a managed table in Hive?

You can use this command: create table employee(Name ...READ MORE

answered Dec 14, 2018 in Big Data Hadoop by Omkar
• 67,660 points
591 views
0 votes
1 answer

How to create a Hive table with a sequence file?

In Hive we can create a sequence ...READ MORE

answered Dec 17, 2018 in Big Data Hadoop by Omkar
• 67,660 points
530 views
0 votes
1 answer

What is Metastore in Hive?

It stores metadata for Hive tables (like their schema ...READ MORE

answered Dec 20, 2018 in Big Data Hadoop by Frankie
• 9,810 points
172 views
0 votes
1 answer

Hadoop Mapreduce word count Program

Firstly you need to understand the concept ...READ MORE

answered Mar 16, 2018 in Data Analytics by nitinrawat895
• 10,710 points
3,299 views
0 votes
1 answer

hadoop.mapred vs hadoop.mapreduce?

org.apache.hadoop.mapred is the Old API  org.apache.hadoop.mapreduce is the ...READ MORE

answered Mar 16, 2018 in Data Analytics by nitinrawat895
• 10,710 points
390 views
0 votes
10 answers

hadoop fs -put command?

put syntax: put <localSrc> <dest> copy syntax: copyFr ...READ MORE

answered Dec 7, 2018 in Big Data Hadoop by Aditya
16,234 views
0 votes
1 answer

Unable to create table in Hive

It is looking like your Hadoop daemons ...READ MORE

answered Aug 6 in Big Data Hadoop by Yogi
30 views
0 votes
1 answer

How to create smaller table from big table in HIVE?

You could probably best use Hive's built-in sampling ...READ MORE

answered Sep 24, 2018 in Big Data Hadoop by digger
• 26,550 points
204 views