hbase-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From te...@apache.org
Subject svn commit: r1236347 - in /hbase/trunk: CHANGES.txt src/main/java/org/apache/hadoop/hbase/KeyValue.java src/test/java/org/apache/hadoop/hbase/TestKeyValue.java
Date Thu, 26 Jan 2012 18:51:33 GMT
Author: tedyu
Date: Thu Jan 26 18:51:33 2012
New Revision: 1236347

URL: http://svn.apache.org/viewvc?rev=1236347&view=rev
Log:
HBASE-5271  Result.getValue and Result.getColumnLatest return the wrong column (Ghais Issa)

Modified:
    hbase/trunk/CHANGES.txt
    hbase/trunk/src/main/java/org/apache/hadoop/hbase/KeyValue.java
    hbase/trunk/src/test/java/org/apache/hadoop/hbase/TestKeyValue.java

Modified: hbase/trunk/CHANGES.txt
URL: http://svn.apache.org/viewvc/hbase/trunk/CHANGES.txt?rev=1236347&r1=1236346&r2=1236347&view=diff
==============================================================================
--- hbase/trunk/CHANGES.txt (original)
+++ hbase/trunk/CHANGES.txt Thu Jan 26 18:51:33 2012
@@ -877,6 +877,7 @@ Release 0.92.0 - 01/23/2012
 Release 0.90.7 - Unreleased
 
   BUG FIXES
+   HBASE-5271  Result.getValue and Result.getColumnLatest return the wrong column (Ghais
Issa)
 
 Release 0.90.6 - Unreleased
 

Modified: hbase/trunk/src/main/java/org/apache/hadoop/hbase/KeyValue.java
URL: http://svn.apache.org/viewvc/hbase/trunk/src/main/java/org/apache/hadoop/hbase/KeyValue.java?rev=1236347&r1=1236346&r2=1236347&view=diff
==============================================================================
--- hbase/trunk/src/main/java/org/apache/hadoop/hbase/KeyValue.java (original)
+++ hbase/trunk/src/main/java/org/apache/hadoop/hbase/KeyValue.java Thu Jan 26 18:51:33 2012
@@ -1277,7 +1277,7 @@ public class KeyValue implements Writabl
     int o = getFamilyOffset(rl);
     int fl = getFamilyLength(o);
     int ql = getQualifierLength(rl,fl);
-    if (!Bytes.equals(family, 0, family.length, this.bytes, o, family.length)) {
+    if (!Bytes.equals(family, 0, family.length, this.bytes, o, fl)) {
       return false;
     }
     if (qualifier == null || qualifier.length == 0) {

Modified: hbase/trunk/src/test/java/org/apache/hadoop/hbase/TestKeyValue.java
URL: http://svn.apache.org/viewvc/hbase/trunk/src/test/java/org/apache/hadoop/hbase/TestKeyValue.java?rev=1236347&r1=1236346&r2=1236347&view=diff
==============================================================================
--- hbase/trunk/src/test/java/org/apache/hadoop/hbase/TestKeyValue.java (original)
+++ hbase/trunk/src/test/java/org/apache/hadoop/hbase/TestKeyValue.java Thu Jan 26 18:51:33
2012
@@ -56,6 +56,21 @@ public class TestKeyValue extends TestCa
     assertFalse(aaa.matchingColumn(family2,qualifier2));
   }
 
+  /** 
+   * Test a corner case when the family qualifier is a prefix of the
+   *  column qualifier.
+   */
+  public void testColumnCompare_prefix() throws Exception {
+    final byte [] a = Bytes.toBytes("aaa");
+    byte [] family1 = Bytes.toBytes("abc");
+    byte [] qualifier1 = Bytes.toBytes("def");
+    byte [] family2 = Bytes.toBytes("ab");
+    byte [] qualifier2 = Bytes.toBytes("def");
+
+    KeyValue aaa = new KeyValue(a, family1, qualifier1, 0L, Type.Put, a);
+    assertFalse(aaa.matchingColumn(family2, qualifier2));
+  }
+
   public void testBasics() throws Exception {
     LOG.info("LOWKEY: " + KeyValue.LOWESTKEY.toString());
     check(Bytes.toBytes(getName()),



Mime
View raw message