hive读取orc表,列为null,解决方案

在Hive 2.x版本后,使用Orc格式表时,若写入的Orc schema字段存在大写,读取时该字段可能被误读为null,即使数据存在。解决方法是在写入Orc文件前,将DataFrame的schema列名转换为小写,以确保字段匹配。此问题源自Hive读取Orc文件时对字段名的大小写敏感。

in case of orc data reader schema passed by hive are all small cases and if
the column name stored in the file has any uppercase, it will return null
values for those columns even if the data is present in the file.
Column name matching while schema evolution should be case unaware.
we need to pass config for same from hive. the
config(orc.schema.evolution.case.sensitive) in orc will be exposed by
https://issues.apache.org/jira/browse/ORC-264

上述问题摘录自https://www.mail-archive.com/issues@hive.apache.org/msg99436.html

简单描述下上面英文描述的问题就是 在hive2.x版本以后orc格式的表,写入时候如果orc的schema 有的字段是大写,那么hive在读取schema时候,这个字段就会被读成null,所以建议设置参数
如图所示:
在这里插入图片描述
查看orc的schema

hive --orcfiledump oss://day=20191220/hour=03/part-00000-aaef271c-dabf-49fb-9899-2960bad0a341-c000.snappy.orc

评论 2
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符
 
红包 添加红包
表情包 插入表情
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值