对于复杂类型,Reducer 中的 ReadFields() 中的空缓冲区

发布于 2024-11-05 05:18:54 字数 1845 浏览 2 评论 0原文

我试图在映射器和化简器之间传递一个复杂的可写对象,更具体地说是 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 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

生活了然无味 2024-11-12 05:18:54

我认为您没有处理 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.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文