return store;
}
private DataOutputStream createOutputStream(String fieldValue) throws IOException {
Configuration conf = ctx.getConfiguration();
TaskID taskId = ctx.getTaskAttemptID().getTaskID();
// Check whether compression is enabled, if so get the extension and add them to the path
boolean isCompressed = getCompressOutput(ctx);
CompressionCodec codec = null;
String extension = "";
if (isCompressed) {
Class<? extends CompressionCodec> codecClass =
getOutputCompressorClass(ctx, GzipCodec.class);
codec = (CompressionCodec) ReflectionUtils.newInstance(codecClass, ctx.getConfiguration());
extension = codec.getDefaultExtension();
}
NumberFormat nf = NumberFormat.getInstance();
nf.setMinimumIntegerDigits(4);
Path path = new Path(fieldValue+extension, fieldValue + '-'
+ nf.format(taskId.getId())+extension);
Path workOutputPath = ((FileOutputCommitter)getOutputCommitter(ctx)).getWorkPath();
Path file = new Path(workOutputPath, path);
FileSystem fs = file.getFileSystem(conf);
FSDataOutputStream fileOut = fs.create(file, false);