name: op-win-formula
description: Row-local expression over a result row's columns and earlier windows' outputs — e.g. the ratio or gap of two share columns in a gains table.
kind: operator
category: WIN
operator: WIN_FORMULA
type: reference
applies_to: process, compose, predict
examples_tags: [proportion-analysis, window-operator, buffered-pipeline]
Row-level output; no Response.Components.
Use when
Adds a number to every result row computed from that row’s columns and earlier windows, such as one share divided by another.
Questions it answers:
- What is each decile’s share of defaults minus its share of loans?
- What is each region’s revenue per order, next to its share of the total?
Use something else:
WIN_LIFTwhen you want one column’s share over another’s share, the lift of a gains table.
Params
| Name | Type | Default | Description |
|---|---|---|---|
expression | string | (required) | Expression returning a number over the row’s columns. |
Slots: label (default WIN_FORMULA). field, order_by, partition_by and frame are refused: it reads only its own row.
Inputs
Names in expression are the row’s columns at this window’s turn (group keys and aggregation labels on grouped rows, record fields on record rows) plus every EARLIER window’s label. params.<name> reads request params; embedder functions, lookup() and range_label() work.
Output
One float64 per row on label: s_events / s_n over two earlier share labels is the decile’s lift.
Contract
- Types: reads no field; naming one is
PULSE_WINDOW_INVALID. - Weight: no weighted form and no slot weight; a request weight is
PROCESSING_CONFIG, an instance default is skipped. - Streaming: buffered only.
Gotchas
- A null input makes the row
null, never a run failure (x ?? 0never sees the nil); so does a nil or non-finite result (1/0). - Refused at predict and runtime alike, before any row: its own or a LATER window’s label (
PULSE_WINDOW_INVALIDreasonforward_reference), an unknown name (SERVICE_VALIDATION), a bool / string result,ref(),coef(),total()or bad syntax (PULSE_FORMULA_COMPILE_ERROR). - Cells are typed (a categorical or group key a string, a set union a label list, a set frequency a label→count map, Σw floats when its slot is weighted; a Welford triple read as
w.Mean; a decimal a number):region * 2is refused before any row. An extension grouper’s or aggregator’s cell is untyped: it fails the run (PROCESSING_RUNTIME). - Not weightable (request
weight→PROCESSING_CONFIG); buffered.
See
pulse_examples_search tags=[proportion-analysis, window-operator]- Skills:
window-design,op-win-share,op-win-lift,op-attr-formula