Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save zoltanctoth/6060858 to your computer and use it in GitHub Desktop.
Save zoltanctoth/6060858 to your computer and use it in GitHub Desktop.
How to overwrite output files in a Java Mapreduce application
package com.prezi.hadoop;
import org.apache.hadoop.fs.FileAlreadyExistsException;
import org.apache.hadoop.fs.FileSystem;
import org.apache.hadoop.mapreduce.JobContext;
import org.apache.hadoop.mapreduce.lib.output.TextOutputFormat;
import java.io.IOException;
/*
Original idea from: http://ssklogs.blogspot.hu/2012/08/hadoop-outputformat-overwrite-output.html
*/
public class OverwriteOutputDirTextOutputFormat extends TextOutputFormat {
@Override
public void checkOutputSpecs(JobContext job)
throws FileAlreadyExistsException,
IOException {
// bypass the output directory check.
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment