Hive partition tables

–1 vote

Can we create manual partition for external tables ? if so how can we create ?

Jan 3, 2019 in Big Data Hadoop by digger
• 26,740 points
1,269 views

1 answer to this question.

0 votes

Yes, you can create manual partition. Here's how:

Open a new terminal and fire up hive by just typing hive. Create table on weather data.

CREATE EXTERNAL TABLE student ( name STRING, doj STRING)
ROW FORMAT DELIMITED FIELDS TERMINATED BY ‘,’ LOCATION ‘ /hive/data/student’;

ROW FORMAT should have delimiters used to terminate the fields and lines like in the above example the fields are terminated with comma (“,”). The default location of Hive table is overwritten by using LOCATION. So the data now is stored in data/student folder inside hive.

Load the data in table

Load the data from HDFS to Hive using the following command:

LOAD DATA INPATH ‘hdfs:/data/2012.txt’ INTO TABLE student;

Partitioning of table

Hive stores tables in partitions. Partitions are used to divide the table into related parts. Partitions make data querying more efficient. For example in the above weather table the data can be partitioned on the basis of year and month and when query is fired on weather table this partition can be used as one of the column.

CREATE EXTERNAL TABLE IF NOT EXSISTS student ( name STRING, doj STRING)
PARTITIONED BY (year INT, month STRING)
ROW FORMAT DELIMITED FIELDS TERMINATED BY ‘,’ LOCATION ‘ /hive/data/student’;

answered Jan 3, 2019 by Omkar
• 69,220 points

Related Questions In Big Data Hadoop

0 votes
1 answer

What is the difference between Hive internal tables and external tables?

Hive has a relational database on the ...READ MORE

answered Nov 19, 2018 in Big Data Hadoop by Neha
• 6,300 points
2,883 views
0 votes
1 answer

Command to partition table in Hive

Yes, You need to mention the below ...READ MORE

answered Dec 17, 2018 in Big Data Hadoop by Omkar
• 69,220 points
899 views
–1 vote
1 answer

How we can run spark SQL over hive tables in our cluster?

Open spark-shell. scala> import org.apache.spark.sql.hive._ scala> val hc = ...READ MORE

answered Dec 26, 2018 in Big Data Hadoop by Omkar
• 69,220 points
1,531 views
0 votes
1 answer

Error creating External Tables in Hive

The path which you have given for ...READ MORE

answered Feb 9, 2019 in Big Data Hadoop by Omkar
• 69,220 points
3,344 views
+1 vote
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
• 11,380 points
11,029 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
• 11,380 points
2,538 views
+2 votes
11 answers

hadoop fs -put command?

Hi, You can create one directory in HDFS ...READ MORE

answered Mar 16, 2018 in Big Data Hadoop by nitinrawat895
• 11,380 points
108,836 views
–1 vote
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,350 points
4,612 views
0 votes
1 answer

Unable to move Hadoop Hive tables from Source to Destination.

First, check the permissions of HDFS Directory ...READ MORE

answered Dec 1, 2018 in Big Data Hadoop by Omkar
• 69,220 points
6,283 views
0 votes
1 answer

Not able to insert in hive partition table

You have to add the partition before ...READ MORE

answered Dec 14, 2018 in Big Data Hadoop by Omkar
• 69,220 points
3,180 views
webinar REGISTER FOR FREE WEBINAR X
REGISTER NOW
webinar_success Thank you for registering Join Edureka Meetup community for 100+ Free Webinars each month JOIN MEETUP GROUP