Class CompressionCodec
java.lang.Object
dev.frostlake.functions.scalar.encoding.CompressionCodec
The four compression algorithms behind
COMPRESS / DECOMPRESS_STRING /
DECOMPRESS_BINARY.
Byte fidelity against a live Snowflake account (probed, see
CompressionByteFidelityTest for the captured values):
- snappy — byte-identical (raw Snappy block format, no framing).
- zlib — byte-identical on every probed input at the default level and at levels 2-9; level 1 and some longer inputs differ because Snowflake's deflate implementation makes different match choices. The output is always a well-formed zlib stream either way.
- zstd — byte-identical at the default level once the frame's content checksum is
stripped (see
stripZstdContentChecksum(byte[])); Snowflake does not emit one and aircompressor always does. Explicit levels are accepted but cannot be honoured — aircompressor exposes no level knob — sozstd(19)produces the default-level frame. Still round-trip compatible in both directions. - bz2 — round-trip compatible only, never byte-identical: aircompressor's Huffman
table selection differs from Snowflake's, and its block size is fixed at 9 whereas
Snowflake defaults to 5. Verified live that Snowflake decompresses our
BZh9output and that we decompress itsBZh5output.
-
Method Summary
Modifier and TypeMethodDescriptionstatic byte[]compress(byte[] input, CompressionMethod method) static byte[]decompress(byte[] compressed, CompressionMethod method)
-
Method Details
-
compress
-
decompress
-