分享

hive删除数据

 jasonbetter 2018-04-19

按分区删除:

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

    本站是提供个人知识管理的网络存储空间,所有内容均由用户发布,不代表本站观点。请注意甄别内容中的联系方式、诱导购买等信息,谨防诈骗。如发现有害或侵权内容,请点击一键举报。
    转藏 分享 献花(0

    0条评论

    发表

    请遵守用户 评论公约

    类似文章 更多