Struct ScalarProjection
pub struct ScalarProjection {
pub col: usize,
pub identity: OwnedValue,
}Expand description
A scalar projection annotation on a relationship slot (REDUCE-DESIGN.md
§9, Tier 1). A relationship aggregate — issue { commentCount: count(comments) }
— lives in the engine tree as an ordinary singular one-row relationship whose
child is the synthetic aggregate row [group_key…, agg]. This annotation tells
the presentation boundary (the View marshaller and every wire receiver) to
unwrap that one-row child into a plain scalar field named after the
relationship: instead of commentCount: [{ issueID: 1, count: 5 }] the consumer
sees commentCount: 5. It is purely a result-shape concern — the dataflow and the
reconstructed tree stay a plural relationship of one row.
Fields§
§col: usizeWhich child column to surface as the scalar value (the aggregate column —
count in [issueID, count]). Indexed into the child schema’s columns.
identity: OwnedValueThe value to substitute when the relationship is empty — a childless
parent has no group in the reduce, so the projection emits the aggregate’s
identity (0 for count, NULL for sum/avg), the boundary analogue of
SQL’s LEFT JOIN … count → 0 (REDUCE-DESIGN.md §9). Without this an absent
group would render as null, which is wrong for count.
Trait Implementations§
§impl Clone for ScalarProjection
impl Clone for ScalarProjection
§fn clone(&self) -> ScalarProjection
fn clone(&self) -> ScalarProjection
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more