You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user-zh@flink.apache.org by RS <ti...@163.com> on 2022/02/22 01:35:50 UTC

hive 进行 overwrite 合并数据后文件变大?

Hi,
flink写hive任务,checkpoint周期配置的比较短,生成了很多小文件,一天一个目录,
然后我调用flink sql合并之前的数据,跑完之后,发现存储变大了,请教下这个是什么原因导致的?
合并之前是很多小part文件,overwrite之后文件减少了,但是存储变大了,从274MB变大成2.9GB了?


hive表table1的分区字段是`date`
insert overwrite aw_topic_compact select * from `table1` where `date`='2022-02-21';


合并前:
514.0 M  1.5 G    /user/hive/warehouse/ods.db/table1/date=2022-02-20
274.0 M  822.1 M  /user/hive/warehouse/ods.db/table1/date=2022-02-21
48.1 M   144.2 M  /user/hive/warehouse/ods.db/table1/date=2022-02-22



合并后:
514.0 M  1.5 G    /user/hive/warehouse/ods.db/table1/date=2022-02-20
2.9 G    8.7 G    /user/hive/warehouse/ods.db/table1/date=2022-02-21
47.6 M   142.9 M  /user/hive/warehouse/ods.db/table1/date=2022-02-22


Re:hive 进行 overwrite 合并数据后文件变大?

Posted by 周瑞 <ru...@woqutech.com>.
是不是数据重复了,如果是ORC格式可以尝试执行alter table table_name partition (pt_dt='2021-02-20') concatenate 语句进行小文件的合并。
&nbsp;
&nbsp;
------------------&nbsp;Original&nbsp;------------------
From: "RS"; 
Date: 2022年2月22日(星期二) 上午9:36
To: "user-zh"; 
Subject: hive 进行 overwrite 合并数据后文件变大?

&nbsp;
Hi,
flink写hive任务,checkpoint周期配置的比较短,生成了很多小文件,一天一个目录,
然后我调用flink sql合并之前的数据,跑完之后,发现存储变大了,请教下这个是什么原因导致的?
合并之前是很多小part文件,overwrite之后文件减少了,但是存储变大了,从274MB变大成2.9GB了?


hive表table1的分区字段是`date`
insert overwrite aw_topic_compact select * from `table1` where `date`='2022-02-21';


合并前:
514.0 M&nbsp; 1.5 G&nbsp;&nbsp;&nbsp; /user/hive/warehouse/ods.db/table1/date=2022-02-20
274.0 M&nbsp; 822.1 M&nbsp; /user/hive/warehouse/ods.db/table1/date=2022-02-21
48.1 M&nbsp;&nbsp; 144.2 M&nbsp; /user/hive/warehouse/ods.db/table1/date=2022-02-22



合并后:
514.0 M&nbsp; 1.5 G&nbsp;&nbsp;&nbsp; /user/hive/warehouse/ods.db/table1/date=2022-02-20
2.9 G&nbsp;&nbsp;&nbsp; 8.7 G&nbsp;&nbsp;&nbsp; /user/hive/warehouse/ods.db/table1/date=2022-02-21
47.6 M&nbsp;&nbsp; 142.9 M&nbsp; /user/hive/warehouse/ods.db/table1/date=2022-02-22

回复:hive 进行 overwrite 合并数据后文件变大?

Posted by Shuai Xia <jk...@dingtalk.com.INVALID>.
emmm,你看下这个能不能帮到你
https://jxeditor.github.io/2020/06/10/Hive%E5%8E%8B%E7%BC%A9%E6%95%88%E6%9E%9C%E4%B8%8D%E6%98%8E%E6%98%BE%E8%B8%A9%E5%9D%91%E8%AE%B0%E5%BD%95/


------------------------------------------------------------------
发件人:RS <ti...@163.com>
发送时间:2022年2月22日(星期二) 09:36
收件人:user-zh <us...@flink.apache.org>
主 题:hive 进行 overwrite 合并数据后文件变大?

Hi,
flink写hive任务,checkpoint周期配置的比较短,生成了很多小文件,一天一个目录,
然后我调用flink sql合并之前的数据,跑完之后,发现存储变大了,请教下这个是什么原因导致的?
合并之前是很多小part文件,overwrite之后文件减少了,但是存储变大了,从274MB变大成2.9GB了?


hive表table1的分区字段是`date`
insert overwrite aw_topic_compact select * from `table1` where `date`='2022-02-21';


合并前:
514.0 M  1.5 G    /user/hive/warehouse/ods.db/table1/date=2022-02-20
274.0 M  822.1 M  /user/hive/warehouse/ods.db/table1/date=2022-02-21
48.1 M   144.2 M  /user/hive/warehouse/ods.db/table1/date=2022-02-22



合并后:
514.0 M  1.5 G    /user/hive/warehouse/ods.db/table1/date=2022-02-20
2.9 G    8.7 G    /user/hive/warehouse/ods.db/table1/date=2022-02-21
47.6 M   142.9 M  /user/hive/warehouse/ods.db/table1/date=2022-02-22



Re:回复:hive 进行 overwrite 合并数据后文件变大?

Posted by RS <ti...@163.com>.
感谢,确定了下是压缩格式的问题,
原hive文件的压缩是SNAPPY压缩,使用Flink SQL合并小文件之后,默认不压缩,导致文件变大了。
Flink默认没有继承原文件的压缩算法。。。




在 2022-02-22 12:08:39,"‪junjie.miao@goupwith.com‬" <ju...@goupwith.com> 写道:

检查下数据格式和压缩格式是否和之前的不一致


-------- 原始邮件 --------
发件人: RS <ti...@163.com>
日期: 2022年2月22日周二 09:35
收件人: user-zh@flink.apache.org
主 题: hive 进行 overwrite 合并数据后文件变大?
Hi,
flink写hive任务,checkpoint周期配置的比较短,生成了很多小文件,一天一个目录,
然后我调用flink sql合并之前的数据,跑完之后,发现存储变大了,请教下这个是什么原因导致的?
合并之前是很多小part文件,overwrite之后文件减少了,但是存储变大了,从274MB变大成2.9GB了?


hive表table1的分区字段是`date`
insert overwrite aw_topic_compact select * from `table1` where `date`='2022-02-21';


合并前:
514.0 M  1.5 G    /user/hive/warehouse/ods.db/table1/date=2022-02-20
274.0 M  822.1 M  /user/hive/warehouse/ods.db/table1/date=2022-02-21
48.1 M   144.2 M  /user/hive/warehouse/ods.db/table1/date=2022-02-22



合并后:
514.0 M  1.5 G    /user/hive/warehouse/ods.db/table1/date=2022-02-20
2.9 G    8.7 G    /user/hive/warehouse/ods.db/table1/date=2022-02-21
47.6 M   142.9 M  /user/hive/warehouse/ods.db/table1/date=2022-02-22