zoukankan      html  css  js  c++  java
  • Hive解决 java.io.IOException:SerDeException:LazySimpleSerDe

    具体的出错信息是:

    Failed with exception java.io.IOException:org.apache.hadoop.hive.serde2.SerDeException: class org.apache.hadoop.hive.serde2.lazy.LazySimpleSerDe: expects either BytesWritable or Text object!

    出错原因:数据文件的field使用了LazySimpleSerDe不能解析的类型。

    报出此异常的代码为:

    public Object deserialize(Writable field) throws SerDeException {
        ......;
        if (field instanceof BytesWritable) {
          ......;
        } else if (field instanceof Text) {
          ......;
        } else {
          throw new SerDeException(getClass().toString()
              + ": expects either BytesWritable or Text object!");
        }
    

    可见LazySimpleSerDe能解析的类型:BytesWritable或Text 及其子类。

    MR job中常用类型LongWritable, IntWritable等不支持。

    在我的程序中,Reduce采用LongSumReducer, 输出SequenceFileOutputFormat,key 为Text,Value是LongWritable

    解决方法:不想只为改输出value的类型而重写Reduce, 于是只把输出文件类型改为TextOutputFormat,压缩算法等不需要改变。

  • 相关阅读:
    List(双向链表)
    Queue(队列)
    Queue(队列)
    Stack(栈)
    Stack(栈)
    Vector(容器)
    gitlab代码库
    Jenkins自动化部署平台
    Maven私服仓库
    VM架构设计文档初稿v0.01
  • 原文地址:https://www.cnblogs.com/aprilrain/p/2956050.html
Copyright © 2011-2022 走看看