【大数据技术】本质原因之Hive分区表插入数据报错Execution Error, return code 1 from org.apache.hadoop.hive.ql.exec.MoveTask

背景:

实操:

先准备一张临时表,其中数据如下(其中sex和class的内容为中文)

create table tmp(
    id int ,
    name string ,
    score int ,
    sex string ,
    class string
)  row format delimited fields terminated by ',' ;

【大数据技术】本质原因之Hive分区表插入数据报错Execution Error, return code 1 from org.apache.hadoop.hive.ql.exec.MoveTask
新建分区表stu_p
create table stu_p(
id int ,
name string ,
score int
)
partitioned by(year string ,month string )
row format delimited fields terminated by ',' ;

动态分区的方法将数据插入到stu_p

insert into table stu_p select * from tmp ;
或者
insert into table stu_p select id ,name ,score ,sex,class from tmp ;

报错如下:

FAILED: Execution Error, return code 1 from
org.apache.hadoop.hive.ql.exec.MoveTask. Exception when loading 6 in
table stu_p with
loadPath=hdfs://localhost:9000/user/hive/warehouse/db1.db/stu_p/.hive-staging_hive_2022-07-28_11-40-02_443_3225396161542468090-1/-ext-10000

【大数据技术】本质原因之Hive分区表插入数据报错Execution Error, return code 1 from org.apache.hadoop.hive.ql.exec.MoveTask
可见MR任务是没有问题的,只是移动数据到hdfs对应目录时出错,经过分析才发现,因为分区字段里sex和class的内容是中文,在生成中文的目录时出错,故将中文字段改成英文后,可使用动态分区的方法成功插入

修改tmp表数据如下:

【大数据技术】本质原因之Hive分区表插入数据报错Execution Error, return code 1 from org.apache.hadoop.hive.ql.exec.MoveTask
重新执行插入sql,可顺利插入

insert into table stu_p select * from tmp ;

【大数据技术】本质原因之Hive分区表插入数据报错Execution Error, return code 1 from org.apache.hadoop.hive.ql.exec.MoveTask

结论(重要):

1、分区表的分区字段内容里最好不用中文;
2、若出现上述报错,可考虑修改元数据保存格式问题,我的元数据保存在mysql里,可尝试修改mysql里Metastroe所在库的字符编码(目前正研究中) ;

Original: https://blog.csdn.net/u011762522/article/details/126032236
Author: daydayup-2016
Title: 【大数据技术】本质原因之Hive分区表插入数据报错Execution Error, return code 1 from org.apache.hadoop.hive.ql.exec.MoveTask

原创文章受到原创版权保护。转载请注明出处:https://www.johngo689.com/817661/

转载文章受原作者版权保护。转载请注明原作者出处!

(0)

大家都在看

亲爱的 Coder【最近整理,可免费获取】👉 最新必读书单  | 👏 面试题下载  | 🌎 免费的AI知识星球