phoenix-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From tdsi...@apache.org
Subject phoenix git commit: PHOENIX-3556 Remove usage of com.google.common.collect.Iterators.emptyIterator()
Date Wed, 11 Oct 2017 05:08:19 GMT
Repository: phoenix
Updated Branches:
  refs/heads/4.12-HBase-1.1 e40bbfff1 -> dbba101b1


PHOENIX-3556 Remove usage of com.google.common.collect.Iterators.emptyIterator()


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

Branch: refs/heads/4.12-HBase-1.1
Commit: dbba101b1c0d07ba314613de37a7950a2307e1c8
Parents: e40bbff
Author: Thomas <tdsilva@salesforce.com>
Authored: Thu Jul 27 19:18:25 2017 -0700
Committer: Thomas D'Silva <tdsilva@apache.org>
Committed: Tue Oct 10 21:08:34 2017 -0700

----------------------------------------------------------------------
 .../phoenix/compile/AggregationManager.java       | 18 +++++++++---------
 .../phoenix/compile/OrderPreservingTracker.java   |  2 +-
 .../org/apache/phoenix/compile/ScanRanges.java    |  3 +--
 .../org/apache/phoenix/compile/WhereCompiler.java |  3 +--
 .../apache/phoenix/compile/WhereOptimizer.java    |  8 ++++----
 .../org/apache/phoenix/execute/MutationState.java |  4 ++--
 .../visitor/TraverseNoExpressionVisitor.java      |  5 ++---
 .../DistinctAggregatingResultIterator.java        |  6 +++---
 .../org/apache/phoenix/iterate/ExplainTable.java  |  6 ++----
 .../org/apache/phoenix/schema/MetaDataClient.java |  2 +-
 .../java/org/apache/phoenix/util/ScanUtil.java    |  3 ++-
 11 files changed, 28 insertions(+), 32 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/phoenix/blob/dbba101b/phoenix-core/src/main/java/org/apache/phoenix/compile/AggregationManager.java
----------------------------------------------------------------------
diff --git a/phoenix-core/src/main/java/org/apache/phoenix/compile/AggregationManager.java
b/phoenix-core/src/main/java/org/apache/phoenix/compile/AggregationManager.java
index c8e672e..dc00ef9 100644
--- a/phoenix-core/src/main/java/org/apache/phoenix/compile/AggregationManager.java
+++ b/phoenix-core/src/main/java/org/apache/phoenix/compile/AggregationManager.java
@@ -17,8 +17,13 @@
  */
 package org.apache.phoenix.compile;
 
-import com.google.common.collect.Iterators;
-import com.google.common.collect.Sets;
+import java.sql.SQLException;
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Set;
+
 import org.apache.phoenix.coprocessor.BaseScannerRegionObserver;
 import org.apache.phoenix.expression.Expression;
 import org.apache.phoenix.expression.aggregator.ClientAggregators;
@@ -26,12 +31,7 @@ import org.apache.phoenix.expression.aggregator.ServerAggregators;
 import org.apache.phoenix.expression.function.SingleAggregateFunction;
 import org.apache.phoenix.expression.visitor.SingleAggregateFunctionVisitor;
 
