1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
//! Hash trie iterator family — counterpart to `TrieIterator` for hash-trie
//! join algorithms. Iterators expose hashes (not sorted keys) and navigate
//! via exact hash lookup rather than least-upper-bound seek.
//!
//! See SIGMOD 2020 "Combining Worst-Case Optimal and Traditional Binary
//! Join Processing" §3.2 for the conceptual interface (Table 1).
use crateJoinIterable;
/// Iterator over a hash trie. Navigates nested hash tables level by level.
///
/// # Position model
///
/// Conceptually, the iterator points to a single bucket within one of the
/// nodes of a hash trie. The bucket either holds a child hash table (inner
/// levels) or a tuple chain (the leaf level).
///
/// # Method semantics
///
/// - [`key`](Self::key) — hash at the current bucket, or `None` if at end / not
/// yet opened.
/// - [`next`](Self::next) — advance to the next occupied bucket; return its
/// hash.
/// - [`lookup`](Self::lookup) — move to the bucket with exact hash `hash`;
/// return whether one exists.
/// - [`size`](Self::size) — number of occupied buckets in the current node.
/// - [`at_end`](Self::at_end) — `true` iff positioned past the last occupied
/// bucket.
/// - [`open`](Self::open) — descend into the child node at the current bucket.
/// - [`up`](Self::up) — ascend to the parent node.
/// - [`leaf_tuples`](Self::leaf_tuples) — at the leaf level, the tuple chain at
/// the current bucket; `None` at inner levels.
///
/// # Not a `LinearIterator`
///
/// `LinearIterator::seek` has least-upper-bound semantics on sorted data.
/// Hash navigation is exact-match. The two contracts are incompatible, so
/// `HashTrieIterator` is a separate trait family rather than an extension.
/// Marker for types that expose a [`HashTrieIterator`].
///
/// The hash-trie counterpart of [`TrieIterable`](crate::TrieIterable). Note
/// that this trait does *not* require `IntoIterator<Item = Vec<usize>>` —
/// hash iteration over a single relation isn't naturally tuple-shaped (the
/// per-level key is a hash, not a value). Data structures implementing this
/// trait typically also provide their own depth-first tuple-materialization
/// helper for the `Projectable` impl.