Skip to content

Instantly share code, notes, and snippets.

@JoeyAndres
Created October 22, 2017 05:52
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save JoeyAndres/74d8ae2ab33cf200d22f52abd21877ca to your computer and use it in GitHub Desktop.
Save JoeyAndres/74d8ae2ab33cf200d22f52abd21877ca to your computer and use it in GitHub Desktop.
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