0
votes

In some books (such as Hadoop, The Definitive Guide) the Mapper method is defined like this:

public class MapClass extends Mapper extends Mapper<...

but in other books (such as Hadoop in Action) is like this:

public static class MapClass extends MapReduceBase implements Mapper <...

Which one is prefered or what's the difference?.

Maybe the first option is newer?.

Why static?.

Regards

1
static is because it is declared as an inner class of something else. This isn't required, and I don't even think it's good design. - Sean Owen

1 Answers

2
votes

Mappers and Reducers were interfaces in the old API, but are now classes that tasks inherit from. Implementations from both the old and new API show up in transitional Hadoop distributions, but if you don't have legacy code that depends on the old stuff, you should stick to the new API. The two are not in general interoperable.