Search in sources :

Example 1 with DeltaBinaryPackingValuesWriterForInteger

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

the class BenchmarkIntegerOutputSize method testRandomIntegers.

public void testRandomIntegers(IntFunc func, int bitWidth) {
    DeltaBinaryPackingValuesWriter delta = new DeltaBinaryPackingValuesWriterForInteger(blockSize, miniBlockNum, 100, 20000, new DirectByteBufferAllocator());
    RunLengthBitPackingHybridValuesWriter rle = new RunLengthBitPackingHybridValuesWriter(bitWidth, 100, 20000, new DirectByteBufferAllocator());
    for (int i = 0; i < dataSize; i++) {
        int v = func.getIntValue();
        delta.writeInteger(v);
        rle.writeInteger(v);
    }
    System.out.println("delta size: " + delta.getBytes().size());
    System.out.println("estimated size" + estimatedSize());
    System.out.println("rle size: " + rle.getBytes().size());
}
Also used : DirectByteBufferAllocator(org.apache.parquet.bytes.DirectByteBufferAllocator) DeltaBinaryPackingValuesWriterForInteger(org.apache.parquet.column.values.delta.DeltaBinaryPackingValuesWriterForInteger) RunLengthBitPackingHybridValuesWriter(org.apache.parquet.column.values.rle.RunLengthBitPackingHybridValuesWriter) DeltaBinaryPackingValuesWriter(org.apache.parquet.column.values.delta.DeltaBinaryPackingValuesWriter)

Example 2 with DeltaBinaryPackingValuesWriterForInteger

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

the class RandomWritingBenchmarkTest method writeDeltaPackingTest2.

@BenchmarkOptions(benchmarkRounds = 10, warmupRounds = 2)
@Test
public void writeDeltaPackingTest2() {
    DeltaBinaryPackingValuesWriter writer = new DeltaBinaryPackingValuesWriterForInteger(blockSize, miniBlockNum, 100, 20000, new DirectByteBufferAllocator());
    runWriteTest(writer);
}
Also used : DirectByteBufferAllocator(org.apache.parquet.bytes.DirectByteBufferAllocator) DeltaBinaryPackingValuesWriterForInteger(org.apache.parquet.column.values.delta.DeltaBinaryPackingValuesWriterForInteger) DeltaBinaryPackingValuesWriter(org.apache.parquet.column.values.delta.DeltaBinaryPackingValuesWriter) Test(org.junit.Test) BenchmarkOptions(com.carrotsearch.junitbenchmarks.BenchmarkOptions)

Example 3 with DeltaBinaryPackingValuesWriterForInteger

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

the class RandomWritingBenchmarkTest method writeDeltaPackingTest.

@BenchmarkOptions(benchmarkRounds = 10, warmupRounds = 2)
@Test
public void writeDeltaPackingTest() {
    DeltaBinaryPackingValuesWriter writer = new DeltaBinaryPackingValuesWriterForInteger(blockSize, miniBlockNum, 100, 20000, new DirectByteBufferAllocator());
    runWriteTest(writer);
}
Also used : DirectByteBufferAllocator(org.apache.parquet.bytes.DirectByteBufferAllocator) DeltaBinaryPackingValuesWriterForInteger(org.apache.parquet.column.values.delta.DeltaBinaryPackingValuesWriterForInteger) DeltaBinaryPackingValuesWriter(org.apache.parquet.column.values.delta.DeltaBinaryPackingValuesWriter) Test(org.junit.Test) BenchmarkOptions(com.carrotsearch.junitbenchmarks.BenchmarkOptions)

Example 4 with DeltaBinaryPackingValuesWriterForInteger

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

the class BenchmarkReadingRandomIntegers method prepare.

@BeforeClass
public static void prepare() throws IOException {
    Random random = new Random();
    data = new int[100000 * blockSize];
    for (int i = 0; i < data.length; i++) {
        data[i] = random.nextInt(100) - 200;
    }
    ValuesWriter delta = new DeltaBinaryPackingValuesWriterForInteger(blockSize, miniBlockNum, 100, 20000, new DirectByteBufferAllocator());
    ValuesWriter rle = new RunLengthBitPackingHybridValuesWriter(32, 100, 20000, new DirectByteBufferAllocator());
    for (int i = 0; i < data.length; i++) {
        delta.writeInteger(data[i]);
        rle.writeInteger(data[i]);
    }
    deltaBytes = delta.getBytes().toByteArray();
    rleBytes = rle.getBytes().toByteArray();
}
Also used : DirectByteBufferAllocator(org.apache.parquet.bytes.DirectByteBufferAllocator) DeltaBinaryPackingValuesWriterForInteger(org.apache.parquet.column.values.delta.DeltaBinaryPackingValuesWriterForInteger) Random(java.util.Random) RunLengthBitPackingHybridValuesWriter(org.apache.parquet.column.values.rle.RunLengthBitPackingHybridValuesWriter) ValuesWriter(org.apache.parquet.column.values.ValuesWriter) RunLengthBitPackingHybridValuesWriter(org.apache.parquet.column.values.rle.RunLengthBitPackingHybridValuesWriter) BeforeClass(org.junit.BeforeClass)

Aggregations

DirectByteBufferAllocator (org.apache.parquet.bytes.DirectByteBufferAllocator)4 DeltaBinaryPackingValuesWriterForInteger (org.apache.parquet.column.values.delta.DeltaBinaryPackingValuesWriterForInteger)4 DeltaBinaryPackingValuesWriter (org.apache.parquet.column.values.delta.DeltaBinaryPackingValuesWriter)3 BenchmarkOptions (com.carrotsearch.junitbenchmarks.BenchmarkOptions)2 RunLengthBitPackingHybridValuesWriter (org.apache.parquet.column.values.rle.RunLengthBitPackingHybridValuesWriter)2 Test (org.junit.Test)2 Random (java.util.Random)1 ValuesWriter (org.apache.parquet.column.values.ValuesWriter)1 BeforeClass (org.junit.BeforeClass)1