phoenix-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jamestay...@apache.org
Subject phoenix git commit: PHOENIX-2436 Remove usage of Guava ComparisonChain due to version incompatibilities (Kumar Palaniappan)
Date Thu, 19 Nov 2015 21:41:09 GMT
Repository: phoenix
Updated Branches:
  refs/heads/4.x-HBase-1.0 cae08e49b -> 034fede14


PHOENIX-2436 Remove usage of Guava ComparisonChain due to version incompatibilities (Kumar
Palaniappan)


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

Branch: refs/heads/4.x-HBase-1.0
Commit: 034fede147a226b773bcd88c98cbab57f65e6c9a
Parents: cae08e4
Author: James Taylor <jtaylor@salesforce.com>
Authored: Thu Nov 19 13:34:39 2015 -0800
Committer: James Taylor <jtaylor@salesforce.com>
Committed: Thu Nov 19 13:39:47 2015 -0800

----------------------------------------------------------------------
 .../java/org/apache/phoenix/query/KeyRange.java | 34 ++++++++++++--------
 1 file changed, 21 insertions(+), 13 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/phoenix/blob/034fede1/phoenix-core/src/main/java/org/apache/phoenix/query/KeyRange.java
----------------------------------------------------------------------
diff --git a/phoenix-core/src/main/java/org/apache/phoenix/query/KeyRange.java b/phoenix-core/src/main/java/org/apache/phoenix/query/KeyRange.java
index 366a123..6618aa5 100644
--- a/phoenix-core/src/main/java/org/apache/phoenix/query/KeyRange.java
+++ b/phoenix-core/src/main/java/org/apache/phoenix/query/KeyRange.java
@@ -35,7 +35,6 @@ import org.apache.phoenix.util.ByteUtil;
 import org.apache.phoenix.util.ScanUtil.BytesComparator;
 
 import com.google.common.base.Function;
-import com.google.common.collect.ComparisonChain;
 import com.google.common.collect.Lists;
 
 import edu.umd.cs.findbugs.annotations.NonNull;
@@ -82,18 +81,27 @@ public class KeyRange implements Writable {
     };
     public static final Comparator<KeyRange> COMPARATOR = new Comparator<KeyRange>()
{
         @Override public int compare(KeyRange o1, KeyRange o2) {
-            return ComparisonChain.start()
-                     .compareFalseFirst(o2.lowerUnbound(), o1.lowerUnbound())
-                    .compare(o1.getLowerRange(), o2.getLowerRange(), Bytes.BYTES_COMPARATOR)
-                    // we want o1 lower inclusive to come before o2 lower inclusive, but
-                    // false comes before true, so we have to negate
-                    .compareFalseFirst(o2.isLowerInclusive(), o1.isLowerInclusive())
-                    // for the same lower bounding, we want a finite upper bound to
-                    // be ordered before an infinite upper bound
-                    .compareFalseFirst(o1.upperUnbound(), o2.upperUnbound())
-                    .compare(o1.getUpperRange(), o2.getUpperRange(), Bytes.BYTES_COMPARATOR)
-                    .compareFalseFirst(o2.isUpperInclusive(), o1.isUpperInclusive())
-                    .result();
+            int result = Boolean.compare(o2.lowerUnbound(), o1.lowerUnbound());
+            if (result != 0) {
+                return result;
+            }
+            result = Bytes.BYTES_COMPARATOR.compare(o1.getLowerRange(), o2.getLowerRange());
+            if (result != 0) {
+                return result;
+            }
+            result = Boolean.compare(o2.isLowerInclusive(), o1.isLowerInclusive());
+            if (result != 0) {
+                return result;
+            }
+            result = Boolean.compare(o1.upperUnbound(), o2.upperUnbound());
+            if (result != 0) {
+                return result;
+            }
+            result = Bytes.BYTES_COMPARATOR.compare(o1.getUpperRange(), o2.getUpperRange());
+            if (result != 0) {
+                return result;
+            }
+            return Boolean.compare(o2.isUpperInclusive(), o1.isUpperInclusive());
         }
     };
 


Mime
View raw message