Hive分区表创建,增加及删除

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);

 

posted @ 2018-07-04 14:12  骑着龙的羊  阅读(16929)  评论(0编辑  收藏  举报