#MapReduce extends Reducer<Text, Text, Text, Text> not saving data

5 messages · Page 1 of 1 (latest)

plush quiver
#

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), ", ")));
        }
    }```
safe dawnBOT
#

This post has been reserved for your question.

Hey @plush quiver! Please use /close or the Close Post button above when you're finished. Please remember to follow the help guidelines. This post will be automatically closed after 300 minutes of inactivity.

TIP: Narrow down your issue to simple and precise questions to maximize the chance that others will reply in here.

plush quiver
#

526, 62, 274, 276, 289, 253, 174, 128, 79, 300, 166, 57, 69, 31, 84, 126, 74, 154, 29, 67, 37, 61, 122, 39, 51, 16, 37, 7, 48, 71, 23, 38, 38, 98, 30, 34, 22, 37, 9, 34, 30, 33, 29, 27, 11, 30, 4, 62, 5, 55, 35, 8, 13, 6, 10, 17, 15, 27, 22, 7, 4, 33, 2, 50, 16, 17, 27, 10, 17, 14, 13, 37, 19, 9, 9, 13, 5, 10, 11, 5, 9, 7, 5, 11, 24, 13, 5, 3, 16, 7, 7, 4, 2, 5, 6, 4, 4, 6, 15, 8

were data created
but then


0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0

overwritten it

plush quiver