0

Here is part of my MapReduce routine:

private static class Reducer ... {
    Text maxWord;
    private void reduce ... {
         some code to find the maximum word occurence;
    }

    private void combine ... {
         context.write(maxWord, ...);
    }
}

Somehow this works differently if I switch the type of the member variable maxWord from Text to String (also making a change context.write(new Text(maxWord)) in the combiner. What is the reason for this behaviour?

hovnatan
  • 1,331
  • 10
  • 23
  • Could you please explain what you mean with "works differently"? – Balduz Jul 23 '14 at 09:38
  • well, the output is different. I can post the whole code if you need. – hovnatan Jul 23 '14 at 10:17
  • I was just curious about it, I don't know the answer. Here you can find the difference between String and Text, but I don't get why it would change the output of your code, since it should be the same: http://stackoverflow.com/questions/19851665/difference-between-text-and-string-in-hadoop – Balduz Jul 23 '14 at 10:20
  • 1
    turned out that the difference was coming from the fact that String is immutable and Text is mutable – hovnatan Jul 23 '14 at 14:13

0 Answers0