Skip to main content

Module compression

Module compression 

Source
Expand description

LZ4 and ZSTD block compression. LZ4 and ZSTD block compression for the ClickHouse native protocol.

Each compressed frame has the following wire format:

[16 bytes CityHash128 checksum][1 byte method][4 bytes compressed_size][4 bytes uncompressed_size][compressed data]

The compress function produces a complete frame (checksum + header + data). The decompress function accepts a complete frame and returns the uncompressed payload.

Functionsยง

compress
Compress data using the specified method.
decompress
Decompress data (auto-detects compression method from header).