MCPcopy Create free account
hub / github.com/ClickHouse/ClickHouse / createWriteCompressedWrapper

Function createWriteCompressedWrapper

src/IO/CompressionMethod.cpp:172–201  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

170
171template<typename WriteBufferT>
172std::unique_ptr<WriteBuffer> createWriteCompressedWrapper(
173 WriteBufferT && nested, CompressionMethod method, int level, int zstd_window_log, size_t buf_size, char * existing_memory, size_t alignment, bool compress_empty)
174{
175 if (method == DB::CompressionMethod::Gzip || method == CompressionMethod::Zlib)
176 return std::make_unique<ZlibDeflatingWriteBuffer>(std::forward<WriteBufferT>(nested), method, level, buf_size, existing_memory, alignment, compress_empty);
177
178#if USE_BROTLI
179 if (method == DB::CompressionMethod::Brotli)
180 return std::make_unique<BrotliWriteBuffer>(std::forward<WriteBufferT>(nested), level, buf_size, existing_memory, alignment, compress_empty);
181#endif
182 if (method == CompressionMethod::Xz)
183 return std::make_unique<LZMADeflatingWriteBuffer>(std::forward<WriteBufferT>(nested), level, buf_size, existing_memory, alignment, compress_empty);
184
185 if (method == CompressionMethod::Zstd)
186 return std::make_unique<ZstdDeflatingWriteBuffer>(std::forward<WriteBufferT>(nested), level, zstd_window_log, buf_size, existing_memory, alignment, compress_empty);
187
188 if (method == CompressionMethod::Lz4)
189 return std::make_unique<Lz4DeflatingWriteBuffer>(std::forward<WriteBufferT>(nested), level, buf_size, existing_memory, alignment, compress_empty);
190
191#if USE_BZIP2
192 if (method == CompressionMethod::Bzip2)
193 return std::make_unique<Bzip2WriteBuffer>(std::forward<WriteBufferT>(nested), level, buf_size, existing_memory, alignment, compress_empty);
194#endif
195#if USE_SNAPPY
196 if (method == CompressionMethod::Snappy)
197 throw Exception(ErrorCodes::NOT_IMPLEMENTED, "Unsupported compression method");
198#endif
199
200 throw Exception(ErrorCodes::NOT_IMPLEMENTED, "Unsupported compression method");
201}
202
203
204std::unique_ptr<WriteBuffer> wrapWriteBufferWithCompressionMethod(

Callers 1

Calls 1

ExceptionClass · 0.70

Tested by

no test coverage detected