Pages

Wednesday, June 29, 2016

MapReduce Two Values for One key example

MapReduce  Multiple values for a single key

MapReduce  Joint example






In this example , creating MapReduce code for doing activity from hortonworsks

http://hortonworks.com/hadoop-tutorial/how-to-process-data-with-apache-pig/

It need to map , one key to two values .

Year as key and PlayerID & Runs as Value






This also contains csv creator in any size and standalone java code to do the same activity



Details of the files :


BattingExample.java : MapReduce Driver Class

BattingMapper.java : MapReduce Mapper Class

BattingReducer.java : MapReduce Reducer Class


Batting.jar : MapReduce Jar


hadoop jar ./Batting.jar BattingExample <InputCSVfile> <OutputFolder>




StandAlone.java : it used for run same Mapper Reduce logic in stand alone mode


java StandAlone <inputCSV> <outputFIle>


Batting.csv : it contains data of players

CsvCreator.java : Used to create similar csv file with any size in similar format



java CsvCreator <NumberOfPlayers> <outputCSVfile>

2000 players will create 1 MB file


No comments:

Post a Comment