插入Hive Bucketed表时出现负数组大小异常

时间:2016-06-30 06:57:06

标签: hadoop mapreduce hive hadoop2 cloudera-cdh

我试图插入一个hive bucketed sorted table并且遇到了reducer抛出的Negative Array Size异常。请在下面找到堆栈跟踪。

Error: org.apache.hadoop.mapreduce.task.reduce.Shuffle$ShuffleError: error in shuffle in fetcher#3
    at org.apache.hadoop.mapreduce.task.reduce.Shuffle.run(Shuffle.java:134)
    at org.apache.hadoop.mapred.ReduceTask.run(ReduceTask.java:376)
    at org.apache.hadoop.mapred.YarnChild$2.run(YarnChild.java:164)
    at java.security.AccessController.doPrivileged(Native Method)
    at javax.security.auth.Subject.doAs(Subject.java:415)
    at org.apache.hadoop.security.UserGroupInformation.doAs(UserGroupInformation.java:1693)
    at org.apache.hadoop.mapred.YarnChild.main(YarnChild.java:158)
Caused by: java.lang.NegativeArraySizeException
    at org.apache.hadoop.io.BoundedByteArrayOutputStream.<init>(BoundedByteArrayOutputStream.java:56)
    at org.apache.hadoop.io.BoundedByteArrayOutputStream.<init>(BoundedByteArrayOutputStream.java:46)
    at org.apache.hadoop.mapreduce.task.reduce.InMemoryMapOutput.<init>(InMemoryMapOutput.java:63)
    at org.apache.hadoop.mapreduce.task.reduce.MergeManagerImpl.unconditionalReserve(MergeManagerImpl.java:305)
    at org.apache.hadoop.mapreduce.task.reduce.MergeManagerImpl.reserve(MergeManagerImpl.java:295)
    at org.apache.hadoop.mapreduce.task.reduce.Fetcher.copyMapOutput(Fetcher.java:514)
    at org.apache.hadoop.mapreduce.task.reduce.Fetcher.copyFromHost(Fetcher.java:336)
    at org.apache.hadoop.mapreduce.task.reduce.Fetcher.run(Fetcher.java:193)

我的表DDL是(仅显示列的子集以便于阅读。实际DDL有100列)

CREATE TABLE clustered_sorted_orc( conv_type string,
                                   multi_dim_id int,
                                   multi_key_id int,
                                   advertiser_id bigint,
                                   buy_id bigint,
                                   day timestamp
PARTITIONED BY(job_instance_id int) 
CLUSTERED BY(conv_type) SORTED BY (day) INTO 8 BUCKETS
STORED AS ORC;

插入声明

FROM not_clustered_orc
INSERT OVERWRITE TABLE clustered_sorted_orc PARTITION(job_instance_id)
SELECT conv_type ,multi_dim_id ,multi_key_id ,advertiser_id,buy_id ,day, job_instance_id

设置了以下配置单元属性

set hive.enforce.bucketing = true;
set hive.exec.dynamic.partition.mode=nonstrict;

这是MergerManagerImpl的日志片段,如果有帮助,它会指定ioSortFactor,mergeThreshold等。

2016-06-30 05:57:20,518 INFO [main] org.apache.hadoop.mapreduce.task.reduce.MergeManagerImpl: MergerManager: memoryLimit=12828540928, maxSingleShuffleLimit=3207135232, mergeThreshold=8466837504, ioSortFactor=64, memToMemMergeOutputsThreshold=64

我使用的是CDH 5.7.1,Hive1.1.0,Hadoop 2.6.0。以前有人遇到过类似的问题吗?任何帮助都非常感谢。

1 个答案:

答案 0 :(得分:1)

设置

后我就开始工作了
hive.optimize.sort.dynamic.partition=true