You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@hbase.apache.org by sy...@apache.org on 2016/01/07 17:58:34 UTC
[02/17] hbase git commit: HBASE-14524 Short-circuit comparison of
rows in CellComparator. (Lars Francke)
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/hbase-12439
Commit: 9997e4ee52136a681faa825dea46bd1162d71eca
Parents: 998b937
Author: anoopsjohn <an...@gmail.com>
Authored: Tue Jan 5 08:47:23 2016 +0530
Committer: anoopsjohn <an...@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(),