Skip to main content

Module hash_table

Module hash_table 

Source
Expand description

Optimized hash table for join operations.

This module provides a specialized hash table designed for the build phase of hash joins. Key optimizations:

  1. Pre-allocated: Sized upfront based on build side cardinality
  2. Cache-efficient: Linear probing within cache lines
  3. Zero-allocation probe: Iterator returns indices without allocation
  4. Full hash stored: Quick rejection without row access

§Memory Layout

JoinHashTable
├── bucket_heads: Vec<i32>    [bucket_count]     // First entry index per bucket
├── entries: Vec<HashEntry>   [row_count]        // One per build row
└── bucket_mask: u64                             // For fast modulo

HashEntry (16 bytes, cache-aligned)
├── hash: u64     // Full hash for quick rejection
├── row_idx: u32  // Index into build rows
└── next: u32     // Next in chain (EMPTY = end)

Structs§

JoinHashState
Immutable build-side state shared by every probe consumer of one physical JOIN edge.
JoinHashTable
Optimized hash table for join operations.
ProbeCursor
Borrow-free position in one hash bucket chain.
ProbeIter
Zero-allocation iterator over probe results.

Traits§

JoinHashObserver
Minimal sink used while a JOIN hash table and a probe accelerator are populated in one pass. The optimizer owns the accelerator; the physical hash foundation depends only on this lifecycle-neutral contract.

Functions§

hash_keys_with
Hash values at given indices using a get function.
hash_row_keys
Hash row key columns into a single u64.
verify_key_equality
Verify that two rows have equal key values.