Search in sources :

Example 1 with DeltaBinaryPackingValuesReader

use of org.apache.parquet.column.values.delta.DeltaBinaryPackingValuesReader in project parquet-mr by apache.

the class TestDeltaLengthByteArray method testLengths.

@Test
public void testLengths() throws IOException {
    DeltaLengthByteArrayValuesWriter writer = getDeltaLengthByteArrayValuesWriter();
    ValuesReader reader = new DeltaBinaryPackingValuesReader();
    Utils.writeData(writer, values);
    int[] bin = Utils.readInts(reader, writer.getBytes().toInputStream(), values.length);
    for (int i = 0; i < bin.length; i++) {
        Assert.assertEquals(values[i].length(), bin[i]);
    }
}
Also used : DeltaBinaryPackingValuesReader(org.apache.parquet.column.values.delta.DeltaBinaryPackingValuesReader) ValuesReader(org.apache.parquet.column.values.ValuesReader) DeltaBinaryPackingValuesReader(org.apache.parquet.column.values.delta.DeltaBinaryPackingValuesReader) Test(org.junit.Test)

Example 2 with DeltaBinaryPackingValuesReader

use of org.apache.parquet.column.values.delta.DeltaBinaryPackingValuesReader in project parquet-mr by apache.

the class TestDeltaByteArray method testLengths.

@Test
public void testLengths() throws IOException {
    DeltaByteArrayWriter writer = new DeltaByteArrayWriter(64 * 1024, 64 * 1024, new DirectByteBufferAllocator());
    ValuesReader reader = new DeltaBinaryPackingValuesReader();
    Utils.writeData(writer, values);
    ByteBufferInputStream data = writer.getBytes().toInputStream();
    int[] bin = Utils.readInts(reader, data, values.length);
    // test prefix lengths
    Assert.assertEquals(0, bin[0]);
    Assert.assertEquals(7, bin[1]);
    Assert.assertEquals(7, bin[2]);
    reader = new DeltaBinaryPackingValuesReader();
    bin = Utils.readInts(reader, data, values.length);
    // test suffix lengths
    Assert.assertEquals(10, bin[0]);
    Assert.assertEquals(0, bin[1]);
    Assert.assertEquals(7, bin[2]);
}
Also used : DeltaBinaryPackingValuesReader(org.apache.parquet.column.values.delta.DeltaBinaryPackingValuesReader) ValuesReader(org.apache.parquet.column.values.ValuesReader) DirectByteBufferAllocator(org.apache.parquet.bytes.DirectByteBufferAllocator) ByteBufferInputStream(org.apache.parquet.bytes.ByteBufferInputStream) DeltaBinaryPackingValuesReader(org.apache.parquet.column.values.delta.DeltaBinaryPackingValuesReader) Test(org.junit.Test)

Example 3 with DeltaBinaryPackingValuesReader

use of org.apache.parquet.column.values.delta.DeltaBinaryPackingValuesReader in project parquet-mr by apache.

the class BenchmarkReadingRandomIntegers method readingDelta.

@BenchmarkOptions(benchmarkRounds = 20, warmupRounds = 10)
@Test
public void readingDelta() throws IOException {
    for (int j = 0; j < 10; j++) {
        DeltaBinaryPackingValuesReader reader = new DeltaBinaryPackingValuesReader();
        readData(reader, deltaBytes);
    }
}
Also used : DeltaBinaryPackingValuesReader(org.apache.parquet.column.values.delta.DeltaBinaryPackingValuesReader) Test(org.junit.Test) BenchmarkOptions(com.carrotsearch.junitbenchmarks.BenchmarkOptions)

Aggregations

DeltaBinaryPackingValuesReader (org.apache.parquet.column.values.delta.DeltaBinaryPackingValuesReader)3 Test (org.junit.Test)3 ValuesReader (org.apache.parquet.column.values.ValuesReader)2 BenchmarkOptions (com.carrotsearch.junitbenchmarks.BenchmarkOptions)1 ByteBufferInputStream (org.apache.parquet.bytes.ByteBufferInputStream)1 DirectByteBufferAllocator (org.apache.parquet.bytes.DirectByteBufferAllocator)1