Skip to main content

map_arithmetic_literal

Function map_arithmetic_literal 

Source
pub(crate) fn map_arithmetic_literal(
    schema: &SeriesSchema,
    series: &Series,
    op: ArithmeticOp,
    scalar: ScalarOperand,
) -> Result<(Series, bool)>
Expand description

Applies literal scalar arithmetic to float and histogram samples. Float-only series retain the original kernel unchanged; histogram-capable fields are traversed sample-by-sample.

The second element of the answer reports whether a histogram sample was dropped because the operation has no histogram form — 2 / h, or h + 1, which Prometheus answers by dropping the sample rather than failing the query. The caller records the info; this kernel is also used on paths that hold no collector.