Package org.apache.hadoop.hbase.KeyValue

Examples of org.apache.hadoop.hbase.KeyValue.KeyComparator.compare()


    kv1 = new KeyValue(Bytes.toBytes("ilovehbase"), family, qualA, -5, Type.Put);
    kv2 = new KeyValue(Bytes.toBytes("ilovehbase"), family, qualA, -10, Type.Put);
    assertTrue(keyComparator.compare(kv1.getKey(), kv2.getKey()) < 0);
    newKey = keyComparator.getShortMidpointKey(kv1.getKey(), kv2.getKey());
    assertTrue(keyComparator.compare(kv1.getKey(), newKey) < 0);
    assertTrue(keyComparator.compare(newKey, kv2.getKey()) == 0);

    // verify: same with row, different with qualifier
    kv1 = new KeyValue(Bytes.toBytes("ilovehbase"), family, qualA, 5, Type.Put);
    kv2 = new KeyValue(Bytes.toBytes("ilovehbase"), family, qualB, 5, Type.Put);
    assertTrue(keyComparator.compare(kv1.getKey(), kv2.getKey()) < 0);
View Full Code Here


    assertTrue(keyComparator.compare(newKey, kv2.getKey()) == 0);

    // verify: same with row, different with qualifier
    kv1 = new KeyValue(Bytes.toBytes("ilovehbase"), family, qualA, 5, Type.Put);
    kv2 = new KeyValue(Bytes.toBytes("ilovehbase"), family, qualB, 5, Type.Put);
    assertTrue(keyComparator.compare(kv1.getKey(), kv2.getKey()) < 0);
    newKey = keyComparator.getShortMidpointKey(kv1.getKey(), kv2.getKey());
    assertTrue(keyComparator.compare(kv1.getKey(), newKey) < 0);
    assertTrue(keyComparator.compare(newKey, kv2.getKey()) < 0);
    KeyValue newKeyValue = KeyValue.createKeyValueFromKey(newKey);
    assertTrue(Arrays.equals(newKeyValue.getFamily(),family));
View Full Code Here

    // verify: same with row, different with qualifier
    kv1 = new KeyValue(Bytes.toBytes("ilovehbase"), family, qualA, 5, Type.Put);
    kv2 = new KeyValue(Bytes.toBytes("ilovehbase"), family, qualB, 5, Type.Put);
    assertTrue(keyComparator.compare(kv1.getKey(), kv2.getKey()) < 0);
    newKey = keyComparator.getShortMidpointKey(kv1.getKey(), kv2.getKey());
    assertTrue(keyComparator.compare(kv1.getKey(), newKey) < 0);
    assertTrue(keyComparator.compare(newKey, kv2.getKey()) < 0);
    KeyValue newKeyValue = KeyValue.createKeyValueFromKey(newKey);
    assertTrue(Arrays.equals(newKeyValue.getFamily(),family));
    assertTrue(Arrays.equals(newKeyValue.getQualifier(),qualB));
    assertTrue(newKeyValue.getTimestamp() == HConstants.LATEST_TIMESTAMP);
View Full Code Here

    kv1 = new KeyValue(Bytes.toBytes("ilovehbase"), family, qualA, 5, Type.Put);
    kv2 = new KeyValue(Bytes.toBytes("ilovehbase"), family, qualB, 5, Type.Put);
    assertTrue(keyComparator.compare(kv1.getKey(), kv2.getKey()) < 0);
    newKey = keyComparator.getShortMidpointKey(kv1.getKey(), kv2.getKey());
    assertTrue(keyComparator.compare(kv1.getKey(), newKey) < 0);
    assertTrue(keyComparator.compare(newKey, kv2.getKey()) < 0);
    KeyValue newKeyValue = KeyValue.createKeyValueFromKey(newKey);
    assertTrue(Arrays.equals(newKeyValue.getFamily(),family));
    assertTrue(Arrays.equals(newKeyValue.getQualifier(),qualB));
    assertTrue(newKeyValue.getTimestamp() == HConstants.LATEST_TIMESTAMP);
    assertTrue(newKeyValue.getType() == Type.Maximum.getCode());
View Full Code Here

    kv2 = new KeyValue(Bytes.toBytes("ilovehbase234"), family, qualA, 0, Type.Put);
    newKey = rootKeyComparator.getShortMidpointKey(kv1.getKey(), kv2.getKey());
    assertTrue(rootKeyComparator.compare(kv1.getKey(), newKey) < 0);
    assertTrue(rootKeyComparator.compare(newKey, kv2.getKey()) == 0);
    newKey = metaKeyComparator.getShortMidpointKey(kv1.getKey(), kv2.getKey());
    assertTrue(metaKeyComparator.compare(kv1.getKey(), newKey) < 0);
    assertTrue(metaKeyComparator.compare(newKey, kv2.getKey()) == 0);

    //verify common fix scenario
    kv1 = new KeyValue(Bytes.toBytes("ilovehbase"), family, qualA, ts, Type.Put);
    kv2 = new KeyValue(Bytes.toBytes("ilovehbaseandhdfs"), family, qualA, ts, Type.Put);
View Full Code Here

    newKey = rootKeyComparator.getShortMidpointKey(kv1.getKey(), kv2.getKey());
    assertTrue(rootKeyComparator.compare(kv1.getKey(), newKey) < 0);
    assertTrue(rootKeyComparator.compare(newKey, kv2.getKey()) == 0);
    newKey = metaKeyComparator.getShortMidpointKey(kv1.getKey(), kv2.getKey());
    assertTrue(metaKeyComparator.compare(kv1.getKey(), newKey) < 0);
    assertTrue(metaKeyComparator.compare(newKey, kv2.getKey()) == 0);

    //verify common fix scenario
    kv1 = new KeyValue(Bytes.toBytes("ilovehbase"), family, qualA, ts, Type.Put);
    kv2 = new KeyValue(Bytes.toBytes("ilovehbaseandhdfs"), family, qualA, ts, Type.Put);
    assertTrue(keyComparator.compare(kv1.getKey(), kv2.getKey()) < 0);
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.