Skip to content

Instantly share code, notes, and snippets.

@shrijeet
Created November 4, 2014 23:11
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 shrijeet/0469b4a44282c90d5632 to your computer and use it in GitHub Desktop.
Save shrijeet/0469b4a44282c90d5632 to your computer and use it in GitHub Desktop.
Pi's cleanup method
@Override
public void cleanup(Context context) throws IOException {
//write output to a file
Configuration conf = context.getConfiguration();
Path outDir = new Path(conf.get(FileOutputFormat.OUTDIR));
Path outFile = new Path(outDir, "reduce-out");
FileSystem fileSys = FileSystem.get(conf);
SequenceFile.Writer writer = SequenceFile.createWriter(fileSys, conf,
outFile, LongWritable.class, LongWritable.class,
CompressionType.NONE);
writer.append(new LongWritable(numInside), new LongWritable(numOutside));
writer.close();
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment