Step 1: Create Hive table.
=> create table city(no int,name string) partitioned by (city string) row format delimited fields terminated by ',';
Step 2: Load data into the table.
=>set hive.exec.dynamic.partition.mode=nonstrict;
(as hive is by default set to strict mode)
=>load data local inpath '/home/arani/Desktop/cities.csv' overwrite into table city partition(city="chennai");
=>load data local inpath '/home/arani/Desktop/cities2.csv' overwrite into table city partition(city="mumbai");
Here we are creating two partition(chennai,mumbai).
Step 3: Use a where clause to get the appropriate result.
=>select * from city where city="chennai";