zoukankan      html  css  js  c++  java
  • 【原创】大叔问题定位分享(16)spark写数据到hive外部表报错ClassCastException: org.apache.hadoop.hive.hbase.HiveHBaseTableOutputFormat cannot be cast to org.apache.hadoop.hive.ql.io.HiveOutputFormat

     spark 2.1.1

    spark在写数据到hive外部表(底层数据在hbase中)时会报错

    Caused by: java.lang.ClassCastException: org.apache.hadoop.hive.hbase.HiveHBaseTableOutputFormat cannot be cast to org.apache.hadoop.hive.ql.io.HiveOutputFormat
    at org.apache.spark.sql.hive.SparkHiveWriterContainer.outputFormat$lzycompute(hiveWriterContainers.scala:82)

    org.apache.spark.sql.hive.SparkHiveWriterContainer

    org.apache.spark.sql.hive.SparkHiveWriterContainer
      @transient private lazy val outputFormat = conf.value.getOutputFormat.asInstanceOf[HiveOutputFormat[AnyRef, Writable]]

    报错的是这一句,查看代码发现此时这个变量并没有什么用处,可以在不能cast时置为null

      @transient private lazy val outputFormat =
        // conf.value.getOutputFormat.asInstanceOf[HiveOutputFormat[AnyRef, Writable]]
        conf.value.getOutputFormat match {
          case format if format.isInstanceOf[HiveOutputFormat[AnyRef, Writable]] => format.asInstanceOf[HiveOutputFormat[AnyRef, Writable]]
          case _ => null
        }

    问题解决,官方讨论如下: https://issues.apache.org/jira/browse/SPARK-6628

     

  • 相关阅读:
    js类型转换 枫
    AspNetPager操作示例1 枫
    discuz资料 枫
    Request.params的知识 枫
    C#实现自动锁屏+关屏 枫
    iis访问aspx文件显示404无法找到文件? 枫
    filter:alpha(opacity=100,style=1) 枫
    IIS安装程序无法复制文件的问题(转载) 枫
    DataTable 枫
    windows系统函数详解(控制面板等常用函数) 枫
  • 原文地址:https://www.cnblogs.com/barneywill/p/10137915.html
Copyright © 2011-2022 走看看