Skip to main content

HashTrie

Struct HashTrie 

Source
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 depth arity-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>

Source

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>

Source§

fn optimization_axes(&self) -> BTreeMap<String, Value>

One layout axis: ds_layout_hasher carrying the strategy’s LayoutOption::NAME (e.g. "sip" / "fxhash").

Source§

impl<H: HashStrategy> HashTrieIterable for HashTrie<H>

Source§

fn hash_trie_iter(&self) -> impl HashTrieIterator

Returns a HashTrieIterator over this structure.
Source§

impl<H: HashStrategy> HeapSize for HashTrie<H>

Source§

fn heap_size_bytes(&self) -> usize

Returns the total number of bytes this value owns on the heap. Read more
Source§

impl<H: HashStrategy> JoinIterable for HashTrie<H>

Source§

impl<H: HashStrategy> Projectable for HashTrie<H>

Source§

fn project(&self, columns: Vec<usize>) -> Self

Returns a new relation containing only the columns at the given indices, in the order supplied. Read more
Source§

impl<H: HashStrategy> Relation for HashTrie<H>

Source§

fn header(&self) -> &RelationHeader

Returns the header describing this relation’s name, attributes, and arity.
Source§

fn new(header: RelationHeader) -> Self

Creates an empty relation matching header.
Source§

fn from_tuples(header: RelationHeader, tuples: Vec<Vec<usize>>) -> Self

Creates a relation populated with 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
Source§

fn insert(&mut self, tuple: Vec<usize>)

Inserts a tuple. Duplicate tuples are silently absorbed (the relation behaves as a set). Read more
Source§

fn insert_all(&mut self, tuples: Vec<Vec<usize>>)

Inserts every tuple in tuples. Equivalent to calling insert in a loop; provided so implementations can specialise bulk insertion. Read more

Auto Trait Implementations§

§

impl<H> Freeze for HashTrie<H>
where PhantomData<H>: Freeze,

§

impl<H> RefUnwindSafe for HashTrie<H>

§

impl<H> Send for HashTrie<H>
where PhantomData<H>: Send,

§

impl<H> Sync for HashTrie<H>
where PhantomData<H>: Sync,

§

impl<H> Unpin for HashTrie<H>
where PhantomData<H>: Unpin,

§

impl<H> UnsafeUnpin for HashTrie<H>

§

impl<H> UnwindSafe for HashTrie<H>

Blanket Implementations§

Source§

impl<T> Allocation for T
where T: RefUnwindSafe + Send + Sync,

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

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

Source§

impl<T> Read<Exclusive, BecauseExclusive> for T
where T: ?Sized,

Source§

impl<R> RelationFileExt for R
where R: Relation,

Source§

fn from_csv<P>(filepath: P) -> Result<R, RelationError>
where P: AsRef<Path>,

Creates a new relation from a CSV file. Read more
Source§

fn from_parquet<P>(filepath: P) -> Result<R, RelationError>
where P: AsRef<Path>,

Creates a new relation from a Parquet file. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.