Expand description
The formula compiler: core_model::Formula -> TypedExpr -> PlanNode.
Phase 1 of AGENT_STEERING.md. Two passes:
infer— walk the AST, infer value type + dimension for each node, resolving measure references against the model’s measure metadata. Catches structural errors (dimension mismatch) and type errors.build_plan— lower the typed tree to aPlanNodegraph, insertingJoinnodes to align operand dimensions andAggregatenodes for aggregation functions.
IMPLEMENTED. This file defines the public API contract and both passes.
Structs§
- Compile
Context - Read-only context for compilation: the model’s measures, and its categories (their items’ order and names) when the caller has a model.
Enums§
Constants§
- FIXPOINT_
MAX_ ITER - The most rounds a
FIXPOINTmay run: itsmax_iteris at most this.
Functions§
- build_
plan - Pass 2: lower a typed expression to a plan.
- compile_
formula - Compile a formula for
targetmeasure into an operator plan. - derived_
shape - The shape a new derived measure
targetnamednametakes from its formula: its value type and its categories, as the engine computes them (anOVERdrops categories,@ITEMis text,DATEa date). A formula that reads the measure itself (aPREVrecurrence) is typed with a provisional measure over the categories of the other measures it reads. - infer
- Pass 1: type + dimension inference.
- scalar_
arity - The number of arguments a scalar (non-aggregating, non-lazy) built-in
takes when that number is fixed;
Nonefor an unknown id. Kept for callers that only need “is this an element-wise built-in”.