-import java.sql.SQLException;
-import java.util.ArrayList;
-import java.util.Collections;
-import java.util.Iterator;
-import java.util.List;
-import java.util.Set;
+import com.google.common.collect.Sets;
 
 /**
  * 
@@ -84,7 +84,7 @@ public class AggregationManager {
                 @Override
                 public Iterator<Expression> visitEnter(SingleAggregateFunction function)
{
                     aggFuncSet.add(function);
-                    return Iterators.emptyIterator();
+                    return Collections.emptyIterator();
                 }
             });
         }

http://git-wip-us.apache.org/repos/asf/phoenix/blob/dbba101b/phoenix-core/src/main/java/org/apache/phoenix/compile/OrderPreservingTracker.java
----------------------------------------------------------------------
diff --git a/phoenix-core/src/main/java/org/apache/phoenix/compile/OrderPreservingTracker.java
b/phoenix-core/src/main/java/org/apache/phoenix/compile/OrderPreservingTracker.java
index 0c073ce..dab2078 100644
--- a/phoenix-core/src/main/java/org/apache/phoenix/compile/OrderPreservingTracker.java
+++ b/phoenix-core/src/main/java/org/apache/phoenix/compile/OrderPreservingTracker.java
@@ -312,7 +312,7 @@ public class OrderPreservingTracker {
 
         @Override
         public Iterator<Expression> visitEnter(ScalarFunction node) {
-            return node.preservesOrder() == OrderPreserving.NO ? Iterators.<Expression>
emptyIterator() : Iterators
+            return node.preservesOrder() == OrderPreserving.NO ? Collections.<Expression>
emptyIterator() : Iterators
                     .singletonIterator(node.getChildren().get(node.getKeyFormationTraversalIndex()));
         }
 

http://git-wip-us.apache.org/repos/asf/phoenix/blob/dbba101b/phoenix-core/src/main/java/org/apache/phoenix/compile/ScanRanges.java
----------------------------------------------------------------------
diff --git a/phoenix-core/src/main/java/org/apache/phoenix/compile/ScanRanges.java b/phoenix-core/src/main/java/org/apache/phoenix/compile/ScanRanges.java
index 79bf3b9..1b94cff 100644
--- a/phoenix-core/src/main/java/org/apache/phoenix/compile/ScanRanges.java
+++ b/phoenix-core/src/main/java/org/apache/phoenix/compile/ScanRanges.java
@@ -51,7 +51,6 @@ import org.apache.phoenix.util.SchemaUtil;
 
 import com.google.common.base.Throwables;
 import com.google.common.collect.ImmutableList;
-import com.google.common.collect.Iterators;
 import com.google.common.collect.Lists;
 
 
@@ -566,7 +565,7 @@ public class ScanRanges {
     }
     
     public Iterator<KeyRange> getPointLookupKeyIterator() {
-        return isPointLookup ? ranges.get(0).iterator() : Iterators.<KeyRange>emptyIterator();
+        return isPointLookup ? ranges.get(0).iterator() : Collections.<KeyRange>emptyIterator();
     }
 
     public int getBoundPkColumnCount() {

http://git-wip-us.apache.org/repos/asf/phoenix/blob/dbba101b/phoenix-core/src/main/java/org/apache/phoenix/compile/WhereCompiler.java
----------------------------------------------------------------------
diff --git a/phoenix-core/src/main/java/org/apache/phoenix/compile/WhereCompiler.java b/phoenix-core/src/main/java/org/apache/phoenix/compile/WhereCompiler.java
index 54dba3c..2cf5857 100644
--- a/phoenix-core/src/main/java/org/apache/phoenix/compile/WhereCompiler.java
+++ b/phoenix-core/src/main/java/org/apache/phoenix/compile/WhereCompiler.java
@@ -68,7 +68,6 @@ import org.apache.phoenix.util.ExpressionUtil;
 import org.apache.phoenix.util.ScanUtil;
 import org.apache.phoenix.util.SchemaUtil;
 
-import com.google.common.collect.Iterators;
 import com.google.common.collect.Lists;
 import com.google.common.collect.Sets;
 
@@ -264,7 +263,7 @@ public class WhereCompiler {
                 public Iterator<Expression> defaultIterator(Expression node) {
                     // Stop traversal once we've found multiple KeyValue columns
                     if (counter.getCount() == Counter.Count.MULTIPLE) {
-                        return Iterators.emptyIterator();
+                        return Collections.emptyIterator();
                     }
                     return super.defaultIterator(node);
                 }

http://git-wip-us.apache.org/repos/asf/phoenix/blob/dbba101b/phoenix-core/src/main/java/org/apache/phoenix/compile/WhereOptimizer.java
----------------------------------------------------------------------
diff --git a/phoenix-core/src/main/java/org/apache/phoenix/compile/WhereOptimizer.java b/phoenix-core/src/main/java/org/apache/phoenix/compile/WhereOptimizer.java
index 5e15f61..5e7b996 100644
--- a/phoenix-core/src/main/java/org/apache/phoenix/compile/WhereOptimizer.java
+++ b/phoenix-core/src/main/java/org/apache/phoenix/compile/WhereOptimizer.java
@@ -463,7 +463,7 @@ public class WhereOptimizer {
         private static final KeySlots EMPTY_KEY_SLOTS = new KeySlots() {
             @Override
             public Iterator<KeySlot> iterator() {
-                return Iterators.emptyIterator();
+                return Collections.emptyIterator();
             }
 
             @Override
@@ -917,7 +917,7 @@ public class WhereOptimizer {
         public Iterator<Expression> visitEnter(ComparisonExpression node) {
             Expression rhs = node.getChildren().get(1);
             if (!rhs.isStateless() || node.getFilterOp() == CompareOp.NOT_EQUAL) {
-                return Iterators.emptyIterator();
+                return Collections.emptyIterator();
             }
             return Iterators.singletonIterator(node.getChildren().get(0));
         }
@@ -947,7 +947,7 @@ public class WhereOptimizer {
         public Iterator<Expression> visitEnter(ScalarFunction node) {
             int index = node.getKeyFormationTraversalIndex();
             if (index < 0) {
-                return Iterators.emptyIterator();
+                return Collections.emptyIterator();
             }
             return Iterators.singletonIterator(node.getChildren().get(index));
         }
@@ -965,7 +965,7 @@ public class WhereOptimizer {
             // TODO: can we optimize something that starts with '_' like this: foo LIKE '_a%'
?
             if (node.getLikeType() == LikeType.CASE_INSENSITIVE || // TODO: remove this when
we optimize ILIKE
                 ! (node.getChildren().get(1) instanceof LiteralExpression) || node.startsWithWildcard())
{
-                return Iterators.emptyIterator();
+                return Collections.emptyIterator();
             }
 
             return Iterators.singletonIterator(node.getChildren().get(0));

http://git-wip-us.apache.org/repos/asf/phoenix/blob/dbba101b/phoenix-core/src/main/java/org/apache/phoenix/execute/MutationState.java
----------------------------------------------------------------------
diff --git a/phoenix-core/src/main/java/org/apache/phoenix/execute/MutationState.java b/phoenix-core/src/main/java/org/apache/phoenix/execute/MutationState.java
index 9bf134a..df069a6 100644
--- a/phoenix-core/src/main/java/org/apache/phoenix/execute/MutationState.java
+++ b/phoenix-core/src/main/java/org/apache/phoenix/execute/MutationState.java
@@ -478,7 +478,7 @@ public class MutationState implements SQLCloseable {
                      IndexMaintainer.maintainedIndexes(table.getIndexes().iterator()) :
                          table.isImmutableRows() ?
                             IndexMaintainer.maintainedGlobalIndexes(table.getIndexes().iterator())
:
-                                Iterators.<PTable>emptyIterator();
+                                Collections.<PTable>emptyIterator();
         final List<Mutation> mutationList = Lists.newArrayListWithExpectedSize(values.size());
         final List<Mutation> mutationsPertainingToIndex = indexes.hasNext() ? Lists.<Mutation>newArrayListWithExpectedSize(values.size())
: null;
         generateMutations(tableRef, mutationTimestamp, serverTimestamp, values, mutationList,
mutationsPertainingToIndex);
@@ -611,7 +611,7 @@ public class MutationState implements SQLCloseable {
     public Iterator<Pair<byte[],List<Mutation>>> toMutations(final boolean
includeMutableIndexes, final Long tableTimestamp) {
         final Iterator<Map.Entry<TableRef, Map<ImmutableBytesPtr,RowMutationState>>>
iterator = this.mutations.entrySet().iterator();
         if (!iterator.hasNext()) {
-            return Iterators.emptyIterator();
+            return Collections.emptyIterator();
         }
         Long scn = connection.getSCN();
         final long serverTimestamp = getTableTimestamp(tableTimestamp, scn);

http://git-wip-us.apache.org/repos/asf/phoenix/blob/dbba101b/phoenix-core/src/main/java/org/apache/phoenix/expression/visitor/TraverseNoExpressionVisitor.java
----------------------------------------------------------------------
diff --git a/phoenix-core/src/main/java/org/apache/phoenix/expression/visitor/TraverseNoExpressionVisitor.java
b/phoenix-core/src/main/java/org/apache/phoenix/expression/visitor/TraverseNoExpressionVisitor.java
index 4d488ef..37a1255 100644
--- a/phoenix-core/src/main/java/org/apache/phoenix/expression/visitor/TraverseNoExpressionVisitor.java
+++ b/phoenix-core/src/main/java/org/apache/phoenix/expression/visitor/TraverseNoExpressionVisitor.java
@@ -17,17 +17,16 @@
  */
 package org.apache.phoenix.expression.visitor;
 
