Add missing job information for MR. Fixes #43 (#73)
* CharacterHistogram was missing information in the map reduce job so
set the data in the job using legacy methods. This fixes the filedata
example
diff --git a/src/main/java/org/apache/accumulo/examples/filedata/CharacterHistogram.java b/src/main/java/org/apache/accumulo/examples/filedata/CharacterHistogram.java
index 0a8aea5..5928786 100644
--- a/src/main/java/org/apache/accumulo/examples/filedata/CharacterHistogram.java
+++ b/src/main/java/org/apache/accumulo/examples/filedata/CharacterHistogram.java
@@ -21,7 +21,10 @@
import java.util.Arrays;
import java.util.List;
import java.util.Map.Entry;
+import java.util.Properties;
+import org.apache.accumulo.core.client.Accumulo;
+import org.apache.accumulo.core.client.security.tokens.PasswordToken;
import org.apache.accumulo.core.data.Key;
import org.apache.accumulo.core.data.Mutation;
import org.apache.accumulo.core.data.Value;
@@ -93,9 +96,17 @@
job.setNumReduceTasks(0);
+ Properties props = opts.getClientProperties();
+ ChunkInputFormat.setZooKeeperInstance(job, props.getProperty("instance.name"),
+ props.getProperty("instance.zookeepers"));
+ PasswordToken token = new PasswordToken(props.getProperty("auth.token"));
+ ChunkInputFormat.setConnectorInfo(job, props.getProperty("auth.principal"), token);
+ ChunkInputFormat.setInputTableName(job, opts.tableName);
+ ChunkInputFormat.setScanAuthorizations(job, opts.auths);
+
job.setOutputFormatClass(AccumuloOutputFormat.class);
AccumuloOutputFormat.configure().clientProperties(opts.getClientProperties())
- .defaultTable(opts.tableName).createTables(true);
+ .defaultTable(opts.tableName).createTables(true).store(job);
System.exit(job.waitForCompletion(true) ? 0 : 1);
}