具体的出错信息是:
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,压缩算法等不需要改变。
浙公网安备 33010602011771号