Skip to content

Commit

Permalink
Merge pull request #18 from derekgr/choose-output-format
Browse files Browse the repository at this point in the history
Optionally choose a specific OutputFormat class
  • Loading branch information
ifesdjeen committed Jan 7, 2014
2 parents dec7b91 + 9ba462d commit 1ff5e33
Showing 1 changed file with 14 additions and 1 deletion.
Expand Up @@ -158,7 +158,20 @@ public void sinkConfInit(FlowProcess<JobConf> process,
Tap<JobConf, RecordReader, OutputCollector> tap,
JobConf conf) {
super.sinkConfInit(process, tap, conf);
conf.setOutputFormat(ColumnFamilyOutputFormat.class);

if (this.settings.containsKey("sink.outputFormat")) {
String outputFormatName = (String)this.settings.get("sink.outputFormat");
try {
Class outputFormat = (Class<? extends OutputFormat>)Class.forName(outputFormatName);
conf.setOutputFormat(outputFormat);
}
catch (ClassNotFoundException e) {
throw new IllegalArgumentException("Class not found: " + outputFormatName, e);
}
}
else {
conf.setOutputFormat(ColumnFamilyOutputFormat.class);
}
}

/**
Expand Down

0 comments on commit 1ff5e33

Please sign in to comment.