欢迎您访问程序员文章站本站旨在为大家提供分享程序员计算机编程知识!
您现在的位置是: 首页  >  科技

HIVE载入本地数据文件报错问题解决办法

程序员文章站 2023-03-22 10:17:17
Failed with exception Wrong file format. Please check the file’s format. FAILED: Execution...

Failed with exception Wrong file format. Please check the file’s format. FAILED: Execution Error, return code 1 from org.apache.hadoop.hive.ql.exec.MoveTask

问题出现背景:

从本地数据文件载入数据表

数据文件:
qqq,aaa
ccc,rrrr

建表语句:
CREATE EXTERNAL TABLE `dwh_tag_convert_dict`(
  `obj` string, 
  `tag` string)
PARTITIONED BY(p_type string)
row format delimited fields terminated by ','
STORED AS rcfile LOCATION 'hdfs://dg-namenode1:9000/user/hive/warehouse/dg/tables/dwh_tag_convert_dict';

原因:

装载以逗号为分割的本地数据文件时,指定的存储文件格式应为 textFile, 而不是rcfile

解决办法:

修改为:

STORED AS textfile LOCATION 'hdfs://dg-namenode1:9000/user/hive/warehouse/dg/tables/dwh_tag_convert_dict';