Struct q_compress::Prefix
source · [−]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
sourceimpl<T: Clone> Clone for Prefix<T> where
T: NumberLike,
impl<T: Clone> Clone for Prefix<T> where
T: NumberLike,
sourceimpl<T: Debug> Debug for Prefix<T> where
T: NumberLike,
impl<T: Debug> Debug for Prefix<T> where
T: NumberLike,
sourceimpl<T: NumberLike> Display for Prefix<T>
impl<T: NumberLike> Display for Prefix<T>
impl<T: Eq> Eq for Prefix<T> where
T: NumberLike,
impl<T> StructuralEq for Prefix<T> where
T: NumberLike,
impl<T> StructuralPartialEq for Prefix<T> where
T: NumberLike,
Auto Trait Implementations
impl<T> RefUnwindSafe for Prefix<T> where
T: RefUnwindSafe,
impl<T> Send for Prefix<T> where
T: Send,
impl<T> Sync for Prefix<T> where
T: Sync,
impl<T> Unpin for Prefix<T> where
T: Unpin,
impl<T> UnwindSafe for Prefix<T> where
T: UnwindSafe,
Blanket Implementations
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
sourceimpl<T> ToOwned for T where
T: Clone,
impl<T> ToOwned for T where
T: Clone,
type Owned = T
type Owned = T
The resulting type after obtaining ownership.
sourcefn clone_into(&self, target: &mut T)
fn clone_into(&self, target: &mut T)
toowned_clone_into
)Uses borrowed data to replace owned data, usually by cloning. Read more