1、错误描述
hive执行任务 map reducer 阶段均执行成功。但在文件移动时报错“Error: Error while processing statement: FAILED: Execution Error, return code 1 from org.apache.hadoop.hive.ql.exec.MoveTask.”,同时对应分区文件中有数据出现,也可查询。
2、 详细日志
�[2KMap 1 .......... container SUCCEEDED 17 17 0 0 0 0
Reducer 2 ...... container SUCCEEDED 1009 1009 0 0 0 0
Reducer 3 ...... container SUCCEEDED 1009 1009 0 0 0 0
Reducer 4 ...... container SUCCEEDED 253 253 0 0 0 0
�[2K----------------------------------------------------------------------------------------------
�[2K�[31;1mVERTICES: 04/04 [==========================>>] 100% ELAPSED TIME: 3876.53 s
�[22;0m�[2K----------------------------------------------------------------------------------------------
ERROR : FAILED: Execution Error, return code 1 from org.apache.hadoop.hive.ql.exec.MoveTask. Exception when loading 39 in table ods_srvc_adm_order_d with loadPath=hdfs://XXX.cn:8020/warehouse/tablespace/external/hive/ods_XXX.db/ods_XXX_order_d/.hive-staging_hive_2024-11-04_06-42-32_919_5538586256515894993-19857/-ext-10000
INFO : Completed executing command(queryId=hive_20241104064232_fd4a116d-8883-4c9b-94bd-632ae431b508); Time taken: 5155.834 seconds
[INFO] 2024-11-04 08:08:42.334 +0800 - process has exited. execute path:/tmp/dolphinscheduler/exec/process/root/11595226163648/11605886348353_5/126472/416224, processId:426636 ,exitStatusCode:1 ,processWaitForStatus:true ,processExitValue:1
[INFO] 2024-11-04 08:08:42.335 +0800 - Send task execute result to master, the current task status: TaskExecutionStatus{code=6, desc='failure'}
[INFO] 2024-11-04 08:08:42.335 +0800 - Remove the current task execute context from worker cache
[INFO] 2024-11-04 08:08:42.336 +0800 - The current execute mode isn't develop mode, will clear the task execute file: /tmp/dolphinscheduler/exec/process/root/11595226163648/11605886348353_5/126472/416224
[INFO] 2024-11-04 08:08:42.337 +0800 - Success clear the task execute file: /tmp/dolphinscheduler/exec/process/root/11595226163648/11605886348353_5/126472/416224
[INFO] 2024-11-04 08:08:43.042 +0800 - -> Error: Error while processing statement: FAILED: Execution Error, return code 1 from org.apache.hadoop.hive.ql.exec.MoveTask. Exception when loading 39 in table ods_XXX_d with loadPath=hdfs://XXX.cn:8020/warehouse/tablespace/external/hive/ods_ylfw.db/ods_srvc_adm_order_d/.hive-staging_hive_2024-11-04_06-42-32_919_5538586256515894993-19857/-ext-10000 (state=08S01,code=1)
Closing: 0: jdbc:hive2://XXX.cn:2181,XXX.cn:2181,XXX.cn:2181/default;password=XXX;serviceDiscoveryMode=zooKeeper;user=admin;zooKeeperNamespace=hiveserver2
[INFO] 2024-11-04 08:08:43.043 +0800 - FINALIZE_SESSION
3、异常分析
第一、 map reducer 阶段均执行成功,说明任务sql不存在问题。可以造成问题是在数据存储HDFS。
第二、数据存储HDFS,无非就是权限问题和内存 磁盘问题。一一排查即可。
第三、分别排查了目录权限、内存、磁盘。发现在HDFS目录中出现非标准分区信息。见下图
分区信息
大胆猜想,可能是分区字段中出现了特殊符号引起,HDFS文件及文件夹异常在move出现错误。
HDFS命名规范
命名规则:
命名限制:HDFS文件名和目录名可以包含字母、数字、下划线()和点(.)。文件名不能以点(.)开头或结尾,且不能包含空格。
大小写敏感性:HDFS对大小写不敏感,即大小写不同的文件名会被视为相同的文件。
命名最佳实践:
简洁明了:尽量使用简短且具有描述性的名称,避免使用过长或复杂的名称。
避免特殊字符:尽管HDFS允许使用下划线()和点(.),但建议避免使用其他特殊字符,以减少潜在的兼容性问题。
使用英文:尽管中文等非英文字符在HDFS中可能可以存储,但为了兼容性和可读性,建议使用英文命名。
4、问题处理
sql中对org_code分区字段进行规范处理,过滤非法字符。
5、异常验证
再次执行此任务,错误消失。任务成功。
执行成功截图