hive修改分区信息

版权声明:本文为博主原创文章,未经博主允许不得转载。 https://blog.csdn.net/jin6872115/article/details/84064103

hive由于数据没法删除,但是可以删除分区表,不是分区表的直接覆盖就行

对于分区表,当分区字段是日期是,通过分区删除


alter table dwd_trd_r_base1 drop if exists partition(report_date='2018-03-01');

会报错,partition=null

可以通过如下方式解决


-- Change the column type to string//将类型修改为字符串
alter table dwd_trd_r_base1 partition column (report_date string);
-- Drop the offending partitions //删除分区
alter table dwd_trd_r_base1 drop partition(report_date='2018-03-01');
...
-- Change the column type back to date //将分区改回date类型
alter table dwd_trd_r_base partition column (report_date date)

修改表名


--修改表名
ALTER TABLE dwd_trd_r_base1 RENAME TO dwd_trd_r_base;

猜你喜欢

转载自blog.csdn.net/jin6872115/article/details/84064103