Documentation
¶
Index ¶
- func BitpackDecode(data []byte) ([]uint8, error)
- func BitpackEncode(indices []uint8, bitsPerValue int) []byte
- func BitsNeeded(n int) int
- func Compress(src []byte) []byte
- func DecodeUvarintSlice(data []byte, count int) ([]uint64, error)
- func DecodeVarintSlice(data []byte, count int) ([]int64, error)
- func Decompress(src []byte) ([]byte, error)
- func DeltaDecode(data []byte, count int) ([]int64, error)
- func DeltaEncode(values []int64) []byte
- func DictLookup(d *DictEncoded) []string
- func DictMarshal(d *DictEncoded) []byte
- func EncodeUvarintSlice(values []uint64) []byte
- func EncodeVarintSlice(values []int64) []byte
- func Float64ToInt64(f float64) int64
- func Int64ToFloat64(i int64) float64
- func PutUvarint(dst []byte, v uint64) []byte
- func PutVarint(dst []byte, v int64) []byte
- func SparseBool(values []*bool) []byte
- func SparseBytes(values [][]byte) []byte
- func SparseInt64(values []*int64) []byte
- func SparseStrings(values []string) []byte
- func UnsparseBool(data []byte, count int) ([]*bool, error)
- func UnsparseBytes(data []byte, count int) ([][]byte, error)
- func UnsparseInt64(data []byte, count int) ([]*int64, error)
- func UnsparseStrings(data []byte, count int) ([]string, error)
- func ZigZagDecode(v uint64) int64
- func ZigZagEncode(v int64) uint64
- func ZstdBlockDecodeInt64(data []byte, count int) ([]int64, error)
- func ZstdBlockDecodeStrings(data []byte, count int) ([]string, error)
- func ZstdBlockEncodeInt64(values []int64) []byte
- func ZstdBlockEncodeStrings(values []string) []byte
- type DictEncoded
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func BitpackDecode ¶
BitpackDecode unpacks N-bit packed indices.
func BitpackEncode ¶
BitpackEncode packs uint8 indices into N bits per value. bitsPerValue must be 1-8. Returns: [1 byte bitsPerValue] [4 bytes count] [packed bits]
func BitsNeeded ¶
BitsNeeded returns the minimum number of bits to represent n distinct values.
func DecodeUvarintSlice ¶
DecodeUvarintSlice decodes zstd + uvarint encoded uint64 values.
func DecodeVarintSlice ¶
DecodeVarintSlice decodes zstd + varint encoded int64 values.
func DeltaDecode ¶
DeltaDecode decodes base + zigzag-varint deltas + zstd back to int64 values.
func DeltaEncode ¶
DeltaEncode encodes a slice of int64 values as base + zigzag-varint deltas + zstd. Returns: [8 bytes base] [zstd(zigzag-varint deltas)]
func DictLookup ¶
func DictLookup(d *DictEncoded) []string
DictLookup resolves dictionary indices back to strings.
func DictMarshal ¶
func DictMarshal(d *DictEncoded) []byte
DictMarshal serializes a DictEncoded to bytes + zstd. Format: [2 bytes dict_len] [dict entries: 2-byte len + string]... [zstd(uint16 indices)]
func EncodeUvarintSlice ¶
EncodeUvarintSlice encodes a slice of uint64 values as uvarints + zstd.
func EncodeVarintSlice ¶
EncodeVarintSlice encodes a slice of int64 values as varints + zstd.
func Float64ToInt64 ¶
Float64ToInt64 converts a float64 to int64 bits for storage.
func Int64ToFloat64 ¶
Int64ToFloat64 converts int64 bits back to float64.
func PutUvarint ¶
PutUvarint appends a uvarint-encoded uint64 to dst and returns the extended slice.
func SparseBool ¶
SparseBool encodes a slice of *bool where nil = null. Non-null values stored as a second bitmap.
func SparseBytes ¶
SparseBytes encodes a slice of []byte where nil = null. Used for body column (already compressed blobs).
func SparseInt64 ¶
SparseInt64 encodes a slice of *int64 where nil = null. Uses varint encoding for non-null values.
func SparseStrings ¶
SparseStrings encodes a slice of strings where empty string = null. Format: [4 bytes non_null_count] [bitmap bytes] [zstd(length-prefixed non-null strings)]
func UnsparseBool ¶
UnsparseBool decodes sparse bool column.
func UnsparseBytes ¶
UnsparseBytes decodes sparse byte slice column.
func UnsparseInt64 ¶
UnsparseInt64 decodes sparse int64 column.
func UnsparseStrings ¶
UnsparseStrings decodes sparse string column.
func ZigZagDecode ¶
ZigZagDecode converts a zigzag-encoded uint64 back to int64.
func ZigZagEncode ¶
ZigZagEncode converts a signed int64 to an unsigned uint64 using zigzag encoding. This makes small negative numbers small unsigned numbers (good for varint).
func ZstdBlockDecodeInt64 ¶
ZstdBlockDecodeInt64 decodes zstd + raw LE int64 values.
func ZstdBlockDecodeStrings ¶
ZstdBlockDecodeStrings decodes zstd + length-prefixed strings.
func ZstdBlockEncodeInt64 ¶
ZstdBlockEncodeInt64 encodes a slice of int64 as raw LE bytes + zstd. Used for ts column (not delta-encoded, may not be monotonic).
func ZstdBlockEncodeStrings ¶
ZstdBlockEncodeStrings encodes a slice of strings as length-prefixed + zstd.
Types ¶
type DictEncoded ¶
type DictEncoded struct {
Dict []string // ordered dictionary: index → string
Indices []uint16 // per-entry dictionary index
}
DictEncoded holds the result of dictionary encoding.
func DictEncode ¶
func DictEncode(values []string) *DictEncoded
DictEncode builds a dictionary from string values and returns indices. Null/empty strings are stored as index 0 with dict[0] = "".
func DictUnmarshal ¶
func DictUnmarshal(data []byte, count int) (*DictEncoded, error)
DictUnmarshal deserializes DictEncoded from bytes.