I am trying to perform hive static partition based on dept of employee records, when I execute load command to insert data into my partitioned table ,it is changing all the dept value based on my partition value which I specify in load data command.
My data in hdfs looks like:
1,adi,Admin,50000,A
2,Gokul,Admin,50000,B
3,Janet,Sales,60000,A
4,Hari,Admin,50000,C
5,Sanker,Admin,50000,C
6,Margaret,Tech,12000,A
7,Nirmal,Tech,12000,B
8,jinju,Engineer,45000,B
9,Nancy,Admin,50000,A
10,Andrew,Manager,40000,A
11,Arun,Manager,40000,B
12,Harish,Sales,60000,B
13,Robert,Manager,40000,A
14,Laura,Engineer,45000,A
15,Anju,Ceo,100000,B
16,Aarathi,Manager,40000,B
17,Parvathy,Engineer,45000,B
18,Gopika,Admin,50000,B
19,Steven,Engineer,45000,A
20,Michael,Ceo,100000,A
My partitioned table is shown below:
create table employee(
id string,
name string,
role string,
salary string)
partitioned by (dept string)
row format delimited
fields terminated by ','
lines terminated by '\n'
stored as textfile;
load command
load data inpath '/user/adithyan/employee.txt' overwrite into table employee partition (dept='A');
I have given the input data above and after executed this command record has been inserted from hdfs to hive but it loaded all the records of the dept changed by 'A'
Output :
employee.id employee.name employee.degree employee.salary employee.dept
1 adi Admin 50000 A
2 Gokul Admin 50000 A
3 Janet Sales 60000 A
4 Hari Admin 50000 A
5 Sanker Admin 50000 A
6 Margaret Tech 12000 A
7 Nirmal Tech 12000 A
8 jinju Engineer 45000 A
9 Nancy Admin 50000 A
10 Andrew Manager 40000 A
11 Arun Manager 40000 A
12 Harish Sales 60000 A
13 Robert Manager 40000 A
14 Laura Engineer 45000 A
15 Anju Ceo 100000 A
16 Aarathi Manager 40000 A
17 Parvathy Engineer 45000 A
18 Gopika Admin 50000 A
19 Steven Engineer 45000 A
20 Michael Ceo 100000 A
All the dept has been changed to A which is wrong. Can somebody help me on how to insert partition data into my table?