--Create partition table DDL
CREATE TABLE employee_partitioned
(
  name string,
  work_place ARRAY<string>,
  sex_age STRUCT<sex:string,age:int>,
  skills_score MAP<string,int>,
  depart_title MAP<STRING,ARRAY<STRING>>
)
PARTITIONED BY (Year INT, Month INT)
ROW FORMAT DELIMITED FIELDS TERMINATED BY '|'
COLLECTION ITEMS TERMINATED BY ','
MAP KEYS TERMINATED BY ':'

LOAD DATA LOCAL INPATH '/user/hive/employee.txt'
OVERWRITE INTO TABLE employee_partitioned
PARTITION (year=2014, month=12)

--Show partitions
SHOW PARTITIONS employee_partitioned
GO

SELECT `name`, `work_place`, `sex_age`, `skills_score`, `depart_title`, `year`, `month` FROM `employee_partitioned`
GO
