0% found this document useful (0 votes)
48 views1 page

Hive-Static Partition

The document shows sample data files with employee data including ID, name, department and year of joining. It also shows the Hive SQL commands to create an external table with static partitioning on the year column and load data from the files into partitions for 2009 and 2010.

Uploaded by

SHWETA DABHADE
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
48 views1 page

Hive-Static Partition

The document shows sample data files with employee data including ID, name, department and year of joining. It also shows the Hive SQL commands to create an external table with static partitioning on the year column and load data from the files into partitions for 2009 and 2010.

Uploaded by

SHWETA DABHADE
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 1

tab1/clientdata/file1

id, name, dept, yoj


1, sunny, SC, 2009
2, animesh, HR, 2009
3, sumeer, SC, 2010
4, sarthak, TP, 2010

tab1/clientdata/2009/file2
1, sunny, SC, 2009
2, animesh, HR, 2009

tab1/clientdata/2010/file3
3, sumeer, SC, 2010
4, sarthak, TP, 2010

Hive Static Partitioning

CREATE TABLE table_tab1 (id INT, name STRING, dept STRING, yoj INT)
PARTITIONED BY (year STRING);

LOAD DATA LOCAL INPATH tab1’/clientdata/2009/file2’OVERWRITE INTO TABLE


studentTab PARTITION (year='2009');

LOAD DATA LOCAL INPATH tab1’/clientdata/2010/file3’OVERWRITE INTO TABLE


studentTab PARTITION (year='2010');

1,Anne,Admin,50000,A,us,newyork
2,Gokul,Admin,50000,B,ind,ap
3,Janet,Sales,60000,A,us,texas
4,Hari,Admin,50000,C,ind,ts
5,Sanker,Admin,50000,C,ind,tn
6,Margaret,Tech,12000,A,eng,london
7,Nirmal,Tech,12000,B,ind,ap
8,jinju,Engineer,45000,B,ind,ts
9,Nancy,Admin,50000,A,eng,london
10,Andrew,Manager,40000,A,eng,london
11,Arun,Manager,40000,B,ind,ap
12,Harish,Sales,60000,B,ind,ap
13,Robert,Manager,40000,A,us,texas
14,Laura,Engineer,45000,A,us,texas
15,Anju,Ceo,100000,B,ind,ts
16,Aarathi,Manager,40000,B,ind,ap
17,Parvathy,Engineer,45000,B,ind,ts
18,Gopika,Admin,50000,B,ind,ap
19,Steven,Engineer,45000,A,ind,ap
20,Michael,Ceo,100000,A,us,newyork

You might also like