Issue when working with ArrayWritables Issue when working with ArrayWritables hadoop hadoop

Issue when working with ArrayWritables


You need to override default behavior of toString() method in your IntArrayWritable implementation.

Please try this:

import org.apache.hadoop.io.ArrayWritable;import org.apache.hadoop.io.IntWritable;public class IntArrayWritable extends ArrayWritable {    public IntArrayWritable() {        super(IntWritable.class);    }    public IntArrayWritable(IntWritable[] values) {        super(IntWritable.class, values);    }    @Override    public String toString() {        StringBuilder sb = new StringBuilder("[");        for (String s : super.toStrings())        {            sb.append(s).append(" ");        }        sb.append("]")        return sb.toString();    }}

If you liked this answer please mark it as accepted. Thank you.