Skip to content
Browse files

Optionally choose a specific OutputFormat class.

  • Loading branch information...
1 parent dec7b91 commit 9ba462de76300f1ebc10c4ce928fbbbd80dadfca Derek Greentree committed
Showing with 14 additions and 1 deletion.
  1. +14 −1 src/main/java/com/ifesdjeen/cascading/cassandra/CassandraScheme.java
View
15 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 9ba462d

Please sign in to comment.
Something went wrong with that request. Please try again.