Search in sources :

Example 1 with Compressor

use of io.airlift.compress.Compressor in project presto by prestodb.

the class TestParquetCompressionUtils method performTest.

private void performTest(CompressionCodecName codec, int inputLength) throws IOException {
    Compressor compressor = null;
    if (codec.equals(ZSTD)) {
        compressor = new ZstdCompressor();
    } else if (codec.equals(LZ4)) {
        compressor = new Lz4Compressor();
    }
    byte[] input = createArray(inputLength);
    byte[] output = new byte[inputLength + 512];
    int retLength = compress(compressor, input, inputLength, output, 0);
    Slice decompressedSlice = ParquetCompressionUtils.decompress(codec, wrappedBuffer(output, 0, retLength), inputLength);
    assertEquals(decompressedSlice, wrappedBuffer(input));
}
Also used : Lz4Compressor(io.airlift.compress.lz4.Lz4Compressor) Slice(io.airlift.slice.Slice) ZstdCompressor(io.airlift.compress.zstd.ZstdCompressor) ZstdCompressor(io.airlift.compress.zstd.ZstdCompressor) Compressor(io.airlift.compress.Compressor) Lz4Compressor(io.airlift.compress.lz4.Lz4Compressor)

Aggregations

Compressor (io.airlift.compress.Compressor)1 Lz4Compressor (io.airlift.compress.lz4.Lz4Compressor)1 ZstdCompressor (io.airlift.compress.zstd.ZstdCompressor)1 Slice (io.airlift.slice.Slice)1