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

  • 相关阅读:
    P4868 天天和不可描述
    天天寄快递
    iOS开发资源网站
    找图标的网址
    json解析网址
    屏幕适配
    加密 解密
    json解析网址
    IOS设计模式之三:MVC模式
    什么是Cocoa?什么是Xcode?什么是Framework?
  • 原文地址:https://www.cnblogs.com/aprilrain/p/2956050.html
Copyright © 2020-2023  润新知