hive运行报错错误:FAILED: Execution Error, return code 2 from org.apache.hadoop.hive.ql.exec.mr.MapRedTask

B1中字段与A1字段完全对应,唯一的区别是B1分区是day,A1分区是day、type运行如下sql:

insert overwrite
  table A1 partition(day = '2021-03-17' , type)
select
  id,
  type,
  value,
from
  B1
where
  day ='2021-03-17'

报错:FAILED: Execution Error, return code 2 from org.apache.hadoop.hive.ql.exec.mr.MapRedTask

java.sql.SQLException: Error while processing statement: FAILED: Execution Error, return code 2 from org.apache.hadoop.hive.ql.exec.mr.MapRedTask
   at org.apache.hive.jdbc.HiveStatement.waitForOperationToComplete(HiveStatement.java:349)
   at org.apache.hive.jdbc.HiveStatement.execute(HiveStatement.java:251)
   at com.netease.bdms.executor.executor.HQLResultManager.fetchResultsByJdbcStoreFile(HQLResultManager.java:292)
   at com.netease.bdms.executor.executor.HQLResultManager.saveFirstResultSet(HQLResultManager.java:447)
   at com.netease.bdms.executor.executor.HQLJdbcJobRunnable.executeHql(HQLJdbcJobRunnable.java:397)
   at com.netease.bdms.executor.executor.HQLJdbcJobRunnable.runInternal(HQLJdbcJobRunnable.java:302)
   at com.netease.bdms.executor.executor.HQLJdbcJobRunnable.run(HQLJdbcJobRunnable.java:164)
   at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
   at java.util.concurrent.FutureTask.run(FutureTask.java:266)
   at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
   at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
   at java.lang.Thread.run(Thread.java:745)

刚开始以为是sql写的有问题,乍一看!没问题。仔细一看,还是没问题。
然后我搜了一大圈,也没有说明白是怎么回事,然后我到hadoop平台上追踪了下执行的任务发现一大串错误中间夹了

org.apache.hadoop.hive.ql.metadata.HiveFatalException: [Error 20004]: Fatal error occurred when node tried to create too many dynamic partitions. The maximum number of dynamic partitions is controlled by hive.exec.max.dynamic.partitions and hive.exec.max.dynamic.partitions.pernode. Maximum was set to 100 partitions per node, number of dynamic partitions on this node: 101

这我才明白type的分区的数量太多导致的问题

hive.exec.dynamic.partition=true; 是否允许动态分区

hive.exec.max.dynamic.partitions=1000; 允许最大的动态分区

hive.exec.max.dynamic.partitions.pernode=100; 单个节点允许最大分区

Logo

为开发者提供学习成长、分享交流、生态实践、资源工具等服务,帮助开发者快速成长。

更多推荐