Permalink
Browse files

Merge pull request #18 from derekgr/choose-output-format

Optionally choose a specific OutputFormat class
  • Loading branch information...
2 parents dec7b91 + 9ba462d commit 1ff5e33111a246ff46baee8cd6aa3763dd5a5653 @ifesdjeen committed Jan 7, 2014
Showing with 14 additions and 1 deletion.
  1. +14 −1 src/main/java/com/ifesdjeen/cascading/cassandra/CassandraScheme.java
@@ -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);
+ }
}
/**

0 comments on commit 1ff5e33

Please sign in to comment.