name: op-agg-constant
description: One typed constant in every row, group, crosstab cell and margin; fieldless.
kind: operator
category: AGG
operator: AGG_CONSTANT
type: reference
applies_to: process, compose, predict
examples_tags: [comparison, financial, streaming-friendly]
Use when
Puts one fixed value, such as a target or a reference figure, into every result row, group and table cell.
Questions it answers:
- Can the result carry the sales target next to each region’s actual sales?
- Can every row show the reference date the figures were cut on?
Use something else:
ATTR_FORMULAwhen the value differs from row to row.AGG_SUMwhen you want a figure computed from the data.
Params
| Name | Type | Default | Description |
|---|---|---|---|
type | enum | (required) | A field-type name (manifest cohort_types). |
value | any | — | Literal judged against type; null emits null. |
expr | string | — | Scalar expression, evaluated once before the run. |
Give EXACTLY ONE of value / expr (exactly_one_of: constant). value is always a literal: integer in range (u64 ≤ 2^53), finite number (f32 rounds through float32), true/false, "YYYY-MM-DD", RFC 3339 with offset (whole seconds), exact decimal string, a label, distinct member labels (set_*), 2–1024 numbers (vec_*). expr (params.x, coef(), sweep_axis(), lookup(), …) only for u*, f*, packed_bool, date, datetime; predict folds a read of a loaded models entry (range-checked), lists any other bound read in unresolved_scalars.
Inputs
None: no field, vector or fields; a label is required.
Output
As existing aggregators write the type: a number (date epoch days, datetime epoch seconds, packed_bool 0/1), a decimal string at the literal’s scale, a label, a label list, a number array. Same value in every group, cell and margin.
Components
Floor only: n = records reaching the slot, n_null 0.
Contract
- Types: reads no field; naming one is
PROCESSING_CONFIG. - Weight: not read; a weight in force is skipped.
- Streaming: streamable; components
mergeable. - Components:
n,n_null.
Gotchas
PROCESSING_CONFIGdetails.reason:field_not_accepted,label_missing,type_invalid,value_and_expr,value_missing,value_invalid,expr_type_unsupported,expr_out_of_range,expr_*.- No weight: a slot
weightisweight_not_accepted; a request weight skips it. Return.precisionrounds it as a measure, never as a count.
See
pulse_examples_search tags=[comparison, financial]- Skills:
aggregation-design,response-components