Search in sources :

Example 1 with SnappyDecompressor

use of io.airlift.compress.snappy.SnappyDecompressor in project presto by prestodb.

the class ParquetCompressionUtils method decompressSnappy.

private static Slice decompressSnappy(Slice input, int uncompressedSize) {
    byte[] buffer = new byte[uncompressedSize];
    decompress(new SnappyDecompressor(), input, 0, input.length(), buffer, 0);
    return wrappedBuffer(buffer);
}
Also used : SnappyDecompressor(io.airlift.compress.snappy.SnappyDecompressor)

Example 2 with SnappyDecompressor

use of io.airlift.compress.snappy.SnappyDecompressor in project presto by prestodb.

the class PageFileWriterFactory method createPagesSerdeForPageFile.

public static PagesSerde createPagesSerdeForPageFile(BlockEncodingSerde blockEncodingSerde, Optional<HiveCompressionCodec> compressionCodec) {
    if (!compressionCodec.isPresent()) {
        return new PagesSerde(blockEncodingSerde, Optional.empty(), Optional.empty(), Optional.empty());
    }
    PageCompressor pageCompressor = null;
    PageDecompressor pageDecompressor = null;
    switch(compressionCodec.get()) {
        case NONE:
            break;
        case SNAPPY:
            pageCompressor = new AirliftCompressorAdapter(new SnappyCompressor());
            pageDecompressor = new AirliftDecompressorAdapter(new SnappyDecompressor());
            break;
        case LZ4:
            pageCompressor = new AirliftCompressorAdapter(new Lz4Compressor());
            pageDecompressor = new AirliftDecompressorAdapter(new Lz4Decompressor());
            break;
        case GZIP:
            pageCompressor = new AirliftCompressorAdapter(new DeflateCompressor(OptionalInt.empty()));
            pageDecompressor = new AirliftDecompressorAdapter(new InflateDecompressor());
            break;
        case ZSTD:
            pageCompressor = new AirliftCompressorAdapter(new ZstdJniCompressor(OptionalInt.empty()));
            pageDecompressor = new AirliftDecompressorAdapter(new ZstdJniDecompressor());
            break;
        default:
            throw new PrestoException(GENERIC_INTERNAL_ERROR, format("%s compression is not supported for %s", compressionCodec.get().name(), PAGEFILE.getOutputFormat()));
    }
    return new PagesSerde(blockEncodingSerde, Optional.ofNullable(pageCompressor), Optional.ofNullable(pageDecompressor), Optional.empty());
}
Also used : PageCompressor(com.facebook.presto.spi.page.PageCompressor) Lz4Compressor(io.airlift.compress.lz4.Lz4Compressor) DeflateCompressor(com.facebook.presto.orc.zlib.DeflateCompressor) PrestoException(com.facebook.presto.spi.PrestoException) SnappyDecompressor(io.airlift.compress.snappy.SnappyDecompressor) PagesSerde(com.facebook.presto.spi.page.PagesSerde) SnappyCompressor(io.airlift.compress.snappy.SnappyCompressor) Lz4Decompressor(io.airlift.compress.lz4.Lz4Decompressor) InflateDecompressor(com.facebook.presto.orc.zlib.InflateDecompressor) ZstdJniDecompressor(com.facebook.presto.orc.zstd.ZstdJniDecompressor) ZstdJniCompressor(com.facebook.presto.orc.zstd.ZstdJniCompressor) PageDecompressor(com.facebook.presto.spi.page.PageDecompressor)

Example 3 with SnappyDecompressor

use of io.airlift.compress.snappy.SnappyDecompressor in project presto by prestodb.

the class ParquetCompressionUtils method decompressSnappy.

private static Slice decompressSnappy(Slice input, int uncompressedSize) {
    byte[] buffer = new byte[uncompressedSize];
    decompress(new SnappyDecompressor(), input, 0, input.length(), buffer, 0);
    return wrappedBuffer(buffer);
}
Also used : SnappyDecompressor(io.airlift.compress.snappy.SnappyDecompressor)

Aggregations

SnappyDecompressor (io.airlift.compress.snappy.SnappyDecompressor)3 DeflateCompressor (com.facebook.presto.orc.zlib.DeflateCompressor)1 InflateDecompressor (com.facebook.presto.orc.zlib.InflateDecompressor)1 ZstdJniCompressor (com.facebook.presto.orc.zstd.ZstdJniCompressor)1 ZstdJniDecompressor (com.facebook.presto.orc.zstd.ZstdJniDecompressor)1 PrestoException (com.facebook.presto.spi.PrestoException)1 PageCompressor (com.facebook.presto.spi.page.PageCompressor)1 PageDecompressor (com.facebook.presto.spi.page.PageDecompressor)1 PagesSerde (com.facebook.presto.spi.page.PagesSerde)1 Lz4Compressor (io.airlift.compress.lz4.Lz4Compressor)1 Lz4Decompressor (io.airlift.compress.lz4.Lz4Decompressor)1 SnappyCompressor (io.airlift.compress.snappy.SnappyCompressor)1