Spark集群升级之后,以orc格式写hdfs文件,再导入Hive表字段为null的问题

spark集群升级之后,以orc格式写hdfs文件之后,导入hive表有部分字段为null的bug。hadoop 2.7.2 -->3.1.1;hive 1.2.1 -->3.1.0;spark 2.1.0 -->2.3.2

create external table if not exists birds. table_name
(
      id string  comment ''
      isGreat string comment ''
      updateTime string comment ''
)
comment ''
partitioned by (pt_d string comment'天分区')
row format delimited
fields terminated by '\001'
lines terminated by '\n'
stored as orc
location 'hdfs://hacluster/*/table_name'
tblproperties('orc.compress'='zlib');
val hiveoutDf=ss. createDataFrame(rdd[row],struct). reparation(1)
hiveoutDf. write. mode(''append''). format.("orc"). save(datapathpartition)
val sqlcode = "alter table table_name add if not exists partition (pt_d='"+date+"')"
ss. sql("use biads")
ss. sql(sqlcode)

val struct = StructType(Array(StructFiled("id",StringType) ,
       StructFiled("isGreat",StringType)
       StructFiled("updateTime",StringType)
))

发现集群升级之后,orc格式的文件导入hive表的时候大小写敏感,把struct里的字段都用小写即可

关注微信公众号【飞哥大数据】,回复666 获取2022年100+公司面试真题,以及spark与flink面试题汇总

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

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

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值