accumulo-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ktur...@apache.org
Subject [1/2] accumulo git commit: ACCUMULO-3756 Remove extension of impl type by API type
Date Mon, 04 May 2015 20:33:08 GMT
Repository: accumulo
Updated Branches:
  refs/heads/master ca02e85d1 -> 8cbaa0576


ACCUMULO-3756 Remove extension of impl type by API type


Project: http://git-wip-us.apache.org/repos/asf/accumulo/repo
Commit: http://git-wip-us.apache.org/repos/asf/accumulo/commit/83d1b838
Tree: http://git-wip-us.apache.org/repos/asf/accumulo/tree/83d1b838
Diff: http://git-wip-us.apache.org/repos/asf/accumulo/diff/83d1b838

Branch: refs/heads/master
Commit: 83d1b8388ad807d678c9a3a922e5025faa9a5933
Parents: 0bbc675
Author: Keith Turner <keith@deenlo.com>
Authored: Thu Apr 30 19:37:02 2015 -0400
Committer: Keith Turner <kturner@apache.org>
Committed: Mon May 4 15:56:27 2015 -0400

----------------------------------------------------------------------
 .../core/client/mapred/AbstractInputFormat.java |  83 ++--
 .../core/client/mapred/AccumuloInputFormat.java |   4 +-
 .../client/mapreduce/AbstractInputFormat.java   |  78 ++--
 .../client/mapreduce/AccumuloInputFormat.java   |   5 +-
 .../core/client/mapreduce/RangeInputSplit.java  | 411 +++++++++++++++--
 .../mapreduce/impl/AccumuloInputSplit.java      | 436 -------------------
 .../client/mapreduce/impl/BatchInputSplit.java  |  47 +-
 .../core/client/mapreduce/impl/SplitUtils.java  |  43 +-
 8 files changed, 540 insertions(+), 567 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/accumulo/blob/83d1b838/core/src/main/java/org/apache/accumulo/core/client/mapred/AbstractInputFormat.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/apache/accumulo/core/client/mapred/AbstractInputFormat.java b/core/src/main/java/org/apache/accumulo/core/client/mapred/AbstractInputFormat.java
index f2e3a79..cb3ef11 100644
--- a/core/src/main/java/org/apache/accumulo/core/client/mapred/AbstractInputFormat.java
+++ b/core/src/main/java/org/apache/accumulo/core/client/mapred/AbstractInputFormat.java
@@ -53,7 +53,6 @@ import org.apache.accumulo.core.client.impl.Tables;
 import org.apache.accumulo.core.client.impl.TabletLocator;
 import org.apache.accumulo.core.client.mapred.impl.BatchInputSplit;
 import org.apache.accumulo.core.client.mapreduce.InputTableConfig;
-import org.apache.accumulo.core.client.mapreduce.impl.AccumuloInputSplit;
 import org.apache.accumulo.core.client.mapreduce.impl.SplitUtils;
 import org.apache.accumulo.core.client.mapreduce.lib.impl.ConfiguratorBase;
 import org.apache.accumulo.core.client.mapreduce.lib.impl.InputConfigurator;
