hbase-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From e...@apache.org
Subject hbase git commit: HBASE-13491 Issue in FuzzyRowFilter#getNextForFuzzyRule (Anoop Sam John)
Date Sat, 18 Apr 2015 04:57:06 GMT
Repository: hbase
Updated Branches:
  refs/heads/branch-1 49bf9aec8 -> 60c30c707


HBASE-13491 Issue in FuzzyRowFilter#getNextForFuzzyRule (Anoop Sam John)


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

Branch: refs/heads/branch-1
Commit: 60c30c707c3844ad4f390262ec2b3e23d9436f3e
Parents: 49bf9ae
Author: Enis Soztutar <enis@apache.org>
Authored: Fri Apr 17 21:56:04 2015 -0700
Committer: Enis Soztutar <enis@apache.org>
Committed: Fri Apr 17 21:56:04 2015 -0700

----------------------------------------------------------------------
 .../java/org/apache/hadoop/hbase/filter/FuzzyRowFilter.java    | 5 +++--
 .../org/apache/hadoop/hbase/filter/TestFuzzyRowFilter.java     | 6 +++++-
 2 files changed, 8 insertions(+), 3 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/hbase/blob/60c30c70/hbase-client/src/main/java/org/apache/hadoop/hbase/filter/FuzzyRowFilter.java
----------------------------------------------------------------------
diff --git a/hbase-client/src/main/java/org/apache/hadoop/hbase/filter/FuzzyRowFilter.java
b/hbase-client/src/main/java/org/apache/hadoop/hbase/filter/FuzzyRowFilter.java
index 870e0ff..2ea5642 100644
--- a/hbase-client/src/main/java/org/apache/hadoop/hbase/filter/FuzzyRowFilter.java
+++ b/hbase-client/src/main/java/org/apache/hadoop/hbase/filter/FuzzyRowFilter.java
@@ -348,7 +348,8 @@ public class FuzzyRowFilter extends FilterBase {
    * @return greater byte array than given (row) which satisfies the fuzzy rule if it exists,
    *         null otherwise
    */
-  private static byte[] getNextForFuzzyRule(boolean reverse, byte[] row, int offset, int
length,
+  @VisibleForTesting
+  static byte[] getNextForFuzzyRule(boolean reverse, byte[] row, int offset, int length,
                                             byte[] fuzzyKeyBytes, byte[] fuzzyKeyMeta) {
     // To find out the next "smallest" byte array that satisfies fuzzy rule and "greater"
than
     // the given one we do the following:
@@ -373,7 +374,7 @@ public class FuzzyRowFilter extends FilterBase {
     for (int i = 0; i < result.length; i++) {
       if (i >= fuzzyKeyMeta.length || fuzzyKeyMeta[i] == 1) {
         result[i] = row[offset + i];
-        if (!order.isMax(row[i])) {
+        if (!order.isMax(row[offset + i])) {
           // this is "non-fixed" position and is not at max value, hence we can increase
it
           toInc = i;
         }

http://git-wip-us.apache.org/repos/asf/hbase/blob/60c30c70/hbase-server/src/test/java/org/apache/hadoop/hbase/filter/TestFuzzyRowFilter.java
----------------------------------------------------------------------
diff --git a/hbase-server/src/test/java/org/apache/hadoop/hbase/filter/TestFuzzyRowFilter.java
b/hbase-server/src/test/java/org/apache/hadoop/hbase/filter/TestFuzzyRowFilter.java
index 395c4ad..f871123 100644
--- a/hbase-server/src/test/java/org/apache/hadoop/hbase/filter/TestFuzzyRowFilter.java
+++ b/hbase-server/src/test/java/org/apache/hadoop/hbase/filter/TestFuzzyRowFilter.java
@@ -17,6 +17,8 @@
  */
 package org.apache.hadoop.hbase.filter;
 
+import org.apache.hadoop.hbase.KeyValue;
+import org.apache.hadoop.hbase.KeyValueUtil;
 import org.apache.hadoop.hbase.testclassification.SmallTests;
 import org.apache.hadoop.hbase.util.Bytes;
 import org.junit.Assert;
@@ -400,7 +402,9 @@ public class TestFuzzyRowFilter {
 
   private static void assertNext(boolean reverse, byte[] fuzzyRow, byte[] mask, byte[] current,
       byte[] expected) {
-    byte[] nextForFuzzyRule = FuzzyRowFilter.getNextForFuzzyRule(reverse, current, fuzzyRow,
mask);
+    KeyValue kv = KeyValueUtil.createFirstOnRow(current);
+    byte[] nextForFuzzyRule = FuzzyRowFilter.getNextForFuzzyRule(reverse, kv.getRowArray(),
+        kv.getRowOffset(), kv.getRowLength(), fuzzyRow, mask);
     Assert.assertEquals(Bytes.toStringBinary(expected), Bytes.toStringBinary(nextForFuzzyRule));
   }
 }


Mime
View raw message