Created
October 22, 2017 05:52
-
-
Save JoeyAndres/74d8ae2ab33cf200d22f52abd21877ca to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package HadoopF1.OverallTeamRaceResult; | |
import java.io.IOException; | |
import org.apache.hadoop.io.IntWritable; | |
import org.apache.hadoop.io.LongWritable; | |
import org.apache.hadoop.io.Text; | |
import org.apache.hadoop.mapreduce.Mapper; | |
import HadoopF1.ResultsRecord; | |
public class OverallTeamRaceResultMapper extends Mapper<LongWritable, Text, Text, IntWritable> { | |
static private int MAXIMUM_DRIVER_COUNT = 50; | |
@Override | |
public void map(LongWritable key, Text value, Context context) throws IOException, InterruptedException { | |
ResultsRecord resultsParser = ResultsRecord.Parse(value); | |
int position = MAXIMUM_DRIVER_COUNT - resultsParser.getPosition(); | |
context.write( | |
new Text(resultsParser.getConstructorId()), | |
new IntWritable(position)); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment