accumulo-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From els...@apache.org
Subject [1/6] git commit: ACCUMULO-2663 - Remove usage of String#split from Combiner#init
Date Fri, 13 Jun 2014 01:31:52 GMT
Repository: accumulo
Updated Branches:
  refs/heads/1.5.2-SNAPSHOT d1655a413 -> a3a86412b
  refs/heads/1.6.1-SNAPSHOT 2968fdf02 -> b65035a31
  refs/heads/master 6c7650327 -> 7d639d8b8


ACCUMULO-2663 - Remove usage of String#split from Combiner#init

Noticed that inside Combiner#init, the comma-separated list of columns is split out using
the inefficient String#split method. This should be switched into something that doesn't used
Regexs since this method is invoked a surprising amount in normal usage.

Signed-off-by: Josh Elser <elserj@apache.org>


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

Branch: refs/heads/1.5.2-SNAPSHOT
Commit: a3a86412bcb00bb9ba68192c9425a026072e3562
Parents: d1655a4
Author: David Protzman <dmp250net@gmail.com>
Authored: Thu Jun 12 20:20:02 2014 -0400
Committer: Josh Elser <elserj@apache.org>
Committed: Thu Jun 12 20:48:20 2014 -0400

----------------------------------------------------------------------
 .../main/java/org/apache/accumulo/core/iterators/Combiner.java | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/accumulo/blob/a3a86412/core/src/main/java/org/apache/accumulo/core/iterators/Combiner.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/apache/accumulo/core/iterators/Combiner.java b/core/src/main/java/org/apache/accumulo/core/iterators/Combiner.java
index e8921e5..dd215cc 100644
--- a/core/src/main/java/org/apache/accumulo/core/iterators/Combiner.java
+++ b/core/src/main/java/org/apache/accumulo/core/iterators/Combiner.java
@@ -16,6 +16,7 @@
  */
 package org.apache.accumulo.core.iterators;
 
+import com.google.common.base.Splitter;
 import java.io.IOException;
 import java.util.Arrays;
 import java.util.Collection;
@@ -23,6 +24,7 @@ import java.util.Iterator;
 import java.util.List;
 import java.util.Map;
 import java.util.NoSuchElementException;
+import java.util.StringTokenizer;
 
 import org.apache.accumulo.core.client.IteratorSetting;
 import org.apache.accumulo.core.client.IteratorSetting.Column;
@@ -233,7 +235,7 @@ public abstract class Combiner extends WrappingIterator implements OptionDescrib
     if (encodedColumns.length() == 0)
       throw new IllegalArgumentException("The " + COLUMNS_OPTION + " must not be empty");
 
-    combiners = new ColumnSet(Arrays.asList(encodedColumns.split(",")));
+    combiners = new ColumnSet(Splitter.on(",").splitToList(encodedColumns));
   }
 
   @Override
@@ -277,7 +279,7 @@ public abstract class Combiner extends WrappingIterator implements OptionDescrib
     if (encodedColumns.length() == 0)
       throw new IllegalArgumentException("empty columns specified in option " + COLUMNS_OPTION);
 
-    for (String columns : encodedColumns.split(",")) {
+    for (String columns : Splitter.on(",").splitToList(encodedColumns)) {
       if (!ColumnSet.isValidEncoding(columns))
         throw new IllegalArgumentException("invalid column encoding " + encodedColumns);
     }


Mime
View raw message