pub struct HashTrie<H: HashStrategy = SipHashStrategy> { /* private fields */ }Expand description
A hash trie. Each path from root to leaf corresponds to one tuple’s hash signature; tuples sharing a complete signature (collisions on every attribute) collect into a chain at the leaf — verification of actual key equality is deferred to the join algorithm.
§Invariants
- The depth of every root-to-leaf path equals
header.arity(). - Inner nodes exist at depths
0..arity-1; the leaf node at deptharity-1. - For arity = 0: undefined behavior (no nullary relations supported).
§Construction
Use from_tuples (batch) or new followed by insert (incremental).
Both funnel through insert for a single tuple, faithful to
Algorithm 2 from the paper.
§Layout parameter
H is a HashStrategy selecting which hash function is used to
convert attribute values to u64. Defaults to
SipHashStrategy for backwards compatibility with pre-standard code.
Implementations§
Source§impl<H: HashStrategy> HashTrie<H>
impl<H: HashStrategy> HashTrie<H>
Sourcepub fn collect_tuples(&self) -> Vec<Vec<usize>>
pub fn collect_tuples(&self) -> Vec<Vec<usize>>
Walk the trie depth-first and return every materialized tuple.
Used by crate::relation::Projectable::project, the CLI’s
bench machinery (which needs to recover tuples from an
already-built relation for the insertion-benchmark closure),
and tests. Allocates a fresh Vec<Vec<usize>>; for large
relations this is O(n · arity) in both time and space.
Trait Implementations§
Source§impl<H: HashStrategy> HasOptimizationAxes for HashTrie<H>
impl<H: HashStrategy> HasOptimizationAxes for HashTrie<H>
Source§impl<H: HashStrategy> HashTrieIterable for HashTrie<H>
impl<H: HashStrategy> HashTrieIterable for HashTrie<H>
Source§fn hash_trie_iter(&self) -> impl HashTrieIterator
fn hash_trie_iter(&self) -> impl HashTrieIterator
HashTrieIterator over this structure.Source§impl<H: HashStrategy> HeapSize for HashTrie<H>
impl<H: HashStrategy> HeapSize for HashTrie<H>
Source§fn heap_size_bytes(&self) -> usize
fn heap_size_bytes(&self) -> usize
impl<H: HashStrategy> JoinIterable for HashTrie<H>
Source§impl<H: HashStrategy> Projectable for HashTrie<H>
impl<H: HashStrategy> Projectable for HashTrie<H>
Source§impl<H: HashStrategy> Relation for HashTrie<H>
impl<H: HashStrategy> Relation for HashTrie<H>
Source§fn header(&self) -> &RelationHeader
fn header(&self) -> &RelationHeader
Source§fn new(header: RelationHeader) -> Self
fn new(header: RelationHeader) -> Self
header.Source§fn from_tuples(header: RelationHeader, tuples: Vec<Vec<usize>>) -> Self
fn from_tuples(header: RelationHeader, tuples: Vec<Vec<usize>>) -> Self
tuples, matching header.
Implementations may sort or deduplicate during bulk construction;
prefer this over new followed by repeated insert calls when all
tuples are known up front. Read more