Package org.apache.hadoop.hbase.codec.prefixtree

Examples of org.apache.hadoop.hbase.codec.prefixtree.PrefixTreeCodec


  }

  @Test
  public void testSeekBeforeWithFixedData() throws Exception {
    formatRowNum = true;
    PrefixTreeCodec encoder = new PrefixTreeCodec();
    int batchId = numBatchesWritten++;
    ByteBuffer dataBuffer = generateFixedTestData(kvset, batchId, false);
    HFileBlockEncodingContext blkEncodingCtx = new HFileBlockDefaultEncodingContext(
        Algorithm.NONE, DataBlockEncoding.PREFIX_TREE, new byte[0]);
    encoder.encodeKeyValues(dataBuffer, false, blkEncodingCtx);
    EncodedSeeker seeker = encoder.createSeeker(KeyValue.COMPARATOR, false);
    byte[] onDiskBytes = blkEncodingCtx.getOnDiskBytesWithHeader();
    ByteBuffer readBuffer = ByteBuffer.wrap(onDiskBytes,
        DataBlockEncoding.ID_SIZE, onDiskBytes.length
            - DataBlockEncoding.ID_SIZE);
    seeker.setCurrentBuffer(readBuffer);
View Full Code Here


        .getKeyValue().getRow());
  }

  @Test
  public void testScanWithRandomData() throws Exception {
    PrefixTreeCodec encoder = new PrefixTreeCodec();
    ByteBuffer dataBuffer = generateRandomTestData(kvset, numBatchesWritten++);
    HFileBlockEncodingContext blkEncodingCtx = new HFileBlockDefaultEncodingContext(
        Algorithm.NONE, DataBlockEncoding.PREFIX_TREE, new byte[0]);
    encoder.encodeKeyValues(dataBuffer, false, blkEncodingCtx);
    EncodedSeeker seeker = encoder.createSeeker(KeyValue.COMPARATOR, false);
    byte[] onDiskBytes=blkEncodingCtx.getOnDiskBytesWithHeader();
    ByteBuffer readBuffer = ByteBuffer.wrap(onDiskBytes,
        DataBlockEncoding.ID_SIZE, onDiskBytes.length
            - DataBlockEncoding.ID_SIZE);
    seeker.setCurrentBuffer(readBuffer);
View Full Code Here

    } while (seeker.next());
  }

  @Test
  public void testSeekWithRandomData() throws Exception {
    PrefixTreeCodec encoder = new PrefixTreeCodec();
    int batchId = numBatchesWritten++;
    ByteBuffer dataBuffer = generateRandomTestData(kvset, batchId);
    HFileBlockEncodingContext blkEncodingCtx = new HFileBlockDefaultEncodingContext(
        Algorithm.NONE, DataBlockEncoding.PREFIX_TREE, new byte[0]);
    encoder.encodeKeyValues(dataBuffer, false, blkEncodingCtx);
    EncodedSeeker seeker = encoder.createSeeker(KeyValue.COMPARATOR, false);
    byte[] onDiskBytes = blkEncodingCtx.getOnDiskBytesWithHeader();
    ByteBuffer readBuffer = ByteBuffer.wrap(onDiskBytes,
        DataBlockEncoding.ID_SIZE, onDiskBytes.length
            - DataBlockEncoding.ID_SIZE);
    verifySeeking(seeker, readBuffer, batchId);
View Full Code Here

    verifySeeking(seeker, readBuffer, batchId);
  }

  @Test
  public void testSeekWithFixedData() throws Exception {
    PrefixTreeCodec encoder = new PrefixTreeCodec();
    int batchId = numBatchesWritten++;
    ByteBuffer dataBuffer = generateFixedTestData(kvset, batchId);
    HFileBlockEncodingContext blkEncodingCtx = new HFileBlockDefaultEncodingContext(
        Algorithm.NONE, DataBlockEncoding.PREFIX_TREE, new byte[0]);
    encoder.encodeKeyValues(dataBuffer, false, blkEncodingCtx);
    EncodedSeeker seeker = encoder.createSeeker(KeyValue.COMPARATOR,
        false);
    byte[] onDiskBytes = blkEncodingCtx.getOnDiskBytesWithHeader();
    ByteBuffer readBuffer = ByteBuffer.wrap(onDiskBytes,
        DataBlockEncoding.ID_SIZE, onDiskBytes.length
            - DataBlockEncoding.ID_SIZE);
View Full Code Here

  }

  @Test
  public void testSeekBeforeWithFixedData() throws Exception {
    formatRowNum = true;
    PrefixTreeCodec encoder = new PrefixTreeCodec();
    int batchId = numBatchesWritten++;
    ByteBuffer dataBuffer = generateFixedTestData(kvset, batchId, false);
    HFileBlockEncodingContext blkEncodingCtx = new HFileBlockDefaultEncodingContext(
        Algorithm.NONE, DataBlockEncoding.PREFIX_TREE, new byte[0]);
    encoder.encodeKeyValues(dataBuffer, false, blkEncodingCtx);
    EncodedSeeker seeker = encoder.createSeeker(KeyValue.KEY_COMPARATOR, false);
    byte[] onDiskBytes = blkEncodingCtx.getOnDiskBytesWithHeader();
    ByteBuffer readBuffer = ByteBuffer.wrap(onDiskBytes,
        DataBlockEncoding.ID_SIZE, onDiskBytes.length
            - DataBlockEncoding.ID_SIZE);
    seeker.setCurrentBuffer(readBuffer);
View Full Code Here

        .getKeyValue().getRow());
  }

  @Test
  public void testScanWithRandomData() throws Exception {
    PrefixTreeCodec encoder = new PrefixTreeCodec();
    ByteBuffer dataBuffer = generateRandomTestData(kvset, numBatchesWritten++);
    HFileBlockEncodingContext blkEncodingCtx = new HFileBlockDefaultEncodingContext(
        Algorithm.NONE, DataBlockEncoding.PREFIX_TREE, new byte[0]);
    encoder.encodeKeyValues(dataBuffer, false, blkEncodingCtx);
    EncodedSeeker seeker = encoder.createSeeker(KeyValue.KEY_COMPARATOR, false);
    byte[] onDiskBytes=blkEncodingCtx.getOnDiskBytesWithHeader();
    ByteBuffer readBuffer = ByteBuffer.wrap(onDiskBytes,
        DataBlockEncoding.ID_SIZE, onDiskBytes.length
            - DataBlockEncoding.ID_SIZE);
    seeker.setCurrentBuffer(readBuffer);
View Full Code Here

    } while (seeker.next());
  }

  @Test
  public void testSeekWithRandomData() throws Exception {
    PrefixTreeCodec encoder = new PrefixTreeCodec();
    int batchId = numBatchesWritten++;
    ByteBuffer dataBuffer = generateRandomTestData(kvset, batchId);
    HFileBlockEncodingContext blkEncodingCtx = new HFileBlockDefaultEncodingContext(
        Algorithm.NONE, DataBlockEncoding.PREFIX_TREE, new byte[0]);
    encoder.encodeKeyValues(dataBuffer, false, blkEncodingCtx);
    EncodedSeeker seeker = encoder.createSeeker(KeyValue.KEY_COMPARATOR, false);
    byte[] onDiskBytes = blkEncodingCtx.getOnDiskBytesWithHeader();
    ByteBuffer readBuffer = ByteBuffer.wrap(onDiskBytes,
        DataBlockEncoding.ID_SIZE, onDiskBytes.length
            - DataBlockEncoding.ID_SIZE);
    verifySeeking(seeker, readBuffer, batchId);
View Full Code Here

    verifySeeking(seeker, readBuffer, batchId);
  }

  @Test
  public void testSeekWithFixedData() throws Exception {
    PrefixTreeCodec encoder = new PrefixTreeCodec();
    int batchId = numBatchesWritten++;
    ByteBuffer dataBuffer = generateFixedTestData(kvset, batchId);
    HFileBlockEncodingContext blkEncodingCtx = new HFileBlockDefaultEncodingContext(
        Algorithm.NONE, DataBlockEncoding.PREFIX_TREE, new byte[0]);
    encoder.encodeKeyValues(dataBuffer, false, blkEncodingCtx);
    EncodedSeeker seeker = encoder.createSeeker(KeyValue.KEY_COMPARATOR,
        false);
    byte[] onDiskBytes = blkEncodingCtx.getOnDiskBytesWithHeader();
    ByteBuffer readBuffer = ByteBuffer.wrap(onDiskBytes,
        DataBlockEncoding.ID_SIZE, onDiskBytes.length
            - DataBlockEncoding.ID_SIZE);
View Full Code Here

  }

  @Test
  public void testSeekBeforeWithFixedData() throws Exception {
    formatRowNum = true;
    PrefixTreeCodec encoder = new PrefixTreeCodec();
    int batchId = numBatchesWritten++;
    HFileContext meta = new HFileContextBuilder()
                        .withHBaseCheckSum(false)
                        .withIncludesMvcc(false)
                        .withIncludesTags(includesTag)
                        .withCompression(Algorithm.NONE).build();
    HFileBlockEncodingContext blkEncodingCtx = new HFileBlockDefaultEncodingContext(
        DataBlockEncoding.PREFIX_TREE, new byte[0], meta);
    ByteArrayOutputStream baosInMemory = new ByteArrayOutputStream();
    DataOutputStream userDataStream = new DataOutputStream(baosInMemory);
    generateFixedTestData(kvset, batchId, false, includesTag, encoder, blkEncodingCtx,
        userDataStream);
    EncodedSeeker seeker = encoder.createSeeker(KeyValue.COMPARATOR,
        encoder.newDataBlockDecodingContext(meta));
    byte[] onDiskBytes = baosInMemory.toByteArray();
    ByteBuffer readBuffer = ByteBuffer.wrap(onDiskBytes, DataBlockEncoding.ID_SIZE,
        onDiskBytes.length - DataBlockEncoding.ID_SIZE);
    seeker.setCurrentBuffer(readBuffer);
View Full Code Here

    assertArrayEquals(getRowKey(batchId, NUM_ROWS_PER_BATCH - 1), seeker.getKeyValue().getRow());
  }

  @Test
  public void testScanWithRandomData() throws Exception {
    PrefixTreeCodec encoder = new PrefixTreeCodec();
    ByteArrayOutputStream baosInMemory = new ByteArrayOutputStream();
    DataOutputStream userDataStream = new DataOutputStream(baosInMemory);
    HFileContext meta = new HFileContextBuilder()
                        .withHBaseCheckSum(false)
                        .withIncludesMvcc(false)
                        .withIncludesTags(includesTag)
                        .withCompression(Algorithm.NONE)
                        .build();
    HFileBlockEncodingContext blkEncodingCtx = new HFileBlockDefaultEncodingContext(
        DataBlockEncoding.PREFIX_TREE, new byte[0], meta);
    generateRandomTestData(kvset, numBatchesWritten++, includesTag, encoder, blkEncodingCtx,
        userDataStream);
    EncodedSeeker seeker = encoder.createSeeker(KeyValue.COMPARATOR,
        encoder.newDataBlockDecodingContext(meta));
    byte[] onDiskBytes = baosInMemory.toByteArray();
    ByteBuffer readBuffer = ByteBuffer.wrap(onDiskBytes, DataBlockEncoding.ID_SIZE,
        onDiskBytes.length - DataBlockEncoding.ID_SIZE);
    seeker.setCurrentBuffer(readBuffer);
    Cell previousKV = null;
View Full Code Here

TOP

Related Classes of org.apache.hadoop.hbase.codec.prefixtree.PrefixTreeCodec

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.