After map100% reduce0%, the values should been inside context. But after map100% reduce100%, it reran reduce with arr default state as if it didnt saved the data.
public static class IntSumReducer extends Reducer<Text, Text, Text, Text> {
private int[] arr = new int[100];
@SuppressWarnings("removal")
public void reduce(Text key, Iterable<Text> values, Context context) throws IOException, InterruptedException {
for (Text val : values) {
int location = Arrays.asList(val.toString().split(", ")).indexOf("1");
if (-1 != location) arr[location] = arr[location] + 1;
}
context.write(key, new Text(StringUtils.join(ArrayUtils.toObject(arr), ", ")));
System.println(new Text(StringUtils.join(ArrayUtils.toObject(arr), ", ")));
}
}```