The document shows how to create a table P1 in Hive, add partitions to the table for years 2012 and 2013, load values into the table using partitions, and drop and change partitions.
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
0 ratings0% found this document useful (0 votes)
33 views1 page
Hive Partionong
The document shows how to create a table P1 in Hive, add partitions to the table for years 2012 and 2013, load values into the table using partitions, and drop and change partitions.
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
You are on page 1/ 1
Create a table P1 in the default database.
hive>
Create the P1 CREATE TABLE IF NOT EXISTS P1
Add a partition pt1 to the table P1 by specifying an year.
ALTER TABLE pt1 > ADD PARTITION (year=’2012’) > location '/2012/part2012'; load the values into the table P1 using above partition. ALTER TABLE P1 ADD PARTITION (AGE=’30’) SEX=’MALE’; HEIGHT=’5FEET’; Add another partition pt2 to another year for above table. ALTER TABLE pt2 > ADD PARTITION (year=’2013’) > location '/2012/part2013'; Drop the partition after verifying its existence.
ive> ALTER TABLE employee DROP [IF EXISTS]
> PARTITION (year=’1203’); Change the partition year for pt2. ALTER TABLE pt2 > ADD PARTITION (year=’2015’) > location '/2012/part2013';