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);
}
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());
}
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);
}
Aggregations