对于复杂类型,Reducer 中的 ReadFields() 中的空缓冲区
我试图在映射器和化简器之间传递一个复杂的可写对象,更具体地说是 ObjectWritables 的 ArrayWritable。
public class ObjectArrayWritable extends ArrayWritable {
public ObjectArrayWritable() {
super(ObjectWritable.class);
}
}
我的映射器:Mapper
我的减速器:Reducer
减速器在 readfields( )
可写接口的方法并抛出以下异常:
java.lang.NullPointerException
at org.apache.hadoop.io.ObjectWritable.readObject(ObjectWritable.java:183)
at org.apache.hadoop.io.ObjectWritable.readFields(ObjectWritable.java:66)
at org.apache.hadoop.io.ArrayWritable.readFields(ArrayWritable.java:90)
at org.apache.hadoop.io.serializer.WritableSerialization$WritableDeserializer.deserialize(WritableSerialization.java:67)
at org.apache.hadoop.io.serializer.WritableSerialization$WritableDeserializer.deserialize(WritableSerialization.java:40)
at org.apache.hadoop.mapreduce.ReduceContext.nextKeyValue(ReduceContext.java:116)
at org.apache.hadoop.mapreduce.ReduceContext.nextKey(ReduceContext.java:92)
at org.apache.hadoop.mapreduce.Reducer.run(Reducer.java:175)
at org.apache.hadoop.mapred.ReduceTask.runNewReducer(ReduceTask.java:566)
at org.apache.hadoop.mapred.ReduceTask.run(ReduceTask.java:408)
at org.apache.hadoop.mapred.LocalJobRunner$Job.run(LocalJobRunner.java:216)
当我尝试实现自己的自定义可写并对其进行调试时,我注意到readfields(DataInput data)
中 DataInput 的缓冲区收到 null。
请注意,我的错误类似于: hadoop + Writable接口+ readFields在reducer中抛出异常 但是物体的清洁没有帮助..
有人可以帮忙吗?
I am trying to pass a complex writable between mapper and reducer, more specifically ArrayWritable of ObjectWritables.
public class ObjectArrayWritable extends ArrayWritable {
public ObjectArrayWritable() {
super(ObjectWritable.class);
}
}
My mapper: Mapper<LongWritable, Text, Text, ObjectArrayWritable>
My reducer: Reducer<Text,ObjectArrayWritable,Text,ObjectArrayWritable>
The reducer crashes on the readfields()
method of the writable interface and throws the following exception:
java.lang.NullPointerException
at org.apache.hadoop.io.ObjectWritable.readObject(ObjectWritable.java:183)
at org.apache.hadoop.io.ObjectWritable.readFields(ObjectWritable.java:66)
at org.apache.hadoop.io.ArrayWritable.readFields(ArrayWritable.java:90)
at org.apache.hadoop.io.serializer.WritableSerialization$WritableDeserializer.deserialize(WritableSerialization.java:67)
at org.apache.hadoop.io.serializer.WritableSerialization$WritableDeserializer.deserialize(WritableSerialization.java:40)
at org.apache.hadoop.mapreduce.ReduceContext.nextKeyValue(ReduceContext.java:116)
at org.apache.hadoop.mapreduce.ReduceContext.nextKey(ReduceContext.java:92)
at org.apache.hadoop.mapreduce.Reducer.run(Reducer.java:175)
at org.apache.hadoop.mapred.ReduceTask.runNewReducer(ReduceTask.java:566)
at org.apache.hadoop.mapred.ReduceTask.run(ReduceTask.java:408)
at org.apache.hadoop.mapred.LocalJobRunner$Job.run(LocalJobRunner.java:216)
When i tried to implement my own custom writable and debugged it i noticed that the buffer of the DataInput in the readfields(DataInput data)
is received null..
Note that my error is similar to:
hadoop + Writable interface + readFields throws an exception in reducer but the cleaning of the object didn't help..
Can anyone assist?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我认为您没有处理 ObjectArrayWritable 中没有任何内容的情况。我无法确定,因为没有提供代码。
I don't think you are handling the case where there is nothing in the ObjectArrayWritable. I can't be sure since there is no code provided.