Expand description
The durable form of an LIR dataflow.
A PinnedDataflow holds the durable plan for a dataflow. It is the
root of the stable LIR schema traced in tests/lir_schema.rs, so every
type reachable from it is part of the frozen serialization surface.
We try to avoid pinning things that can be re-derived from the catalog when loading the plan. This means keeping track of assumptions about inputs but only the wiring for outputs. The rest can be recomputed.
Loading a pinned plan is called instantiation, and it is done by means
of an InstantiationContext.
Only dataflows behind catalog items can be pinned: indexes, materialized
views, and metric sinks. Subscribes and one-shot copies have no durable
identity to pin under, and the TryFrom conversion rejects them, along
with any export under a transient id (a peek’s index, a curated metric
sink) and a dataflow that exports nothing.
TryFrom also rejects a dataflow that imports or exports a builtin
collection. Builtins keep their ids across releases while their schemas
and definitions change, and the plan inlines the bodies of builtin views,
which instantiation cannot check.
Index keys are stored as LirScalarExpr and converted back to
MirScalarExpr on instantiation. LIR scalars are a subset of MIR scalars,
so that direction is total, and DataflowDescription keeps its MIR-typed
index keys for the optimizer’s benefit. Source operators are already an
MfpPlan over LIR expressions in a lowered description and are stored
as they are.
The stored form is JSON, whose map keys must be strings. Maps keyed by
GlobalId serialize their keys through GlobalIdKey, the id’s string
form.
Modules§
- global_
id_ 🔒keys - Serializes a
GlobalId-keyed map withGlobalIdKeykeys.
Structs§
- Global
IdKey - A
GlobalIdin its string form (u1,s2,t3), for use as a map key. - Index
Info - The catalog facts an index import is checked against and an index export is rebuilt from.
- Materialized
View Info - The catalog facts an exported materialized view sink is rebuilt from.
- Metric
Sink Info - The catalog facts an exported metric sink is rebuilt from.
- Pinned
Dataflow - A pinned LIR plan: the optimizer’s decisions for one dataflow.
- Pinned
Index Import - The plan’s assumptions about an imported index.
- Pinned
Sink - The wiring of an exported sink. Its descriptor is rebuilt from the catalog.
- Pinned
Source Import - The plan’s assumptions about an imported source.
Enums§
- Instantiate
Error - Why a
PinnedDataflowcould not be instantiated. - PinError
- Why a
DataflowDescriptioncould not be pinned. - Pinned
Sink Kind - The kinds of sink a pinned dataflow may export.
Traits§
- Instantiation
Context - What
PinnedDataflow::instantiateneeds from its environment: catalog facts about the plan’s imports and exports, looked up by id, and fresh transient ids. Each lookup returnsNonewhen no item of that kind exists.