1)添加分區
alter table bst_bas_hailing_order add if not exists partition(dt_year='${v_dt_year}');
2)刪除分區
alter table bst_bas_hailing_order drop if exists partition(dt_year='${v_dt_year}');
3) 查看分區
show partitions bst_bas_hailing_order;
4)修復分區
msck repair table bst_bas_hailing_order;
一般用在外部表,新建的表需要添加對應分區的時候,直接使用修復分區。