Module canon
Expand description
The canonical value-equivalence key (CanonVal /
CanonKey) — the join family’s grouping key, the limiters’
partition identity, and a parameterized query family’s binding (design 310, D1).
Lives in rindle-value (below the engine, so rindle-wire can name it) and is
re-exported here as the rindle::canon namespace.
The canonical value-equivalence key — CanonVal / CanonKey — one Hash + Eq
encoding of the engine’s exact equality class, shared by every consumer that must
agree on “these two cells are the same value”:
- the join family’s grouping and the join membership pre-check (
rindle’sop/join_util.rs, where this type was born ascanonicalValue,flipped-join.ts:600); - the partitioned limiters’ state keys (
op/partition.rsfolds an integralFloatto itsIntthe same wayCanonVal::ofdoes); - a parameterized query family’s binding (design 310, D1): the literal a
subscriber bound (
rindle-wire’sFamilyKeyextraction), the engine’s partition membership test (a row cell), and the daemon’s per-partition demux (a root row cell) must agree exactly, and one type is the only way to make that structural rather than tested.
It lives in this dependency-free crate — below the engine — because rindle-wire
cannot see a pub(crate) item in rindle, and because the encoding is a property
of the value vocabulary, not of any operator.
Numerics canonicalize by their exact equality class (design 226 §5.4,
float_int_class): a finite, integral, in-i64-range, non--0.0 Float shares
Int’s key — so Int(1) and Float(1.0) group together, exactly when
values_equal says they are equal. Every other float
keeps f64::to_bits identity, matching total_cmp’s classes (the -0.0/0.0 and
NaN-payload distinctions the engine makes). Null gets its own token: two null cells
share a key, which is what a partition wants (null == null under the sort
comparator) and harmless for a join (a null-keyed parent misses every non-null
child group and is never spuriously joined — values_equal says null != null).
Enums§
- Canon
Val - One column of a
CanonKey— a type-tagged,Hash + Eqvalue. The tag is the variant itself, soInt(1)andStr("1")are distinct keys (the JS prefixes a type char; the Rust enum carries the type for free).
Functions§
- canonical_
key - The
CanonKeyofrowover thekeycolumns, inkeyorder. - canonical_
key_ of_ constraint - Canonical key over a
(ColId, OwnedValue)constraint’s values, in constraint order. For a join constraint built into_keyorder this agrees withcanonical_key(parent_row, to_key)for any parent the constraint matches — the two sides a flipped join compares to group each child under its parent’s IN-batch entry.
Type Aliases§
- Canon
Key - A canonical key over a compound column tuple (
canonicalKey,flipped-join.ts:585): a join’s correlation key, a limiter’s partition tuple, or a family’s binding.Hash + Eq, so it keys a grouping map directly — no per-rowStringalloc (the JS concatenates a tagged string; the typed tuple is the faster, exact Rust form).