|
| uint64_t | zigzag_encode (int64_t n) |
| | Zigzag-encode a signed 64-bit integer to an unsigned representation.
|
| |
| uint32_t | zigzag_encode32 (int32_t n) |
| | Zigzag-encode a signed 32-bit integer to an unsigned representation.
|
| |
| int64_t | zigzag_decode (uint64_t v) |
| | Zigzag-decode an unsigned 64-bit integer back to its signed representation.
|
| |
| int32_t | zigzag_decode32 (uint32_t v) |
| | Zigzag-decode an unsigned 32-bit integer back to its signed representation.
|
| |
| size_t | encode_uvarint (std::vector< uint8_t > &buf, uint64_t value) |
| | Encode an unsigned varint (LEB128) into a byte buffer.
|
| |
| uint64_t | decode_uvarint (const uint8_t *data, size_t &pos, size_t size) |
| | Decode an unsigned varint (LEB128) from a byte buffer.
|
| |
| int | bit_width_for (uint64_t value) |
| | Compute the minimum number of bits required to represent an unsigned value.
|
| |
| void | bit_pack_values (std::vector< uint8_t > &out, const uint64_t *values, size_t count, int bit_width) |
| | Bit-pack an arbitrary number of values at a given bit width.
|
| |
| void | bit_unpack_values (const uint8_t *src, uint64_t *values, size_t count, int bit_width) |
| | Unpack an arbitrary number of values at a given bit width from packed data.
|
| |
| std::vector< uint8_t > | encode_int64 (const int64_t *values, size_t count) |
| | Encode int64 values using the DELTA_BINARY_PACKED algorithm.
|
| |
| std::vector< uint8_t > | encode_int32 (const int32_t *values, size_t count) |
| | Encode int32 values using the DELTA_BINARY_PACKED algorithm.
|
| |
| std::vector< int64_t > | decode_int64 (const uint8_t *data, size_t size, size_t num_values) |
| | Decode DELTA_BINARY_PACKED data back to int64 values.
|
| |
| std::vector< int32_t > | decode_int32 (const uint8_t *data, size_t size, size_t num_values) |
| | Decode DELTA_BINARY_PACKED data back to int32 values.
|
| |
| void signet::forge::delta::bit_pack_values |
( |
std::vector< uint8_t > & |
out, |
|
|
const uint64_t * |
values, |
|
|
size_t |
count, |
|
|
int |
bit_width |
|
) |
| |
|
inline |
Bit-pack an arbitrary number of values at a given bit width.
Appends ceil(count * bit_width / 8) bytes to out, packing each value LSB-first. Typically used to pack one miniblock of VALUES_PER_MINIBLOCK (32) delta-adjusted values. If bit_width is 0, no bytes are emitted.
- Parameters
-
| out | Output byte buffer to append packed data to. |
| values | Pointer to count unsigned values to pack. |
| count | Number of values (typically 32 for a miniblock). |
| bit_width | Bits per value (0–64). |
- See also
- bit_unpack_values
Definition at line 204 of file delta.hpp.
| std::vector< int64_t > signet::forge::delta::decode_int64 |
( |
const uint8_t * |
data, |
|
|
size_t |
size, |
|
|
size_t |
num_values |
|
) |
| |
|
inline |
Decode DELTA_BINARY_PACKED data back to int64 values.
Parses the block header (block_size, miniblock_count, total_count, first_value), then iterates through blocks and miniblocks, unpacking bit-packed adjusted deltas and reconstructing original values. Includes overflow protection: returns a partial result on integer overflow or corrupt bit widths.
- Parameters
-
| data | Pointer to the encoded DELTA_BINARY_PACKED payload. |
| size | Size of the encoded data in bytes. |
| num_values | Number of values to decode (from the Parquet page header). |
- Returns
- Decoded int64 values (may be fewer than
num_values on truncated or corrupt input).
- Note
- The
total_value_count in the header is ignored; the caller-supplied num_values is authoritative.
- See also
- encode_int64, decode_int32
Definition at line 438 of file delta.hpp.
| std::vector< uint8_t > signet::forge::delta::encode_int64 |
( |
const int64_t * |
values, |
|
|
size_t |
count |
|
) |
| |
|
inline |
Encode int64 values using the DELTA_BINARY_PACKED algorithm.
Computes successive deltas, partitions them into blocks of DEFAULT_BLOCK_SIZE, each subdivided into DEFAULT_MINIBLOCK_COUNT miniblocks, and bit-packs the adjusted deltas (delta - min_delta) per miniblock. Achieves excellent compression on sorted or near-monotonic sequences (timestamps, IDs).
- Parameters
-
| values | Pointer to the input int64 values. |
| count | Number of values to encode. |
- Returns
- Encoded byte buffer containing the DELTA_BINARY_PACKED payload.
- Note
- For count == 0, returns a valid header with total_count = 0.
- See also
- decode_int64, encode_int32
Definition at line 298 of file delta.hpp.