From aed79ea9edb739c90805202314fadb3455a644e2 Mon Sep 17 00:00:00 2001 From: Mike Miller Date: Fri, 2 Apr 2021 08:07:21 -0400 Subject: [PATCH] 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 --- .../examples/filedata/CharacterHistogram.java | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) 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 @@ public static void main(String[] args) throws Exception { 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); }