hbase-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From anoopsamj...@apache.org
Subject hbase git commit: HBASE-14524 Short-circuit comparison of rows in CellComparator. (Lars Francke)
Date Tue, 05 Jan 2016 03:17:47 GMT
Repository: hbase
Updated Branches:
  refs/heads/master 998b9371c -> 9997e4ee5


HBASE-14524 Short-circuit comparison of rows in CellComparator. (Lars Francke)


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

Branch: refs/heads/master
Commit: 9997e4ee52136a681faa825dea46bd1162d71eca
Parents: 998b937
Author: anoopsjohn <anoopsamjohn@gmail.com>
Authored: Tue Jan 5 08:47:23 2016 +0530
Committer: anoopsjohn <anoopsamjohn@gmail.com>
Committed: Tue Jan 5 08:47:23 2016 +0530

----------------------------------------------------------------------
 .../src/main/java/org/apache/hadoop/hbase/CellComparator.java    | 4 ++++
 1 file changed, 4 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/hbase/blob/9997e4ee/hbase-common/src/main/java/org/apache/hadoop/hbase/CellComparator.java
----------------------------------------------------------------------
diff --git a/hbase-common/src/main/java/org/apache/hadoop/hbase/CellComparator.java b/hbase-common/src/main/java/org/apache/hadoop/hbase/CellComparator.java
index 7002762..b179963 100644
--- a/hbase-common/src/main/java/org/apache/hadoop/hbase/CellComparator.java
+++ b/hbase-common/src/main/java/org/apache/hadoop/hbase/CellComparator.java
@@ -315,6 +315,10 @@ public class CellComparator implements Comparator<Cell>, Serializable
{
    * @return 0 if both cells are equal, 1 if left cell is bigger than right, -1 otherwise
    */
   public int compareRows(final Cell left, final Cell right) {
+    // left and right can be exactly the same at the beginning of a row
+    if (left == right) {
+      return 0;
+    }
     if (left instanceof ByteBufferedCell && right instanceof ByteBufferedCell) {
       return ByteBufferUtils.compareTo(((ByteBufferedCell) left).getRowByteBuffer(),
           ((ByteBufferedCell) left).getRowPosition(), left.getRowLength(),


Mime
View raw message