高音量偏斜数据集上的Hive排序操作



我正在hortonworks 2.6.5上的大小约3 tb的大数据集,数据集的布局非常简单。

数据的继承结构如下 -

-Country
   -Warehouse
      -Product
          -Product Type
              -Product Serial Id

我们在上述层次结构中有30个国家/地区拥有200多个仓库的交易数据,单一国家占整个数据集的75%。

问题:

1(我们的交易数据具有交易日期列(trans_dt(,用于每个仓库的上述数据集,我需要使用Hive(1.1.2版本(MapReduce在每个仓库内按升序顺序排序trans_dt。我已经在国家/地区创建了一个分区,然后由trans_dt ASC进行了仓库分配;排序大约需要8个小时才能完成,最后6个小时在99%的阶段使用。在这个阶段,我看到很多混音。

2(我们在此组合上进行大量组-Country,Warehouse,Product,Product Type,Product Serial Id优化此操作的任何建议都将非常有帮助。

3(如何处理美国国家的偏斜数据集?

我们正在使用以下蜂巢属性。

SET hive.exec.compress.intermediate=true;
SET hive.intermediate.compression.codec=org.apache.hadoop.io.compress.SnappyCodec;
SET hive.intermediate.compression.type=BLOCK;
SET hive.exec.compress.output=true;
SET mapreduce.output.fileoutputformat.compress=true;
SET mapreduce.output.fileoutputformat.compress.codec=org.apache.hadoop.io.compress.SnappyCodec;
SET mapreduce.output.fileoutputformat.compress.type=BLOCK;
SET hive.auto.convert.join=true;
SET hive.auto.convert.join.noconditionaltask=true;
SET hive.auto.convert.join.noconditionaltask.size=10000000;
SET hive.groupby.skewindata=true;
SET hive.optimize.skewjoin.compiletime=true;
SET hive.optimize.skewjoin=true;
SET hive.optimize.bucketmapjoin=true;
SET hive.exec.parallel=true;
SET hive.cbo.enable=true;
SET hive.stats.autogather=true;
SET hive.compute.query.using.stats=true;
SET hive.stats.fetch.column.stats=true;
SET hive.stats.fetch.partition.stats=true;
SET hive.vectorized.execution.enabled=true;
SET hive.vectorized.execution.reduce.enabled=true;
SET hive.optimize.index.filter=true;
SET hive.optimize.ppd=true;
SET hive.mapjoin.smalltable.filesize=25000000;
SET hive.exec.dynamic.partition=true;
SET hive.exec.dynamic.partition.mode=nonstrict;
SET hive.exec.max.dynamic.partitions.pernode=1000;
SET mapreduce.reduce.memory.mb=10240;
SET mapreduce.reduce.java.opts=-Xmx9216m;
SET mapreduce.map.memory.mb=10240;
SET mapreduce.map.java.opts=-Xmx9216m;
SET mapreduce.task.io.sort.mb=1536;
SET hive.optimize.groupby=true;
SET hive.groupby.orderby.position.alias=true;
SET hive.multigroupby.singlereducer=true;
SET hive.merge.mapfiles=true;
SET hive.merge.smallfiles.avgsize=128000000;
SET hive.merge.size.per.task=268435456;
SET hive.map.aggr=true;
SET hive.optimize.distinct.rewrite=true;
SET mapreduce.map.speculative=false;
set hive.fetch.task.conversion = more;
set hive.fetch.task.aggr=true;
set hive.fetch.task.conversion.threshold=1024000000;

对我们和非美国使用相同的查询,但独立处理。

Select * from Table where Country = 'US'
UNION
Select * from Table where Country <> 'US'

您可以使用一个脚本处理它们,该脚本一次在查询中启动一个国家/地区,从而减少需要在一个实例的情况

INSERT INTO TABLE <AggregateTable>
SELECT * FROM <SourceTable>
  WHERE Country in ('${hiveconf:ProcessCountry}')

最新更新