
上QQ阅读APP看书,第一时间看更新
Program code
Now it's time to write a Java program to be executed in Hadoop. This Java program will have three parts: the driver code, the Mapper code, and the Reducer code. The driver code contains the main method and the parameters needed to process a MapReduce job. The Mapper code contains how inpidual Mappers performs its calculation and the Reducer code contains how the results will be combined. We will discuss these topics in detail as we continue.
The MapReduce framework can only work on Java Object types and not on Java Primitive types. This means there must be a class to access primitive types as a collection.