+import java.util.Collections;
 import java.util.Iterator;
 
 import org.apache.phoenix.expression.Expression;
 
-import com.google.common.collect.Iterators;
-
 public abstract class TraverseNoExpressionVisitor<E> extends BaseExpressionVisitor<E>
{
 
     @Override
     public Iterator<Expression> defaultIterator(Expression node) {
-        return Iterators.emptyIterator();
+        return Collections.emptyIterator();
     }
 
 }

http://git-wip-us.apache.org/repos/asf/phoenix/blob/dbba101b/phoenix-core/src/main/java/org/apache/phoenix/iterate/DistinctAggregatingResultIterator.java
----------------------------------------------------------------------
diff --git a/phoenix-core/src/main/java/org/apache/phoenix/iterate/DistinctAggregatingResultIterator.java
b/phoenix-core/src/main/java/org/apache/phoenix/iterate/DistinctAggregatingResultIterator.java
index cf3fb38..669b75a 100644
--- a/phoenix-core/src/main/java/org/apache/phoenix/iterate/DistinctAggregatingResultIterator.java
+++ b/phoenix-core/src/main/java/org/apache/phoenix/iterate/DistinctAggregatingResultIterator.java
@@ -18,6 +18,7 @@
 package org.apache.phoenix.iterate;
 
 import java.sql.SQLException;
