0

I'm trying to create a mapreduce chain composed of two steps. The first reduce emit key-value pairs as (key, value) where value is a list of custom object and the second mapper should read the output of the first reducer. The list is a custom ArrayWritable. Here is the relevant code:

 class MyArrayWritable extends ArrayWritable {  

    public MyArrayWritable() {
        super(Custom.class);
    }

    public MyArrayWritable(Writable[] values) {
        super(Custom.class, values);
    }

    @Override
    public Custom[] get() {
        return (Custom[]) super.get();
    }

    @Override
    public String toString() {
      return Arrays.toString(get());
    }

    @Override
    public void write(DataOutput arg0) throws IOException {
        super.write(arg0);
    }
}

Second mapper (takes custom arraywritable as value):

 public static class SecondMapper extends Mapper<Text, MyArrayWritable, Text, IntWritable> {

    public void map(Text key, MyArrayWritable value, Context context) throws IOException, InterruptedException {
        //other code
        context.write(key, myNewWritableArray);
    }
}

When the second job starts, I get this error: Error: java.lang.RuntimeException: java.lang.NoSuchMethodException: Detector$MyArrayWritable.< init >()

How can I solve it? I've have already implemented the default constructor inside MyArrayWritable

Fabio Sist
  • 45
  • 6

0 Answers0