Documentation
¶
Overview ¶
Package encoding implements the per-page value encodings that run before the block codec, the encode stage of the page pipeline pinned in the format spec. It is the heart of tatami's compact story: each encoding removes a kind of structured redundancy (narrow ranges, runs, monotonic steps) that a general block compressor would otherwise have to rediscover byte by byte.
The package is deliberately physical and self-contained. It does not import the root tatami package and knows nothing of logical types or nulls. Integer encodings work on a dense []uint64 of present values (the caller widens its typed slice and handles nulls one level up), bool works on a []bool, and the FOR base is chosen in signed or unsigned order as the caller asks. Every encoder round-trips: Decode(Encode(vs)) == vs for any input including the empty slice.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func DecodeBitmap ¶
DecodeBitmap reads len(out) bools packed by EncodeBitmap.
func DecodeInts ¶
DecodeInts decodes count values (len(out)) of encoding id into out.
func EncodeBitmap ¶
EncodeBitmap packs bools into ceil(n/8) bytes, bit i of byte i/8 holding vs[i] with the least significant bit first. This is the natural encoding for a dense boolean column: one bit per value, which zstd then squeezes further when the column is mostly one value.
func EncodeInts ¶
EncodeInts encodes vs with the given encoding and returns the payload and whether the encoding applies. GROUPVARINT and PFORDELTA only apply when every value fits in 32 bits, and PFORDELTA additionally needs at most 256 values so its one-byte exception positions stay in range; the sampler skips them otherwise. BITPACK_FOR, DELTA, and RLE apply to any input.