+import java.util.Collections;
 import java.util.Iterator;
 import java.util.List;
 import java.util.Set;
@@ -29,7 +30,6 @@ import org.apache.phoenix.expression.Expression;
 import org.apache.phoenix.expression.aggregator.Aggregator;
 import org.apache.phoenix.schema.tuple.Tuple;
 
-import com.google.common.collect.Iterators;
 import com.google.common.collect.Sets;
 
 /**
@@ -122,7 +122,7 @@ public class DistinctAggregatingResultIterator implements AggregatingResultItera
             aggregate(tuple);
             return tuple;
         }
-        resultIterator = Iterators.emptyIterator();
+        resultIterator = Collections.emptyIterator();
         return null;
     }
     
@@ -147,7 +147,7 @@ public class DistinctAggregatingResultIterator implements AggregatingResultItera
 
     @Override
     public void close()  {
-        resultIterator = Iterators.emptyIterator();
+        resultIterator = Collections.emptyIterator();
     }
 
 

http://git-wip-us.apache.org/repos/asf/phoenix/blob/dbba101b/phoenix-core/src/main/java/org/apache/phoenix/iterate/ExplainTable.java
----------------------------------------------------------------------
diff --git a/phoenix-core/src/main/java/org/apache/phoenix/iterate/ExplainTable.java b/phoenix-core/src/main/java/org/apache/phoenix/iterate/ExplainTable.java
index 96e4d81..06ac3c0 100644
--- a/phoenix-core/src/main/java/org/apache/phoenix/iterate/ExplainTable.java
+++ b/phoenix-core/src/main/java/org/apache/phoenix/iterate/ExplainTable.java
@@ -50,8 +50,6 @@ import org.apache.phoenix.schema.types.PInteger;
 import org.apache.phoenix.util.ScanUtil;
 import org.apache.phoenix.util.StringUtil;
 
-import com.google.common.collect.Iterators;
-
 
 public abstract class ExplainTable {
     private static final List<KeyRange> EVERYTHING = Collections.singletonList(KeyRange.EVERYTHING_RANGE);
@@ -263,7 +261,7 @@ public abstract class ExplainTable {
         // TODO: review this and potentially intersect the scan ranges
         // with the minMaxRange in ScanRanges to prevent having to do all this.
         KeyRange minMaxRange = scanRanges.getMinMaxRange();
-        Iterator<byte[]> minMaxIterator = Iterators.emptyIterator();
+        Iterator<byte[]> minMaxIterator = Collections.emptyIterator();
         if (minMaxRange != KeyRange.EVERYTHING_RANGE) {
             RowKeySchema schema = tableRef.getTable().getRowKeySchema();
             if (!minMaxRange.isUnbound(bound)) {
@@ -286,7 +284,7 @@ public abstract class ExplainTable {
                     b = bMinMax;
                     isNull = null;
                 } else if (cmp < 0) {
-                    minMaxIterator = Iterators.emptyIterator();
+                    minMaxIterator = Collections.emptyIterator();
                 }
             }
             if (isLocalIndex && i == 0) {

http://git-wip-us.apache.org/repos/asf/phoenix/blob/dbba101b/phoenix-core/src/main/java/org/apache/phoenix/schema/MetaDataClient.java
----------------------------------------------------------------------
diff --git a/phoenix-core/src/main/java/org/apache/phoenix/schema/MetaDataClient.java b/phoenix-core/src/main/java/org/apache/phoenix/schema/MetaDataClient.java
index ed1b3b2..0f6bab2 100644
--- a/phoenix-core/src/main/java/org/apache/phoenix/schema/MetaDataClient.java
+++ b/phoenix-core/src/main/java/org/apache/phoenix/schema/MetaDataClient.java
@@ -1857,7 +1857,7 @@ public class MetaDataClient {
             PrimaryKeyConstraint pkConstraint = statement.getPrimaryKeyConstraint();
             String pkName = null;
             List<Pair<ColumnName,SortOrder>> pkColumnsNames = Collections.<Pair<ColumnName,SortOrder>>emptyList();
-            Iterator<Pair<ColumnName,SortOrder>> pkColumnsIterator = Iterators.emptyIterator();
+            Iterator<Pair<ColumnName,SortOrder>> pkColumnsIterator = Collections.emptyIterator();
             if (pkConstraint != null) {
                 pkColumnsNames = pkConstraint.getColumnNames();
                 pkColumnsIterator = pkColumnsNames.iterator();

http://git-wip-us.apache.org/repos/asf/phoenix/blob/dbba101b/phoenix-core/src/main/java/org/apache/phoenix/util/ScanUtil.java
----------------------------------------------------------------------
diff --git a/phoenix-core/src/main/java/org/apache/phoenix/util/ScanUtil.java b/phoenix-core/src/main/java/org/apache/phoenix/util/ScanUtil.java
index 9794a2a..a844226 100644
--- a/phoenix-core/src/main/java/org/apache/phoenix/util/ScanUtil.java
+++ b/phoenix-core/src/main/java/org/apache/phoenix/util/ScanUtil.java
@@ -28,6 +28,7 @@ import java.io.IOException;
 import java.sql.SQLException;
 import java.util.ArrayList;
 import java.util.Arrays;
+import java.util.Collections;
 import java.util.Iterator;
 import java.util.List;
 import java.util.Map;
@@ -823,7 +824,7 @@ public class ScanUtil {
         Iterator<Filter> filterIterator;
         Filter topLevelFilter = scan.getFilter();
         if (topLevelFilter == null) {
-            filterIterator = Iterators.emptyIterator();
+            filterIterator = Collections.emptyIterator();
         } else if (topLevelFilter instanceof FilterList) {
             filterIterator = ((FilterList) topLevelFilter).getFilters().iterator();
         } else {


Mime
View raw message