Hive: what location should I mention while creating table?

0 votes
create external table zemp202_external (e_id int,e_name string,e_exp int)
row format delimited fields terminated by ' '
location '/user/hive/warehouse/zemp202_external';

the above location should be warehouse path or it can be local/hdfs path?(because I tried with hdfs path it's not working) ??

May 23 in Big Data Hadoop by Ritu
11 views

1 answer to this question.

Your answer

Your name to display (optional):
Privacy: Your email address will only be used for sending these notifications.
0 votes

It can be a hdfs path. The hive external table is created and the location is given of hdfs so that the data gets loaded into the table through the file present in the hdfs and we won't have to execute the load command to load the data in our table.

Go through the below example for creating the hive external table,

When you create an external table, you can give the path of the file from which you want to add the data in the table.

Suppose, your file is in the directory named flag in hdfs. Now, to load the data from this file you will have to execute the below query

create external table country (name string, landmass string,
zone string, area int)row format delimited fields terminated by ','
stored as textfile location "/user/edureka_398276/flag"; 

The above command will get the data from the file stored in the directory in hdfs named flag and store the data in the table named a country. This way we don't have to execute the load data command to load the data in our table.

The syntax for the above command is as below:

create external table <table_name> (<column_name> <data_type>, <column_name> <data_type>, ...) 
row format delimited fields terminated by '<field_delimiter>' 
stored as <file_type> location <hdfs_path>

answered May 23 by Jishan

Related Questions In Big Data Hadoop

0 votes
1 answer

Error while creating Hive Database table

In your error, it says that the ...READ MORE

answered Jan 8 in Big Data Hadoop by Omkar
• 66,910 points
47 views
0 votes
1 answer

What is the syntax for creating bucketing table in hive?

Hi, Syntax for creating bucketed table is as ...READ MORE

answered May 16 in Big Data Hadoop by Gitika
• 14,910 points
19 views
0 votes
1 answer
+3 votes
1 answer

Getting Connection Error while loading data into table using cloudera hive

Hey Nafeesa, Itseems that Hive is not able ...READ MORE

answered Oct 3, 2018 in Big Data Hadoop by Vardhan
• 11,000 points
49 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
• 9,450 points
1,843 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
• 9,450 points
159 views
0 votes
10 answers

hadoop fs -put command?

copy command can be used to copy files ...READ MORE

answered Dec 7, 2018 in Big Data Hadoop by Sujay
9,138 views
0 votes
1 answer

Hadoop dfs -ls command?

In your case there is no difference ...READ MORE

answered Mar 16, 2018 in Big Data Hadoop by kurt_cobain
• 9,260 points
656 views
0 votes
1 answer

How to change the location of a table in hive?

Hey, Basically When we create a table in hive, ...READ MORE

answered May 14 in Big Data Hadoop by Gitika
• 14,910 points
53 views
0 votes
1 answer

© 2018 Brain4ce Education Solutions Pvt. Ltd. All rights Reserved.
"PMP®","PMI®", "PMI-ACP®" and "PMBOK®" are registered marks of the Project Management Institute, Inc. MongoDB®, Mongo and the leaf logo are the registered trademarks of MongoDB, Inc.