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
查

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





