pub struct Prefix<T> where
    T: NumberLike
{ pub count: usize, pub code: Vec<bool>, pub lower: T, pub upper: T, pub run_len_jumpstart: Option<usize>, }
Expand description

A pairing of a Huffman code with a numerical range.

Quantile Compression works by splitting the distribution of numbers into ranges and associating a Huffman code (a short sequence of bits) with each range. The combination of these pieces of information, plus a couple others, is called a Prefix. When compressing a number, the compressor finds the prefix containing it, then writes out its Huffman code, optionally the number of consecutive repetitions of that number if run_length_jumpstart is available, and then the exact offset within the range for the number.

Fields

count: usize

The count of numbers in the chunk that fall into this Prefix’s range.

code: Vec<bool>

The Huffman code for this prefix. Collectively, all the prefixes for a chunk form a binary search tree (BST) over these Huffman codes. The BST over Huffman codes is different from the BST over numerical ranges.

lower: T

The lower bound for this prefix’s numerical range.

upper: T

The upper bound (inclusive) for this prefix’s numerical range.

run_len_jumpstart: Option<usize>

A parameter used for the most common prefix in a sparse distribution. For instance, if 90% of a chunk’s numbers are exactly 77, then the prefix for the range [0, 0] will have a run_len_jumpstart. The jumpstart value tunes the varint encoding of the number of consecutive repetitions of the prefix.

Trait Implementations

Returns a copy of the value. Read more

Performs copy-assignment from source. Read more

Formats the value using the given formatter. Read more

Formats the value using the given formatter. Read more

This method tests for self and other values to be equal, and is used by ==. Read more

This method tests for !=.

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more

Immutably borrows from an owned value. Read more

Mutably borrows from an owned value. Read more

Returns the argument unchanged.

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

The resulting type after obtaining ownership.

Creates owned data from borrowed data, usually by cloning. Read more

🔬 This is a nightly-only experimental API. (toowned_clone_into)

Uses borrowed data to replace owned data, usually by cloning. Read more

Converts the given value to a String. Read more

The type returned in the event of a conversion error.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.