pub struct Aggregate {
pub table: TableName,
pub op: AggregateOp,
pub key: AggregateKey,
pub value_type: Option<FlussoType>,
pub filters: Option<Vec<Filter>>,
pub distinct: bool,
pub via: Vec<ViaHop>,
pub on: Vec<ColumnPair>,
}Expand description
Reduces rows from a related table to a single value — a count, sum,
extreme, or existence flag. The key connects the tables; filters
restrict which rows of table count; via reaches table across the
tables in between.
Fields§
§table: TableName§op: AggregateOp§key: AggregateKey§value_type: Option<FlussoType>The declared result type. Fixed for count (long) and avg (double)
and left None; required for sum / min / max, whose result mirrors
the aggregated column and so must be stated to stay database-free.
filters: Option<Vec<Filter>>§distinct: boolOver a junction: count each target row once instead of once per
junction row. Only valid with an AggregateKey::Through key.
via: Vec<ViaHop>The tables between the parent and table, in order from the parent.
Empty for a one-hop aggregate. When set, the key points
at the last hop’s table instead of the parent.
on: Vec<ColumnPair>Extra column equalities between the aggregated rows and the table
before them (the parent, or the last via hop), ANDed with the key.
Only with an AggregateKey::Direct key.