The file that you are trying to load does not match the file format of the destination table

hive内部表导入数据报错:

建表语句:

create table test_udf2_orc(
class_name string,
method_name string,
col1 int,
col2 int
) 
row format delimited 
fields terminated by ','
stored as orc;

数据导入语句:

load data local inpath '/opt/module/hive-3.1.3/export/servers/hivedatas/test_udf2' overwrite into table test_udf2_orc;

从某些文章上获得的信息是:

纯属误人子弟,博主是谁我就不说了。大家注意辨别:实践是检验真理的唯一标准。但是本人实测,这种说法是不对的。

图片或标题上的翻译是:

所以只是表存储格式的问题,而不是不能使用load data导致的。因为在导入数据时,被导入数据格式是TEXTFILE格式,最终导致此问题.

解决方法:

方式一:表的存储格式定义为textfile

1、建表

create table test_udf2_textfile(
class_name string,
method_name string,
col1 int,
col2 int
) 
row format delimited 
fields terminated by ','
stored as textfile;

2、导入数据

load data local inpath '/opt/module/hive-3.1.3/export/servers/hivedatas/test_udf2' overwrite into table test_udf2_textfile;

3、验证数据:

方式二:定义一个textfile的外部表,如果不想用外部表

1、创建外部表

2、insert overwrite table  内部表  select * from 外部表。

有问题,欢迎大家指正,大家一起学习,向上生长,共同进步。

  • 1
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值