hive动态分区插入数据时,由于乱码导致动态分区为乱码,无法删除,如图
解决方法
1.删除hdfs下分区
desc extended TABLENAME;
找到hdfs下表的位置,删除不需要的分区
hadoop dfs -rm 路径
2.删除mysql下的元数据信息
登陆到存放元数据信息的mysql
SELECT * FROM TBLS WHERE TBL_NAME=TABLENAME;
找到TBL_ID,根据TBL_ID找到分区信息
select * from PARTITIONS t where t.tbl_id='60791';
找到其中一个分区信息
select * from PARTITION_KEY_VALS where part_id=5824061;
select * from PARTITION_PARAMS where part_id=5824061;
删除
delete from PARTITION_KEY_VALS where part_id=5824061;
delete from PARTITION_PARAMS where part_id=5824061;
delete from PARTITIONS where tbl_id='60791' and part_id=5824061;;
3验证 show partitions TABLENAME