Reputation:
My input value to reducer is a double array.
719.000 501.000 -75.000
501.000 508.000 -62.000
-75.000 -62.000 10.000
In my reducer i need to print this matrix.so i did
public void reduce(IntWritable key,
Iterable<DoubleArrayWritable> values, Context context)
throws IOException, InterruptedException {
System.out.println("in reducer");
for (DoubleArrayWritable c :values) { // TODO - test me
System.out.println("C ="+c.toString());
}
}
where DoubleArrayWritable is
public static class DoubleArrayWritable extends TwoDArrayWritable {
public DoubleArrayWritable() {
super(DoubleWritable.class);
}
}
My output is C =edu.Driver$DoubleArrayWritable@32d16fe3
But i need to print entire matrix in human readable format.
Upvotes: 0
Views: 77
Reputation: 117675
You need to override toString()
of DoubleArrayWritable
:
@Override
public String toString()
{
// return the string you want
}
Upvotes: 1