1.创建Hive分区表,按字段分区
CREATE TABLE test1 ( id bigint , create_time timestamp , user_id string) partitioned by (partition_key int) ROW FORMAT DELIMITED FIELDS TERMINATED BY '\001' LINES TERMINATED BY '\n';
2.增加Hive分区表
ALTER TABLE test1 ADD PARTITION(partition_key=20180620) LOCATION '/user/hive/warehouse/demo.db/test1/partition_key=20180620';
3.删除分区Partition
alter table user_behaviour drop partition(partition_key=20180620);