Hive 将 ORC 文件分割成小部分

2023-12-30

create table n_data(MARKET string,CATEGORY string,D map<string,string>,monthid int,value  DOUBLE)
  STORED AS ORC
 ;

我将数据加载到其中(超过45000000行),查看hive仓库

结果表由5个文件组成,大小为10MB-20MB,但是dfs.块大小设置为 128MB,存储小文件不是最佳选择,因为它使用整个块!

如何设置 HIVE 将文件分割为 128 MB?

EDIT插入查询:

insert into n_data
select tmp.market,tmp.category,d,adTable.monthid,tmp.factperiod[adTable.monthid] as fact 
from (select market,category,d,factperiod,map_keys(factperiod) as month_arr  from n_src where market is not null) as tmp 
LATERAL VIEW explode(month_arr) adTable AS monthid

您必须为 hive 设置以下配置参数:

hive.merge.mapfiles = true
hive.merge.mapredfiles = true
hive.merge.tezfiles = true
hive.merge.smallfiles.avgsize = 16000000

我遇到了完全相同的问题,直到我发现这个来源 http://qnalist.com/questions/5993258/merge-small-orc-files。您可以尝试使用“set”命令在 hive 会话中手动设置这些参数,如下所示:

set hive.merge.mapfiles=true;
set hive.merge.mapredfiles=true;
set hive.merge.tezfiles=true;
set hive.merge.smallfiles.avgsize=16000000;

如果你只是输入“set;”在配置单元会话控制台中,您可以检查上述参数是否设置正确。测试后,我建议在 hive-site.xml 配置文件中或通过 Ambari 更改它们(如果您使用的是 Hortonworksdistribution)。干杯!

本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)

Hive 将 ORC 文件分割成小部分 的相关文章

随机推荐