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,压缩算法等不需要改变。

  • 相关阅读:
    pycharm 快捷键
    jquery .on
    javaweb项目的优化
    python笔记
    git上解决代码冲突(merge版)
    OpenERP里面继承的用法
    OpenERP新手易犯错误之res.model
    bootstrap 仿实例
    深入理解Binder(二),Binder是什么?
    深入理解Binder(一),从AIDL谈起
  • 原文地址:https://www.cnblogs.com/aprilrain/p/2956050.html
Copyright © 2011-2022 走看看