| 133 | } |
| 134 | |
| 135 | static std::unique_ptr<CompressedReadBufferWrapper> createCompressedWrapper( |
| 136 | std::unique_ptr<ReadBuffer> nested, CompressionMethod method, size_t buf_size, char * existing_memory, size_t alignment, int zstd_window_log_max) |
| 137 | { |
| 138 | if (method == CompressionMethod::Gzip || method == CompressionMethod::Zlib) |
| 139 | return std::make_unique<ZlibInflatingReadBuffer>(std::move(nested), method, buf_size, existing_memory, alignment); |
| 140 | #if USE_BROTLI |
| 141 | if (method == CompressionMethod::Brotli) |
| 142 | return std::make_unique<BrotliReadBuffer>(std::move(nested), buf_size, existing_memory, alignment); |
| 143 | #endif |
| 144 | if (method == CompressionMethod::Xz) |
| 145 | return std::make_unique<LZMAInflatingReadBuffer>(std::move(nested), buf_size, existing_memory, alignment); |
| 146 | if (method == CompressionMethod::Zstd) |
| 147 | return std::make_unique<ZstdInflatingReadBuffer>(std::move(nested), buf_size, existing_memory, alignment, zstd_window_log_max); |
| 148 | if (method == CompressionMethod::Lz4) |
| 149 | return std::make_unique<Lz4InflatingReadBuffer>(std::move(nested), buf_size, existing_memory, alignment); |
| 150 | #if USE_BZIP2 |
| 151 | if (method == CompressionMethod::Bzip2) |
| 152 | return std::make_unique<Bzip2ReadBuffer>(std::move(nested), buf_size, existing_memory, alignment); |
| 153 | #endif |
| 154 | #if USE_SNAPPY |
| 155 | if (method == CompressionMethod::Snappy) |
| 156 | return std::make_unique<HadoopSnappyReadBuffer>(std::move(nested), buf_size, existing_memory, alignment); |
| 157 | #endif |
| 158 | |
| 159 | throw Exception(ErrorCodes::NOT_IMPLEMENTED, "Unsupported compression method"); |
| 160 | } |
| 161 | |
| 162 | std::unique_ptr<ReadBuffer> wrapReadBufferWithCompressionMethod( |
| 163 | std::unique_ptr<ReadBuffer> nested, CompressionMethod method, int zstd_window_log_max, size_t buf_size, char * existing_memory, size_t alignment) |
no test coverage detected