@@ -396,7 +395,7 @@ public abstract class AbstractInputFormat<K,V> implements InputFormat<K,V> {
     protected long numKeysRead;
     protected Iterator<Map.Entry<Key,Value>> scannerIterator;
     protected RangeInputSplit split;
-    private org.apache.accumulo.core.client.mapreduce.impl.AccumuloInputSplit aiSplit;
+    private org.apache.accumulo.core.client.mapreduce.RangeInputSplit baseSplit;
     protected ScannerBase scannerBase;
 
 
@@ -423,7 +422,7 @@ public abstract class AbstractInputFormat<K,V> implements InputFormat<K,V> {
      *          the table name for which the scanner is configured
      * @since 1.7.0
      */
-    private void setupIterators(JobConf job, ScannerBase scanner, String tableName, AccumuloInputSplit split) {
+    private void setupIterators(JobConf job, ScannerBase scanner, String tableName, org.apache.accumulo.core.client.mapreduce.RangeInputSplit split) {
       List<IteratorSetting> iterators = null;
 
       if (null == split) {
@@ -453,60 +452,75 @@ public abstract class AbstractInputFormat<K,V> implements InputFormat<K,V> {
      */
     @Deprecated
     protected void setupIterators(JobConf job, Scanner scanner, String tableName, RangeInputSplit split) {
-      setupIterators(job, (ScannerBase) scanner, tableName, (AccumuloInputSplit) split);
+      setupIterators(job, (ScannerBase) scanner, tableName, split);
     }
 
     /**
      * Initialize a scanner over the given input split using this task attempt configuration.
      */
     public void initialize(InputSplit inSplit, JobConf job) throws IOException {
-      aiSplit = (AccumuloInputSplit) inSplit;
-      log.debug("Initializing input split: " + aiSplit.toString());
+      baseSplit = (org.apache.accumulo.core.client.mapreduce.RangeInputSplit) inSplit;
+      log.debug("Initializing input split: " + baseSplit.toString());
 
-      Instance instance = aiSplit.getInstance(getClientConfiguration(job));
+      Instance instance = baseSplit.getInstance(getClientConfiguration(job));
       if (null == instance) {
         instance = getInstance(job);
       }
 
-      String principal = aiSplit.getPrincipal();
+      String principal = baseSplit.getPrincipal();
       if (null == principal) {
         principal = getPrincipal(job);
       }
 
-      AuthenticationToken token = aiSplit.getToken();
+      AuthenticationToken token = baseSplit.getToken();
       if (null == token) {
         token = getAuthenticationToken(job);
       }
 
-      Authorizations authorizations = aiSplit.getAuths();
+      Authorizations authorizations = baseSplit.getAuths();
       if (null == authorizations) {
         authorizations = getScanAuthorizations(job);
       }
 
-      String table = aiSplit.getTableName();
+      String table = baseSplit.getTableName();
 
       // in case the table name changed, we can still use the previous name for terms of configuration,
       // but the scanner will use the table id resolved at job setup time
-      InputTableConfig tableConfig = getInputTableConfig(job, aiSplit.getTableName());
+      InputTableConfig tableConfig = getInputTableConfig(job, baseSplit.getTableName());
 
       log.debug("Creating connector with user: " + principal);
       log.debug("Creating scanner for table: " + table);
       log.debug("Authorizations are: " + authorizations);
 
-      if (aiSplit instanceof RangeInputSplit) {
-        RangeInputSplit rangeSplit = (RangeInputSplit) aiSplit;
-        split = rangeSplit;
-        Boolean isOffline = rangeSplit.isOffline();
+      if (baseSplit instanceof BatchInputSplit) {
+        BatchScanner scanner;
+        BatchInputSplit multiRangeSplit = (BatchInputSplit) baseSplit;
+
+        try{
+          // Note: BatchScanner will use at most one thread per tablet, currently BatchInputSplit will not span tablets
+          int scanThreads = 1;
+          scanner = instance.getConnector(principal, token).createBatchScanner(baseSplit.getTableName(), authorizations, scanThreads);
+          setupIterators(job, scanner, baseSplit.getTableName(), baseSplit);
+        } catch (Exception e) {
+          throw new IOException(e);
+        }
+
+        scanner.setRanges(multiRangeSplit.getRanges());
+        scannerBase = scanner;
+
+      } else if (baseSplit instanceof RangeInputSplit) {
+        split = (RangeInputSplit) baseSplit;
+        Boolean isOffline = baseSplit.isOffline();
         if (null == isOffline) {
           isOffline = tableConfig.isOfflineScan();
         }
 
-        Boolean isIsolated = rangeSplit.isIsolatedScan();
+        Boolean isIsolated = baseSplit.isIsolatedScan();
         if (null == isIsolated) {
           isIsolated = tableConfig.shouldUseIsolatedScanners();
         }
 
-        Boolean usesLocalIterators = rangeSplit.usesLocalIterators();
+        Boolean usesLocalIterators = baseSplit.usesLocalIterators();
         if (null == usesLocalIterators) {
           usesLocalIterators = tableConfig.shouldUseLocalIterators();
         }
@@ -515,13 +529,13 @@ public abstract class AbstractInputFormat<K,V> implements InputFormat<K,V> {
 
         try {
           if (isOffline) {
-            scanner = new OfflineScanner(instance, new Credentials(principal, token), aiSplit.getTableId(), authorizations);
+            scanner = new OfflineScanner(instance, new Credentials(principal, token), baseSplit.getTableId(), authorizations);
           } else if (instance instanceof MockInstance) {
-            scanner = instance.getConnector(principal, token).createScanner(aiSplit.getTableName(), authorizations);
+            scanner = instance.getConnector(principal, token).createScanner(baseSplit.getTableName(), authorizations);
           } else {
             ClientConfiguration clientConf = getClientConfiguration(job);
             ClientContext context = new ClientContext(instance, new Credentials(principal, token), clientConf);
-            scanner = new ScannerImpl(context, aiSplit.getTableId(), authorizations);
+            scanner = new ScannerImpl(context, baseSplit.getTableId(), authorizations);
           }
           if (isIsolated) {
             log.info("Creating isolated scanner");
@@ -531,35 +545,18 @@ public abstract class AbstractInputFormat<K,V> implements InputFormat<K,V> {
             log.info("Using local iterators");
             scanner = new ClientSideIteratorScanner(scanner);
           }
-          setupIterators(job, scanner, aiSplit.getTableName(), aiSplit);
+          setupIterators(job, scanner, baseSplit.getTableName(), baseSplit);
         } catch (Exception e) {
           throw new IOException(e);
         }
 
-        scanner.setRange(rangeSplit.getRange());
+        scanner.setRange(baseSplit.getRange());
         scannerBase = scanner;
-
-      } else if (aiSplit instanceof BatchInputSplit) {
-        BatchScanner scanner;
-        BatchInputSplit multiRangeSplit = (BatchInputSplit) aiSplit;
-
-        try{
-          // Note: BatchScanner will use at most one thread per tablet, currently BatchInputSplit will not span tablets
-          int scanThreads = 1;
-          scanner = instance.getConnector(principal, token).createBatchScanner(aiSplit.getTableName(), authorizations, scanThreads);
-          setupIterators(job, scanner, aiSplit.getTableName(), aiSplit);
-        } catch (Exception e) {
-          throw new IOException(e);
-        }
-
-        scanner.setRanges(multiRangeSplit.getRanges());
-        scannerBase = scanner;
-
       } else {
-        throw new IllegalArgumentException("Can not initialize from " + aiSplit.getClass().toString());
+        throw new IllegalArgumentException("Can not initialize from " + baseSplit.getClass().toString());
       }
 
-      Collection<Pair<Text,Text>> columns = aiSplit.getFetchedColumns();
+      Collection<Pair<Text,Text>> columns = baseSplit.getFetchedColumns();
       if (null == columns) {
         columns = tableConfig.getFetchedColumns();
       }
@@ -595,7 +592,7 @@ public abstract class AbstractInputFormat<K,V> implements InputFormat<K,V> {
     public float getProgress() throws IOException {
       if (numKeysRead > 0 && currentKey == null)
         return 1.0f;
-      return aiSplit.getProgress(currentKey);
+      return baseSplit.getProgress(currentKey);
     }
 
     protected Key currentKey = null;

http://git-wip-us.apache.org/repos/asf/accumulo/blob/83d1b838/core/src/main/java/org/apache/accumulo/core/client/mapred/AccumuloInputFormat.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/apache/accumulo/core/client/mapred/AccumuloInputFormat.java b/core/src/main/java/org/apache/accumulo/core/client/mapred/AccumuloInputFormat.java
index 2c23552..856a11a 100644
--- a/core/src/main/java/org/apache/accumulo/core/client/mapred/AccumuloInputFormat.java
+++ b/core/src/main/java/org/apache/accumulo/core/client/mapred/AccumuloInputFormat.java
@@ -54,8 +54,8 @@ public class AccumuloInputFormat extends InputFormatBase<Key,Value> {
     log.setLevel(getLogLevel(job));
 
     // Override the log level from the configuration as if the RangeInputSplit has one it's the more correct one to use.
-    if (split instanceof org.apache.accumulo.core.client.mapreduce.impl.AccumuloInputSplit) {
-      org.apache.accumulo.core.client.mapreduce.impl.AccumuloInputSplit accSplit = (org.apache.accumulo.core.client.mapreduce.impl.AccumuloInputSplit) split;
+    if (split instanceof org.apache.accumulo.core.client.mapreduce.RangeInputSplit) {
+      org.apache.accumulo.core.client.mapreduce.RangeInputSplit accSplit = (org.apache.accumulo.core.client.mapreduce.RangeInputSplit) split;
       Level level = accSplit.getLogLevel();
       if (null != level) {
         log.setLevel(level);

http://git-wip-us.apache.org/repos/asf/accumulo/blob/83d1b838/core/src/main/java/org/apache/accumulo/core/client/mapreduce/AbstractInputFormat.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/apache/accumulo/core/client/mapreduce/AbstractInputFormat.java b/core/src/main/java/org/apache/accumulo/core/client/mapreduce/AbstractInputFormat.java
index d402bb0..b2f1035 100644
--- a/core/src/main/java/org/apache/accumulo/core/client/mapreduce/AbstractInputFormat.java
+++ b/core/src/main/java/org/apache/accumulo/core/client/mapreduce/AbstractInputFormat.java
@@ -51,7 +51,6 @@ import org.apache.accumulo.core.client.impl.OfflineScanner;
 import org.apache.accumulo.core.client.impl.ScannerImpl;
 import org.apache.accumulo.core.client.impl.Tables;
 import org.apache.accumulo.core.client.impl.TabletLocator;
-import org.apache.accumulo.core.client.mapreduce.impl.AccumuloInputSplit;
 import org.apache.accumulo.core.client.mapreduce.impl.BatchInputSplit;
 import org.apache.accumulo.core.client.mapreduce.impl.SplitUtils;
 import org.apache.accumulo.core.client.mapreduce.lib.impl.ConfiguratorBase;
@@ -427,7 +426,6 @@ public abstract class AbstractInputFormat<K,V> extends InputFormat<K,V> {
     protected Iterator<Map.Entry<Key,Value>> scannerIterator;
     protected ScannerBase scannerBase;
     protected RangeInputSplit split;
-    private AccumuloInputSplit aiSplit;
 
     /**
      * Extracts Iterators settings from the context to be used by RecordReader.
@@ -455,7 +453,7 @@ public abstract class AbstractInputFormat<K,V> extends InputFormat<K,V> {
      *          InputSplit containing configurations
      * @since 1.7.0
      */
-    private void setupIterators(TaskAttemptContext context, ScannerBase scanner, String tableName, AccumuloInputSplit split) {
+    private void setupIterators(TaskAttemptContext context, ScannerBase scanner, String tableName, RangeInputSplit split) {
       List<IteratorSetting> iterators = null;
 
       if (null == split) {
@@ -485,74 +483,88 @@ public abstract class AbstractInputFormat<K,V> extends InputFormat<K,V> {
      */
     @Deprecated
     protected void setupIterators(TaskAttemptContext context, Scanner scanner, String tableName, RangeInputSplit split) {
-      setupIterators(context, (ScannerBase) scanner, tableName, (AccumuloInputSplit) split);
+      setupIterators(context, (ScannerBase) scanner, tableName, split);
     }
 
     @Override
     public void initialize(InputSplit inSplit, TaskAttemptContext attempt) throws IOException {
 
-      aiSplit = (AccumuloInputSplit) inSplit;
-      log.debug("Initializing input split: " + aiSplit.toString());
+      split = (RangeInputSplit) inSplit;
+      log.debug("Initializing input split: " + split.toString());
 
-      Instance instance = aiSplit.getInstance(getClientConfiguration(attempt));
+      Instance instance = split.getInstance(getClientConfiguration(attempt));
       if (null == instance) {
         instance = getInstance(attempt);
       }
 
-      String principal = aiSplit.getPrincipal();
+      String principal = split.getPrincipal();
       if (null == principal) {
         principal = getPrincipal(attempt);
       }
 
-      AuthenticationToken token = aiSplit.getToken();
+      AuthenticationToken token = split.getToken();
       if (null == token) {
         token = getAuthenticationToken(attempt);
       }
 
-      Authorizations authorizations = aiSplit.getAuths();
+      Authorizations authorizations = split.getAuths();
       if (null == authorizations) {
         authorizations = getScanAuthorizations(attempt);
       }
 
-      String table = aiSplit.getTableName();
+      String table = split.getTableName();
 
       // in case the table name changed, we can still use the previous name for terms of configuration,
       // but the scanner will use the table id resolved at job setup time
-      InputTableConfig tableConfig = getInputTableConfig(attempt, aiSplit.getTableName());
+      InputTableConfig tableConfig = getInputTableConfig(attempt, split.getTableName());
 
       log.debug("Creating connector with user: " + principal);
       log.debug("Creating scanner for table: " + table);
       log.debug("Authorizations are: " + authorizations);
 
-      if (aiSplit instanceof RangeInputSplit) {
-        RangeInputSplit rangeSplit = (RangeInputSplit) aiSplit;
-        split = rangeSplit;
+      if (split instanceof BatchInputSplit) {
+        BatchInputSplit batchSplit = (BatchInputSplit) split;
+
+        BatchScanner scanner;
+        try{
+          // Note: BatchScanner will use at most one thread per tablet, currently BatchInputSplit will not span tablets
+          int scanThreads = 1;
+          scanner = instance.getConnector(principal, token).createBatchScanner(split.getTableName(), authorizations, scanThreads);
+          setupIterators(attempt, scanner, split.getTableName(), split);
+        } catch (Exception e) {
+          e.printStackTrace();
+          throw new IOException(e);
+        }
+
+        scanner.setRanges(batchSplit.getRanges());
+        scannerBase = scanner;
+      } else {
         Scanner scanner;
 
-        Boolean isOffline = rangeSplit.isOffline();
+        Boolean isOffline = split.isOffline();
         if (null == isOffline) {
           isOffline = tableConfig.isOfflineScan();
         }
 
-        Boolean isIsolated = rangeSplit.isIsolatedScan();
+        Boolean isIsolated = split.isIsolatedScan();
         if (null == isIsolated) {
           isIsolated = tableConfig.shouldUseIsolatedScanners();
         }
 
-        Boolean usesLocalIterators = rangeSplit.usesLocalIterators();
+        Boolean usesLocalIterators = split.usesLocalIterators();
         if (null == usesLocalIterators) {
           usesLocalIterators = tableConfig.shouldUseLocalIterators();
         }
 
         try {
           if (isOffline) {
-            scanner = new OfflineScanner(instance, new Credentials(principal, token), aiSplit.getTableId(), authorizations);
+            scanner = new OfflineScanner(instance, new Credentials(principal, token), split.getTableId(), authorizations);
           } else if (instance instanceof MockInstance) {
-            scanner = instance.getConnector(principal, token).createScanner(aiSplit.getTableName(), authorizations);
+            scanner = instance.getConnector(principal, token).createScanner(split.getTableName(), authorizations);
           } else {
             ClientConfiguration clientConf = getClientConfiguration(attempt);
             ClientContext context = new ClientContext(instance, new Credentials(principal, token), clientConf);
-            scanner = new ScannerImpl(context, aiSplit.getTableId(), authorizations);
+            scanner = new ScannerImpl(context, split.getTableId(), authorizations);
           }
           if (isIsolated) {
             log.info("Creating isolated scanner");
@@ -563,33 +575,17 @@ public abstract class AbstractInputFormat<K,V> extends InputFormat<K,V> {
             scanner = new ClientSideIteratorScanner(scanner);
           }
 
-          setupIterators(attempt, scanner, aiSplit.getTableName(), aiSplit);
+          setupIterators(attempt, scanner, split.getTableName(), split);
         } catch (Exception e) {
           throw new IOException(e);
         }
 
-        scanner.setRange(rangeSplit.getRange());
+        scanner.setRange(split.getRange());
         scannerBase = scanner;
 
-      } else  if (aiSplit instanceof BatchInputSplit) {
-        BatchInputSplit batchSplit = (BatchInputSplit) aiSplit;
-
-        BatchScanner scanner;
-        try{
-          // Note: BatchScanner will use at most one thread per tablet, currently BatchInputSplit will not span tablets
-          int scanThreads = 1;
-          scanner = instance.getConnector(principal, token).createBatchScanner(aiSplit.getTableName(), authorizations, scanThreads);
-          setupIterators(attempt, scanner, aiSplit.getTableName(), aiSplit);
-        } catch (Exception e) {
-          e.printStackTrace();
-          throw new IOException(e);
-        }
-
-        scanner.setRanges(batchSplit.getRanges());
-        scannerBase = scanner;
       }
 
-      Collection<Pair<Text,Text>> columns = aiSplit.getFetchedColumns();
+      Collection<Pair<Text,Text>> columns = split.getFetchedColumns();
       if (null == columns) {
         columns = tableConfig.getFetchedColumns();
       }
@@ -620,7 +616,7 @@ public abstract class AbstractInputFormat<K,V> extends InputFormat<K,V> {
     public float getProgress() throws IOException {
       if (numKeysRead > 0 && currentKey == null)
         return 1.0f;
-      return aiSplit.getProgress(currentKey);
+      return split.getProgress(currentKey);
     }
 
     /**

http://git-wip-us.apache.org/repos/asf/accumulo/blob/83d1b838/core/src/main/java/org/apache/accumulo/core/client/mapreduce/AccumuloInputFormat.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/apache/accumulo/core/client/mapreduce/AccumuloInputFormat.java b/core/src/main/java/org/apache/accumulo/core/client/mapreduce/AccumuloInputFormat.java
index 7af5e66..45315db 100644
--- a/core/src/main/java/org/apache/accumulo/core/client/mapreduce/AccumuloInputFormat.java
+++ b/core/src/main/java/org/apache/accumulo/core/client/mapreduce/AccumuloInputFormat.java
@@ -21,7 +21,6 @@ import java.util.Map.Entry;
 
 import org.apache.accumulo.core.client.ClientConfiguration;
 import org.apache.accumulo.core.client.security.tokens.AuthenticationToken;
-import org.apache.accumulo.core.client.mapreduce.impl.AccumuloInputSplit;
 import org.apache.accumulo.core.data.Key;
 import org.apache.accumulo.core.data.Value;
 import org.apache.accumulo.core.security.Authorizations;
@@ -54,8 +53,8 @@ public class AccumuloInputFormat extends InputFormatBase<Key,Value> {
     log.setLevel(getLogLevel(context));
 
     // Override the log level from the configuration as if the InputSplit has one it's the more correct one to use.
-    if (split instanceof AccumuloInputSplit) {
-      AccumuloInputSplit accSplit = (AccumuloInputSplit) split;
+    if (split instanceof org.apache.accumulo.core.client.mapreduce.RangeInputSplit) {
+      org.apache.accumulo.core.client.mapreduce.RangeInputSplit accSplit = (org.apache.accumulo.core.client.mapreduce.RangeInputSplit) split;
       Level level = accSplit.getLogLevel();
       if (null != level) {
         log.setLevel(level);

http://git-wip-us.apache.org/repos/asf/accumulo/blob/83d1b838/core/src/main/java/org/apache/accumulo/core/client/mapreduce/RangeInputSplit.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/apache/accumulo/core/client/mapreduce/RangeInputSplit.java b/core/src/main/java/org/apache/accumulo/core/client/mapreduce/RangeInputSplit.java
index 9851192..b55e2cf 100644
--- a/core/src/main/java/org/apache/accumulo/core/client/mapreduce/RangeInputSplit.java
+++ b/core/src/main/java/org/apache/accumulo/core/client/mapreduce/RangeInputSplit.java
@@ -19,50 +19,96 @@ package org.apache.accumulo.core.client.mapreduce;
 import java.io.DataInput;
 import java.io.DataOutput;
 import java.io.IOException;
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.Collection;
+import java.util.HashSet;
+import java.util.List;
+import java.util.Set;
 
-import org.apache.accumulo.core.client.mapreduce.impl.AccumuloInputSplit;
+import org.apache.accumulo.core.client.ClientConfiguration;
+import org.apache.accumulo.core.client.Instance;
+import org.apache.accumulo.core.client.IteratorSetting;
+import org.apache.accumulo.core.client.ZooKeeperInstance;
 import org.apache.accumulo.core.client.mapreduce.impl.SplitUtils;
+import org.apache.accumulo.core.client.mapreduce.lib.impl.ConfiguratorBase.TokenSource;
+import org.apache.accumulo.core.client.mapreduce.lib.impl.InputConfigurator;
+import org.apache.accumulo.core.client.mock.MockInstance;
+import org.apache.accumulo.core.client.security.tokens.AuthenticationToken;
+import org.apache.accumulo.core.client.security.tokens.AuthenticationToken.AuthenticationTokenSerializer;
+import org.apache.accumulo.core.data.ByteSequence;
 import org.apache.accumulo.core.data.Key;
 import org.apache.accumulo.core.data.PartialKey;
 import org.apache.accumulo.core.data.Range;
+import org.apache.accumulo.core.security.Authorizations;
+import org.apache.accumulo.core.util.Base64;
+import org.apache.accumulo.core.util.Pair;
+import org.apache.hadoop.io.Text;
+import org.apache.hadoop.io.Writable;
+import org.apache.hadoop.mapreduce.InputSplit;
+import org.apache.log4j.Level;
+
+import static java.nio.charset.StandardCharsets.UTF_8;
 
 /**
  * The Class RangeInputSplit. Encapsulates an Accumulo range for use in Map Reduce jobs.
  */
-public class RangeInputSplit extends AccumuloInputSplit {
+public class RangeInputSplit extends InputSplit implements Writable {
   private Range range;
-  private Boolean offline, isolatedScan, localIterators;
+  private String[] locations;
+  private String tableId, tableName, instanceName, zooKeepers, principal;
+  private TokenSource tokenSource;
+  private String tokenFile;
+  private AuthenticationToken token;
+  private Boolean offline, mockInstance, isolatedScan, localIterators;
+  private Authorizations auths;
+  private Set<Pair<Text,Text>> fetchedColumns;
+  private List<IteratorSetting> iterators;
+  private Level level;
 
   public RangeInputSplit() {
     range = new Range();
+    locations = new String[0];
+    tableName = "";
+    tableId = "";
   }
 
   public RangeInputSplit(RangeInputSplit split) throws IOException {
-    super(split);
-    this.setRange(split.getRange());
+    this.range = split.getRange();
+    this.setLocations(split.getLocations());
+    this.setTableName(split.getTableName());
+    this.setTableId(split.getTableId());
   }
 
   protected RangeInputSplit(String table, String tableId, Range range, String[] locations) {
-    super(table, tableId, locations);
     this.range = range;
+    setLocations(locations);
+    this.tableName = table;
+    this.tableId = tableId;
+  }
+
+  public Range getRange() {
+    return range;
+  }
+
+  public static float getProgress(ByteSequence start, ByteSequence end, ByteSequence position) {
+    return SplitUtils.getProgress(start, end, position);
   }
 
-  @Override
   public float getProgress(Key currentKey) {
     if (currentKey == null)
       return 0f;
-    if (range.contains(currentKey)) {
-      // find the current range and report as if that is the single range
+    if(range.contains(currentKey)){
       if (range.getStartKey() != null && range.getEndKey() != null) {
         if (range.getStartKey().compareTo(range.getEndKey(), PartialKey.ROW) != 0) {
           // just look at the row progress
-          return SplitUtils.getProgress(range.getStartKey().getRowData(), range.getEndKey().getRowData(), currentKey.getRowData());
+          return getProgress(range.getStartKey().getRowData(), range.getEndKey().getRowData(), currentKey.getRowData());
         } else if (range.getStartKey().compareTo(range.getEndKey(), PartialKey.ROW_COLFAM) != 0) {
           // just look at the column family progress
-          return SplitUtils.getProgress(range.getStartKey().getColumnFamilyData(), range.getEndKey().getColumnFamilyData(), currentKey.getColumnFamilyData());
+          return getProgress(range.getStartKey().getColumnFamilyData(), range.getEndKey().getColumnFamilyData(), currentKey.getColumnFamilyData());
         } else if (range.getStartKey().compareTo(range.getEndKey(), PartialKey.ROW_COLFAM_COLQUAL) != 0) {
           // just look at the column qualifier progress
-          return SplitUtils.getProgress(range.getStartKey().getColumnQualifierData(), range.getEndKey().getColumnQualifierData(), currentKey.getColumnQualifierData());
+          return getProgress(range.getStartKey().getColumnQualifierData(), range.getEndKey().getColumnQualifierData(), currentKey.getColumnQualifierData());
         }
       }
     }
@@ -75,15 +121,23 @@ public class RangeInputSplit extends AccumuloInputSplit {
    */
   @Override
   public long getLength() throws IOException {
-    return getRangeLength(range);
+    return SplitUtils.getRangeLength(range);
   }
 
+  @Override
+  public String[] getLocations() throws IOException {
+    return Arrays.copyOf(locations, locations.length);
+  }
 
   @Override
   public void readFields(DataInput in) throws IOException {
-    super.readFields(in);
-
     range.readFields(in);
+    tableName = in.readUTF();
+    tableId = in.readUTF();
+    int numLocs = in.readInt();
+    locations = new String[numLocs];
+    for (int i = 0; i < numLocs; ++i)
+      locations[i] = in.readUTF();
 
     if (in.readBoolean()) {
       isolatedScan = in.readBoolean();
@@ -96,13 +150,81 @@ public class RangeInputSplit extends AccumuloInputSplit {
     if (in.readBoolean()) {
       localIterators = in.readBoolean();
     }
+
+    if (in.readBoolean()) {
+      mockInstance = in.readBoolean();
+    }
+
+    if (in.readBoolean()) {
+      int numColumns = in.readInt();
+      List<String> columns = new ArrayList<String>(numColumns);
+      for (int i = 0; i < numColumns; i++) {
+        columns.add(in.readUTF());
+      }
+
+      fetchedColumns = InputConfigurator.deserializeFetchedColumns(columns);
+    }
+
+    if (in.readBoolean()) {
+      String strAuths = in.readUTF();
+      auths = new Authorizations(strAuths.getBytes(UTF_8));
+    }
+
+    if (in.readBoolean()) {
+      principal = in.readUTF();
+    }
+
+    if (in.readBoolean()) {
+      int ordinal = in.readInt();
+      this.tokenSource = TokenSource.values()[ordinal];
+
+      switch (this.tokenSource) {
+        case INLINE:
+          String tokenClass = in.readUTF();
+          byte[] base64TokenBytes = in.readUTF().getBytes(UTF_8);
+          byte[] tokenBytes = Base64.decodeBase64(base64TokenBytes);
+
+          this.token = AuthenticationTokenSerializer.deserialize(tokenClass, tokenBytes);
+          break;
+
+        case FILE:
+          this.tokenFile = in.readUTF();
+
+          break;
+        default:
+          throw new IOException("Cannot parse unknown TokenSource ordinal");
+      }
+    }
+
+    if (in.readBoolean()) {
+      instanceName = in.readUTF();
+    }
+
+    if (in.readBoolean()) {
+      zooKeepers = in.readUTF();
+    }
+
+    if (in.readBoolean()) {
+      int numIterators = in.readInt();
+      iterators = new ArrayList<IteratorSetting>(numIterators);
+      for (int i = 0; i < numIterators; i++) {
+        iterators.add(new IteratorSetting(in));
+      }
+    }
+
+    if (in.readBoolean()) {
+      level = Level.toLevel(in.readInt());
+    }
   }
 
   @Override
   public void write(DataOutput out) throws IOException {
-    super.write(out);
-
     range.write(out);
+    out.writeUTF(tableName);
+    out.writeUTF(tableId);
+    out.writeInt(locations.length);
+    for (int i = 0; i < locations.length; ++i)
+      out.writeUTF(locations[i]);
 
     out.writeBoolean(null != isolatedScan);
     if (null != isolatedScan) {
@@ -118,34 +240,166 @@ public class RangeInputSplit extends AccumuloInputSplit {
     if (null != localIterators) {
       out.writeBoolean(localIterators);
     }
+
+    out.writeBoolean(null != mockInstance);
+    if (null != mockInstance) {
+      out.writeBoolean(mockInstance);
+    }
+
+    out.writeBoolean(null != fetchedColumns);
+    if (null != fetchedColumns) {
+      String[] cols = InputConfigurator.serializeColumns(fetchedColumns);
+      out.writeInt(cols.length);
+      for (String col : cols) {
+        out.writeUTF(col);
+      }
+    }
+
+    out.writeBoolean(null != auths);
+    if (null != auths) {
+      out.writeUTF(auths.serialize());
+    }
+
+    out.writeBoolean(null != principal);
+    if (null != principal) {
+      out.writeUTF(principal);
+    }
+
+    out.writeBoolean(null != tokenSource);
+    if (null != tokenSource) {
+      out.writeInt(tokenSource.ordinal());
+
+      if (null != token && null != tokenFile) {
+        throw new IOException("Cannot use both inline AuthenticationToken and file-based AuthenticationToken");
+      } else if (null != token) {
+        out.writeUTF(token.getClass().getCanonicalName());
+        out.writeUTF(Base64.encodeBase64String(AuthenticationTokenSerializer.serialize(token)));
+      } else {
+        out.writeUTF(tokenFile);
+      }
+    }
+
+    out.writeBoolean(null != instanceName);
+    if (null != instanceName) {
+      out.writeUTF(instanceName);
+    }
+
+    out.writeBoolean(null != zooKeepers);
+    if (null != zooKeepers) {
+      out.writeUTF(zooKeepers);
+    }
+
+    out.writeBoolean(null != iterators);
+    if (null != iterators) {
+      out.writeInt(iterators.size());
+      for (IteratorSetting iterator : iterators) {
+        iterator.write(out);
+      }
+    }
+
+    out.writeBoolean(null != level);
+    if (null != level) {
+      out.writeInt(level.toInt());
+    }
   }
 
-  @Override
-  public String toString() {
-    StringBuilder sb = new StringBuilder(256);
-    sb.append("RangeInputSplit:");
-    sb.append(" Range: ").append(range);
-    sb.append(super.toString());
-    sb.append(" offlineScan: ").append(offline);
-    sb.append(" isolatedScan: ").append(isolatedScan);
-    sb.append(" localIterators: ").append(localIterators);
-    return sb.toString();
+  /**
+   * Use {@link #getTableName}
+   *
+   * @deprecated since 1.6.1, use getTableName() instead.
+   */
+  @Deprecated
+  public String getTable() {
+    return getTableName();
   }
 
-  public Range getRange() {
-    return range;
+  public String getTableName() {
+    return tableName;
   }
 
-  public void setRange(Range range) {
-    this.range = range;
+  /**
+   * Use {@link #setTableName}
+   *
+   * @deprecated since 1.6.1, use setTableName() instead.
+   */
+  @Deprecated
+  public void setTable(String table) {
+    setTableName(table);
   }
 
-  public Boolean isIsolatedScan() {
-    return isolatedScan;
+  public void setTableName(String table) {
+    this.tableName = table;
   }
 
-  public void setIsolatedScan(Boolean isolatedScan) {
-    this.isolatedScan = isolatedScan;
+  public void setTableId(String tableId) {
+    this.tableId = tableId;
+  }
+
+  public String getTableId() {
+    return tableId;
+  }
+
+  /**
+   * @see #getInstance(ClientConfiguration)
+   * @deprecated since 1.7.0, use getInstance(ClientConfiguration) instead.
+   */
+  @Deprecated
+  public Instance getInstance() {
+    return getInstance(ClientConfiguration.loadDefault());
+  }
+
+  public Instance getInstance(ClientConfiguration base) {
+    if (null == instanceName) {
+      return null;
+    }
+
+    if (isMockInstance()) {
+      return new MockInstance(getInstanceName());
+    }
+
+    if (null == zooKeepers) {
+      return null;
+    }
+
+    return new ZooKeeperInstance(base.withInstance(getInstanceName()).withZkHosts(getZooKeepers()));
+  }
+
+  public String getInstanceName() {
+    return instanceName;
+  }
+
+  public void setInstanceName(String instanceName) {
+    this.instanceName = instanceName;
+  }
+
+  public String getZooKeepers() {
+    return zooKeepers;
+  }
+
+  public void setZooKeepers(String zooKeepers) {
+    this.zooKeepers = zooKeepers;
+  }
+
+  public String getPrincipal() {
+    return principal;
+  }
+
+  public void setPrincipal(String principal) {
+    this.principal = principal;
+  }
+
+  public AuthenticationToken getToken() {
+    return token;
+  }
+
+  public void setToken(AuthenticationToken token) {
+    this.tokenSource = TokenSource.INLINE;
+    this.token = token;
+  }
+
+  public void setToken(String tokenFile) {
+    this.tokenSource = TokenSource.FILE;
+    this.tokenFile = tokenFile;
   }
 
   public Boolean isOffline() {
@@ -156,6 +410,38 @@ public class RangeInputSplit extends AccumuloInputSplit {
     this.offline = offline;
   }
 
+  public void setLocations(String[] locations) {
+    this.locations = Arrays.copyOf(locations, locations.length);
+  }
+
+  public Boolean isMockInstance() {
+    return mockInstance;
+  }
+
+  public void setMockInstance(Boolean mockInstance) {
+    this.mockInstance = mockInstance;
+  }
+
+  public Boolean isIsolatedScan() {
+    return isolatedScan;
+  }
+
+  public void setIsolatedScan(Boolean isolatedScan) {
+    this.isolatedScan = isolatedScan;
+  }
+
+  public Authorizations getAuths() {
+    return auths;
+  }
+
+  public void setAuths(Authorizations auths) {
+    this.auths = auths;
+  }
+
+  public void setRange(Range range) {
+    this.range = range;
+  }
+
   public Boolean usesLocalIterators() {
     return localIterators;
   }
@@ -163,4 +449,59 @@ public class RangeInputSplit extends AccumuloInputSplit {
   public void setUsesLocalIterators(Boolean localIterators) {
     this.localIterators = localIterators;
   }
+
+  public Set<Pair<Text,Text>> getFetchedColumns() {
+    return fetchedColumns;
+  }
+
+  public void setFetchedColumns(Collection<Pair<Text,Text>> fetchedColumns) {
+    this.fetchedColumns = new HashSet<Pair<Text,Text>>();
+    for (Pair<Text,Text> columns : fetchedColumns) {
+      this.fetchedColumns.add(columns);
+    }
+  }
+
+  public void setFetchedColumns(Set<Pair<Text,Text>> fetchedColumns) {
+    this.fetchedColumns = fetchedColumns;
+  }
+
+  public List<IteratorSetting> getIterators() {
+    return iterators;
+  }
+
+  public void setIterators(List<IteratorSetting> iterators) {
+    this.iterators = iterators;
+  }
+
+  public Level getLogLevel() {
+    return level;
+  }
+
+  public void setLogLevel(Level level) {
+    this.level = level;
+  }
+
+  @Override
+  public String toString() {
+    StringBuilder sb = new StringBuilder(256);
+    sb.append("Range: ").append(range);
+    sb.append(" Locations: ").append(Arrays.asList(locations));
+    sb.append(" Table: ").append(tableName);
+    sb.append(" TableID: ").append(tableId);
+    sb.append(" InstanceName: ").append(instanceName);
+    sb.append(" zooKeepers: ").append(zooKeepers);
+    sb.append(" principal: ").append(principal);
+    sb.append(" tokenSource: ").append(tokenSource);
+    sb.append(" authenticationToken: ").append(token);
+    sb.append(" authenticationTokenFile: ").append(tokenFile);
+    sb.append(" Authorizations: ").append(auths);
+    sb.append(" offlineScan: ").append(offline);
+    sb.append(" mockInstance: ").append(mockInstance);
+    sb.append(" isolatedScan: ").append(isolatedScan);
+    sb.append(" localIterators: ").append(localIterators);
+    sb.append(" fetchColumns: ").append(fetchedColumns);
+    sb.append(" iterators: ").append(iterators);
+    sb.append(" logLevel: ").append(level);
+    return sb.toString();
+  }
 }

http://git-wip-us.apache.org/repos/asf/accumulo/blob/83d1b838/core/src/main/java/org/apache/accumulo/core/client/mapreduce/impl/AccumuloInputSplit.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/apache/accumulo/core/client/mapreduce/impl/AccumuloInputSplit.java b/core/src/main/java/org/apache/accumulo/core/client/mapreduce/impl/AccumuloInputSplit.java
deleted file mode 100644
index 7f83936..0000000
--- a/core/src/main/java/org/apache/accumulo/core/client/mapreduce/impl/AccumuloInputSplit.java
+++ /dev/null
@@ -1,436 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.accumulo.core.client.mapreduce.impl;
-
-import static java.nio.charset.StandardCharsets.UTF_8;
-
-import java.io.DataInput;
-import java.io.DataOutput;
-import java.io.IOException;
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.Collection;
-import java.util.HashSet;
-import java.util.List;
-import java.util.Set;
-
-import org.apache.accumulo.core.client.ClientConfiguration;
-import org.apache.accumulo.core.client.Instance;
-import org.apache.accumulo.core.client.IteratorSetting;
-import org.apache.accumulo.core.client.ZooKeeperInstance;
-import org.apache.accumulo.core.client.mapreduce.lib.impl.ConfiguratorBase.TokenSource;
-import org.apache.accumulo.core.client.mapreduce.lib.impl.InputConfigurator;
-import org.apache.accumulo.core.client.mock.MockInstance;
-import org.apache.accumulo.core.client.security.tokens.AuthenticationToken;
-import org.apache.accumulo.core.client.security.tokens.AuthenticationToken.AuthenticationTokenSerializer;
-import org.apache.accumulo.core.data.ByteSequence;
-import org.apache.accumulo.core.data.Key;
-import org.apache.accumulo.core.data.Range;
-import org.apache.accumulo.core.security.Authorizations;
-import org.apache.accumulo.core.util.Base64;
-import org.apache.accumulo.core.util.Pair;
-import org.apache.hadoop.io.Text;
-import org.apache.hadoop.io.Writable;
-import org.apache.hadoop.mapreduce.InputSplit;
-import org.apache.log4j.Level;
-
-/**
- * Abstracts over configurations common to all InputSplits. Specifically it leaves out methods
- * related to number of ranges and locations per InputSplit as those vary by implementation.
- *
- * @see org.apache.accumulo.core.client.mapreduce.RangeInputSplit
- * @see org.apache.accumulo.core.client.mapreduce.impl.BatchInputSplit
- */
-public abstract class AccumuloInputSplit extends InputSplit implements Writable {
-  private String[] locations;
-  private String tableId, tableName, instanceName, zooKeepers, principal;
-  private TokenSource tokenSource;
-  private String tokenFile;
-  private AuthenticationToken token;
-  private Boolean mockInstance;
-  private Authorizations auths;
-  private Set<Pair<Text,Text>> fetchedColumns;
-  private List<IteratorSetting> iterators;
-  private Level level;
-
-  public abstract float getProgress(Key currentKey);
-
-  public AccumuloInputSplit() {
-    locations = new String[0];
-    tableName = "";
-    tableId = "";
-  }
-
-  public AccumuloInputSplit(AccumuloInputSplit split) throws IOException {
-    this.setLocations(split.getLocations());
-    this.setTableName(split.getTableName());
-    this.setTableId(split.getTableId());
-  }
-
-  protected AccumuloInputSplit(String table, String tableId, String[] locations) {
-    setLocations(locations);
-    this.tableName = table;
-    this.tableId = tableId;
-  }
-
-  static byte[] extractBytes(ByteSequence seq, int numBytes) {
-    byte[] bytes = new byte[numBytes + 1];
-    bytes[0] = 0;
-    for (int i = 0; i < numBytes; i++) {
-      if (i >= seq.length())
-        bytes[i + 1] = 0;
-      else
-        bytes[i + 1] = seq.byteAt(i);
-    }
-    return bytes;
-  }
-
-  public long getRangeLength(Range range) throws IOException {
-    Text startRow = range.isInfiniteStartKey() ? new Text(new byte[] {Byte.MIN_VALUE}) : range.getStartKey().getRow();
-    Text stopRow = range.isInfiniteStopKey() ? new Text(new byte[] {Byte.MAX_VALUE}) : range.getEndKey().getRow();
-    int maxCommon = Math.min(7, Math.min(startRow.getLength(), stopRow.getLength()));
-    long diff = 0;
-
-    byte[] start = startRow.getBytes();
-    byte[] stop = stopRow.getBytes();
-    for (int i = 0; i < maxCommon; ++i) {
-      diff |= 0xff & (start[i] ^ stop[i]);
-      diff <<= Byte.SIZE;
-    }
-
-    if (startRow.getLength() != stopRow.getLength())
-      diff |= 0xff;
-
-    return diff + 1;
-  }
-
-  @Override
-  public String[] getLocations() throws IOException {
-    return Arrays.copyOf(locations, locations.length);
-  }
-
-  @Override
-  public void readFields(DataInput in) throws IOException {
-    tableName = in.readUTF();
-    tableId = in.readUTF();
-    int numLocs = in.readInt();
-    locations = new String[numLocs];
-    for (int i = 0; i < numLocs; ++i)
-      locations[i] = in.readUTF();
-
-    if (in.readBoolean()) {
-      mockInstance = in.readBoolean();
-    }
-
-    if (in.readBoolean()) {
-      int numColumns = in.readInt();
-      List<String> columns = new ArrayList<String>(numColumns);
-      for (int i = 0; i < numColumns; i++) {
-        columns.add(in.readUTF());
-      }
-
-      fetchedColumns = InputConfigurator.deserializeFetchedColumns(columns);
-    }
-
-    if (in.readBoolean()) {
-      String strAuths = in.readUTF();
-      auths = new Authorizations(strAuths.getBytes(UTF_8));
-    }
-
-    if (in.readBoolean()) {
-      principal = in.readUTF();
-    }
-
-    if (in.readBoolean()) {
-      int ordinal = in.readInt();
-      this.tokenSource = TokenSource.values()[ordinal];
-
-      switch (this.tokenSource) {
-        case INLINE:
-          String tokenClass = in.readUTF();
-          byte[] base64TokenBytes = in.readUTF().getBytes(UTF_8);
-          byte[] tokenBytes = Base64.decodeBase64(base64TokenBytes);
-
-          this.token = AuthenticationTokenSerializer.deserialize(tokenClass, tokenBytes);
-          break;
-
-        case FILE:
-          this.tokenFile = in.readUTF();
-
-          break;
-        default:
-          throw new IOException("Cannot parse unknown TokenSource ordinal");
-      }
-    }
-
-    if (in.readBoolean()) {
-      instanceName = in.readUTF();
-    }
-
-    if (in.readBoolean()) {
-      zooKeepers = in.readUTF();
-    }
-
-    if (in.readBoolean()) {
-      int numIterators = in.readInt();
-      iterators = new ArrayList<IteratorSetting>(numIterators);
-      for (int i = 0; i < numIterators; i++) {
-        iterators.add(new IteratorSetting(in));
-      }
-    }
-
-    if (in.readBoolean()) {
-      level = Level.toLevel(in.readInt());
-    }
-  }
-
-  @Override
-  public void write(DataOutput out) throws IOException {
-    out.writeUTF(tableName);
-    out.writeUTF(tableId);
-    out.writeInt(locations.length);
-    for (int i = 0; i < locations.length; ++i)
-      out.writeUTF(locations[i]);
-
-    out.writeBoolean(null != mockInstance);
-    if (null != mockInstance) {
-      out.writeBoolean(mockInstance);
-    }
-
-    out.writeBoolean(null != fetchedColumns);
-    if (null != fetchedColumns) {
-      String[] cols = InputConfigurator.serializeColumns(fetchedColumns);
-      out.writeInt(cols.length);
-      for (String col : cols) {
-        out.writeUTF(col);
-      }
-    }
-
-    out.writeBoolean(null != auths);
-    if (null != auths) {
-      out.writeUTF(auths.serialize());
-    }
-
-    out.writeBoolean(null != principal);
-    if (null != principal) {
-      out.writeUTF(principal);
-    }
-
-    out.writeBoolean(null != tokenSource);
-    if (null != tokenSource) {
-      out.writeInt(tokenSource.ordinal());
-
-      if (null != token && null != tokenFile) {
-        throw new IOException("Cannot use both inline AuthenticationToken and file-based AuthenticationToken");
-      } else if (null != token) {
-        out.writeUTF(token.getClass().getCanonicalName());
-        out.writeUTF(Base64.encodeBase64String(AuthenticationTokenSerializer.serialize(token)));
-      } else {
-        out.writeUTF(tokenFile);
-      }
-    }
-
-    out.writeBoolean(null != instanceName);
-    if (null != instanceName) {
-      out.writeUTF(instanceName);
-    }
-
-    out.writeBoolean(null != zooKeepers);
-    if (null != zooKeepers) {
-      out.writeUTF(zooKeepers);
-    }
-
-    out.writeBoolean(null != iterators);
-    if (null != iterators) {
-      out.writeInt(iterators.size());
-      for (IteratorSetting iterator : iterators) {
-        iterator.write(out);
-      }
-    }
-
-    out.writeBoolean(null != level);
-    if (null != level) {
-      out.writeInt(level.toInt());
-    }
-  }
-
-  /**
-   * Use {@link #getTableName}
-   */
-  @Deprecated
-  public String getTable() {
-    return getTableName();
-  }
-
-  public String getTableName() {
-    return tableName;
-  }
-
-  /**
-   * Use {@link #setTableName}
-   */
-  @Deprecated
-  public void setTable(String table) {
-    setTableName(table);
-  }
-
-  public void setTableName(String table) {
-    this.tableName = table;
-  }
-
-  public void setTableId(String tableId) {
-    this.tableId = tableId;
-  }
-
-  public String getTableId() {
-    return tableId;
-  }
-
-  /**
-   * @see #getInstance(ClientConfiguration)
-   */
-  @Deprecated
-  public Instance getInstance() {
-    return getInstance(ClientConfiguration.loadDefault());
-  }
-
-  public Instance getInstance(ClientConfiguration base) {
-    if (null == instanceName) {
-      return null;
-    }
-
-    if (isMockInstance()) {
-      return new MockInstance(getInstanceName());
-    }
-
-    if (null == zooKeepers) {
-      return null;
-    }
-
-    return new ZooKeeperInstance(base.withInstance(getInstanceName()).withZkHosts(getZooKeepers()));
-  }
-
-  public String getInstanceName() {
-    return instanceName;
-  }
-
-  public void setInstanceName(String instanceName) {
-    this.instanceName = instanceName;
-  }
-
-  public String getZooKeepers() {
-    return zooKeepers;
-  }
-
-  public void setZooKeepers(String zooKeepers) {
-    this.zooKeepers = zooKeepers;
-  }
-
-  public String getPrincipal() {
-    return principal;
-  }
-
-  public void setPrincipal(String principal) {
-    this.principal = principal;
-  }
-
-  public AuthenticationToken getToken() {
-    return token;
-  }
-
-  public void setToken(AuthenticationToken token) {
-    this.tokenSource = TokenSource.INLINE;
-    this.token = token;
-  }
-
-  public void setToken(String tokenFile) {
-    this.tokenSource = TokenSource.FILE;
-    this.tokenFile = tokenFile;
-  }
-
-  public void setLocations(String[] locations) {
-    this.locations = Arrays.copyOf(locations, locations.length);
-  }
-
-  public Boolean isMockInstance() {
-    return mockInstance;
-  }
-
-  public void setMockInstance(Boolean mockInstance) {
-    this.mockInstance = mockInstance;
-  }
-
-  public Authorizations getAuths() {
-    return auths;
-  }
-
-  public void setAuths(Authorizations auths) {
-    this.auths = auths;
-  }
-
-
-  public Set<Pair<Text,Text>> getFetchedColumns() {
-    return fetchedColumns;
-  }
-
-  public void setFetchedColumns(Collection<Pair<Text,Text>> fetchedColumns) {
-    this.fetchedColumns = new HashSet<Pair<Text,Text>>();
-    for (Pair<Text,Text> columns : fetchedColumns) {
-      this.fetchedColumns.add(columns);
-    }
-  }
-
-  public void setFetchedColumns(Set<Pair<Text,Text>> fetchedColumns) {
-    this.fetchedColumns = fetchedColumns;
-  }
-
-  public List<IteratorSetting> getIterators() {
-    return iterators;
-  }
-
-  public void setIterators(List<IteratorSetting> iterators) {
-    this.iterators = iterators;
-  }
-
-  public Level getLogLevel() {
-    return level;
-  }
-
-  public void setLogLevel(Level level) {
-    this.level = level;
-  }
-
-  @Override
-  public String toString(){
-    StringBuilder sb = new StringBuilder(256);
-    sb.append(" Locations: ").append(Arrays.asList(locations));
-    sb.append(" Table: ").append(tableName);
-    sb.append(" TableID: ").append(tableId);
-    sb.append(" InstanceName: ").append(instanceName);
-    sb.append(" zooKeepers: ").append(zooKeepers);
-    sb.append(" principal: ").append(principal);
-    sb.append(" tokenSource: ").append(tokenSource);
-    sb.append(" authenticationToken: ").append(token);
-    sb.append(" authenticationTokenFile: ").append(tokenFile);
-    sb.append(" Authorizations: ").append(auths);
-    sb.append(" mockInstance: ").append(mockInstance);
-    sb.append(" fetchColumns: ").append(fetchedColumns);
-    sb.append(" iterators: ").append(iterators);
-    sb.append(" logLevel: ").append(level);
-    return sb.toString();
-  }
-}

http://git-wip-us.apache.org/repos/asf/accumulo/blob/83d1b838/core/src/main/java/org/apache/accumulo/core/client/mapreduce/impl/BatchInputSplit.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/apache/accumulo/core/client/mapreduce/impl/BatchInputSplit.java b/core/src/main/java/org/apache/accumulo/core/client/mapreduce/impl/BatchInputSplit.java
index 24b9ef3..f674485 100644
--- a/core/src/main/java/org/apache/accumulo/core/client/mapreduce/impl/BatchInputSplit.java
+++ b/core/src/main/java/org/apache/accumulo/core/client/mapreduce/impl/BatchInputSplit.java
@@ -24,6 +24,7 @@ import java.util.Arrays;
 import java.util.Collection;
 import java.util.Collections;
 
+import org.apache.accumulo.core.client.mapreduce.RangeInputSplit;
 import org.apache.accumulo.core.data.Key;
 import org.apache.accumulo.core.data.PartialKey;
 import org.apache.accumulo.core.data.Range;
@@ -32,7 +33,7 @@ import org.apache.accumulo.core.data.Range;
  * The Class BatchInputSplit. Encapsulates a set of Accumulo ranges on a single tablet for use in Map Reduce jobs.
  * Can contain several Ranges per split.
  */
-public class BatchInputSplit extends AccumuloInputSplit {
+public class BatchInputSplit extends RangeInputSplit {
   private Collection<Range> ranges;
   private float[] rangeProgress = null;
 
@@ -46,7 +47,7 @@ public class BatchInputSplit extends AccumuloInputSplit {
   }
 
   public BatchInputSplit(String table, String tableId, Collection<Range> ranges, String[] locations) {
-    super(table, tableId, locations);
+    super(table, tableId, new Range(), locations);
     this.ranges = ranges;
   }
 
@@ -96,7 +97,7 @@ public class BatchInputSplit extends AccumuloInputSplit {
   public long getLength() throws IOException {
     long sum = 0;
     for (Range range : ranges)
-      sum += getRangeLength(range);
+      sum += SplitUtils.getRangeLength(range);
     return sum;
   }
 
@@ -138,4 +139,44 @@ public class BatchInputSplit extends AccumuloInputSplit {
   public Collection<Range> getRanges() {
     return ranges;
   }
+
+  @Override
+  public Range getRange(){
+    throw new UnsupportedOperationException();
+  }
+
+  @Override
+  public void setRange(Range range){
+    throw new UnsupportedOperationException();
+  }
+
+  @Override
+  public Boolean isIsolatedScan() {
+    throw new UnsupportedOperationException();
+  }
+
+  @Override
+  public void setIsolatedScan(Boolean isolatedScan) {
+    throw new UnsupportedOperationException();
+  }
+
+  @Override
+  public Boolean isOffline() {
+    throw new UnsupportedOperationException();
+  }
+
+  @Override
+  public void setOffline(Boolean offline) {
+    throw new UnsupportedOperationException();
+  }
+
+  @Override
+  public Boolean usesLocalIterators() {
+    throw new UnsupportedOperationException();
+  }
+
+  @Override
+  public void setUsesLocalIterators(Boolean localIterators) {
+    throw new UnsupportedOperationException();
+  }
 }
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/accumulo/blob/83d1b838/core/src/main/java/org/apache/accumulo/core/client/mapreduce/impl/SplitUtils.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/apache/accumulo/core/client/mapreduce/impl/SplitUtils.java b/core/src/main/java/org/apache/accumulo/core/client/mapreduce/impl/SplitUtils.java
index 0aee665..742660d 100644
--- a/core/src/main/java/org/apache/accumulo/core/client/mapreduce/impl/SplitUtils.java
+++ b/core/src/main/java/org/apache/accumulo/core/client/mapreduce/impl/SplitUtils.java
@@ -17,14 +17,18 @@
 
 package org.apache.accumulo.core.client.mapreduce.impl;
 
+import java.io.IOException;
 import java.math.BigInteger;
 
 import org.apache.accumulo.core.client.Instance;
 import org.apache.accumulo.core.client.mapreduce.InputTableConfig;
+import org.apache.accumulo.core.client.mapreduce.RangeInputSplit;
 import org.apache.accumulo.core.client.mock.MockInstance;
 import org.apache.accumulo.core.client.security.tokens.AuthenticationToken;
 import org.apache.accumulo.core.data.ByteSequence;
+import org.apache.accumulo.core.data.Range;
 import org.apache.accumulo.core.security.Authorizations;
+import org.apache.hadoop.io.Text;
 import org.apache.log4j.Level;
 
 public class SplitUtils {
@@ -33,7 +37,7 @@ public class SplitUtils {
    * Central place to set common split configuration not handled by split constructors.
    * The intention is to make it harder to miss optional setters in future refactor.
    */
-  public static void updateSplit(AccumuloInputSplit split,  Instance instance, InputTableConfig tableConfig,
+  public static void updateSplit(RangeInputSplit split,  Instance instance, InputTableConfig tableConfig,
                                   String principal, AuthenticationToken token, Authorizations auths, Level logLevel) {
     split.setInstanceName(instance.getInstanceName());
     split.setZooKeepers(instance.getZooKeepers());
@@ -50,10 +54,41 @@ public class SplitUtils {
 
   public static float getProgress(ByteSequence start, ByteSequence end, ByteSequence position) {
     int maxDepth = Math.min(Math.max(end.length(), start.length()), position.length());
-    BigInteger startBI = new BigInteger(AccumuloInputSplit.extractBytes(start, maxDepth));
-    BigInteger endBI = new BigInteger(AccumuloInputSplit.extractBytes(end, maxDepth));
-    BigInteger positionBI = new BigInteger(AccumuloInputSplit.extractBytes(position, maxDepth));
+    BigInteger startBI = new BigInteger(SplitUtils.extractBytes(start, maxDepth));
+    BigInteger endBI = new BigInteger(SplitUtils.extractBytes(end, maxDepth));
+    BigInteger positionBI = new BigInteger(SplitUtils.extractBytes(position, maxDepth));
     return (float) (positionBI.subtract(startBI).doubleValue() / endBI.subtract(startBI).doubleValue());
   }
 
+  public static long getRangeLength(Range range) throws IOException {
+    Text startRow = range.isInfiniteStartKey() ? new Text(new byte[] {Byte.MIN_VALUE}) : range.getStartKey().getRow();
+    Text stopRow = range.isInfiniteStopKey() ? new Text(new byte[] {Byte.MAX_VALUE}) : range.getEndKey().getRow();
+    int maxCommon = Math.min(7, Math.min(startRow.getLength(), stopRow.getLength()));
+    long diff = 0;
+
+    byte[] start = startRow.getBytes();
+    byte[] stop = stopRow.getBytes();
+    for (int i = 0; i < maxCommon; ++i) {
+      diff |= 0xff & (start[i] ^ stop[i]);
+      diff <<= Byte.SIZE;
+    }
+
+    if (startRow.getLength() != stopRow.getLength())
+      diff |= 0xff;
+
+    return diff + 1;
+  }
+
+  static byte[] extractBytes(ByteSequence seq, int numBytes) {
+    byte[] bytes = new byte[numBytes + 1];
+    bytes[0] = 0;
+    for (int i = 0; i < numBytes; i++) {
+      if (i >= seq.length())
+        bytes[i + 1] = 0;
+      else
+        bytes[i + 1] = seq.byteAt(i);
+    }
+    return bytes;
+  }
+
 }


Mime
View raw message