Package org.apache.hadoop.hbase

Examples of org.apache.hadoop.hbase.KeyValue$SplitKeyValue


    }

    public KeyValue next() throws IOException {
      if (exhausted) return null;

      KeyValue currentKey;
      /*
         If either the current memstore or expression row is null get the next.
         Note: the row will be nulled when it's consumed.
       */
      if (currentMemstoreKey == null)
View Full Code Here


      return currentKey;
    }

    private KeyValue nextExpressionRow() {
      KeyValue nextExpressionKey = null;
      while (matchedExpressionIterator.hasNext()) {
        int index = matchedExpressionIterator.next();
        nextExpressionKey = indexSearchContext.lookupRow(index);

        // if the scan has specified a startRow we need to keep looping
View Full Code Here

    private KeyValue nextMemstoreRow() {
      /*
      This may appear a little expensive but the initial version is not concerned
      with the performance of the memstore.
       */
      final KeyValue firstOnNextRow = this.memstoreHeap.next();
      KeyValue nextKeyValue = this.memstoreHeap.peek();
      while (firstOnNextRow != null && nextKeyValue != null &&
        comparator.compareRows(firstOnNextRow, nextKeyValue) == 0) {
        // progress to the next row
        // todo: is there a faster way of doing this?
        this.memstoreHeap.next();
View Full Code Here

    int id = 0;
    do {
      List<KeyValue> nextRow = new ArrayList<KeyValue>();
      moreRows = scanner.next(nextRow);
      if (nextRow.size() > 0) {
        KeyValue
          firstOnRow = KeyValue.createFirstOnRow(nextRow.get(0).getRow());
        newKeys.add(firstOnRow);
        // add keyvalue to the heapsize
        heapSize += firstOnRow.heapSize();
        for (KeyValue keyValue : nextRow) {
          CompleteIndexBuilder idx = builders.get(Pair.of(keyValue.getFamily(),
            keyValue.getQualifier()));
          if (idx != null) {
            idx.addKeyValue(keyValue, id);
View Full Code Here

  @Test
  public void testCompressUncompressTags1() throws Exception {
    ByteArrayOutputStream baos = new ByteArrayOutputStream();
    TagCompressionContext context = new TagCompressionContext(LRUDictionary.class);
    KeyValue kv1 = createKVWithTags(2);
    short tagsLength1 = kv1.getTagsLength();
    ByteBuffer ib = ByteBuffer.wrap(kv1.getTagsArray(), kv1.getTagsOffset(), tagsLength1);
    context.compressTags(baos, ib, tagsLength1);
    KeyValue kv2 = createKVWithTags(3);
    short tagsLength2 = kv2.getTagsLength();
    ib = ByteBuffer.wrap(kv2.getTagsArray(), kv2.getTagsOffset(), tagsLength2);
    context.compressTags(baos, ib, tagsLength2);

    context.clear();

    byte[] dest = new byte[tagsLength1];
    ByteBuffer ob = ByteBuffer.wrap(baos.toByteArray());
    context.uncompressTags(ob, dest, 0, tagsLength1);
    assertTrue(Bytes.equals(kv1.getTagsArray(), kv1.getTagsOffset(), tagsLength1, dest, 0,
        tagsLength1));
    dest = new byte[tagsLength2];
    context.uncompressTags(ob, dest, 0, tagsLength2);
    assertTrue(Bytes.equals(kv2.getTagsArray(), kv2.getTagsOffset(), tagsLength2, dest, 0,
        tagsLength2));
  }
View Full Code Here

  @Test
  public void testCompressUncompressTags2() throws Exception {
    ByteArrayOutputStream baos = new ByteArrayOutputStream();
    TagCompressionContext context = new TagCompressionContext(LRUDictionary.class);
    KeyValue kv1 = createKVWithTags(1);
    short tagsLength1 = kv1.getTagsLength();
    context.compressTags(baos, kv1.getTagsArray(), kv1.getTagsOffset(), tagsLength1);
    KeyValue kv2 = createKVWithTags(3);
    short tagsLength2 = kv2.getTagsLength();
    context.compressTags(baos, kv2.getTagsArray(), kv2.getTagsOffset(), tagsLength2);

    context.clear();

    ByteArrayInputStream bais = new ByteArrayInputStream(baos.toByteArray());
    byte[] dest = new byte[tagsLength1];
    context.uncompressTags(bais, dest, 0, tagsLength1);
    assertTrue(Bytes.equals(kv1.getTagsArray(), kv1.getTagsOffset(), tagsLength1, dest, 0,
        tagsLength1));
    dest = new byte[tagsLength2];
    context.uncompressTags(bais, dest, 0, tagsLength2);
    assertTrue(Bytes.equals(kv2.getTagsArray(), kv2.getTagsOffset(), tagsLength2, dest, 0,
        tagsLength2));
  }
View Full Code Here

  private KeyValue createKVWithTags(int noOfTags) {
    List<Tag> tags = new ArrayList<Tag>();
    for (int i = 0; i < noOfTags; i++) {
      tags.add(new Tag((byte) i, "tagValue" + i));
    }
    KeyValue kv = new KeyValue(ROW, CF, Q, 1234L, V, tags);
    return kv;
  }
View Full Code Here

    put.add(fam1, qf1, val1);
    region.put(put);
   
    //Creating put to add
    long ts = System.currentTimeMillis();
    KeyValue kv = new KeyValue(row1, fam2, qf1, ts, KeyValue.Type.Put, val2);
    put = new Put(row1);
    put.add(kv);
   
    //checkAndPut with wrong value
    Store store = region.getStore(fam1);
View Full Code Here

    //Setting up region
    String method = this.getName();
    initHRegion(tableName, method, families);

    List<KeyValue> kvs  = new ArrayList<KeyValue>();
    kvs.add(new KeyValue(row1, fam4, null, null));


    //testing existing family
    byte [] family = fam2;
    try {
View Full Code Here

    InternalScanner s = region.getScanner(scan);

    List<KeyValue> results = new ArrayList<KeyValue>();
    assertEquals(false, s.next(results));
    assertEquals(1, results.size());
    KeyValue kv = results.get(0);

    assertByteEquals(value2, kv.getValue());
    assertByteEquals(fam1, kv.getFamily());
    assertByteEquals(qual1, kv.getQualifier());
    assertByteEquals(row, kv.getRow());
  }
View Full Code Here

TOP

Related Classes of org.apache.hadoop.hbase.KeyValue$SplitKeyValue

Copyright © 2018 www.massapicom. 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.