hive删除数据


按分区删除:

ALTER TABLE test1  DROP PARTITION (dt='2016-04-29');

 

删除符合条件的数据:

insert overwrite table t_table1 select * from t_table1 where XXXX;

其中xxx是你需要保留的数据的查询条件。

insert overwrite table tlog_bigtable  PARTITION (dt='2017-12-20',game_id = 'id')
select * from tlog_bigtable t
where t.dt = '2017-12-20'
and t.event_time < '2017-12-20 20:00:00'
and t.game_id = 'id'

 

 

 

清空表:

insert overwrite table t_table1 select * from t_table1 where 1=0;

 

DROP TABLE [IF EXISTS] table_name  ;

TRUNCATE TABLE table_name


免责声明!

本站转载的文章为个人学习借鉴使用,本站对版权不负任何法律责任。如果侵犯了您的隐私权益,请联系本站邮箱yoyou2525@163.com删除。



 
粤ICP备18138465号  © 2018-2025 CODEPRJ.COM