Skip to content

Functions

Pre-defined functions that can be used in select expressions across all metrics and segment definitions. These functions are defined in jetstream-config

agg_sum

Definition:
COALESCE(SUM({select_expr}), 0)

agg_any

Definition:
COALESCE(LOGICAL_OR({select_expr}), FALSE)

agg_histogram_mean

Definition:
SAFE_DIVIDE(
        SUM(CAST(JSON_EXTRACT_SCALAR({select_expr}, "$.sum") AS int64)),
        SUM((SELECT SUM(value) FROM UNNEST(mozfun.hist.extract({select_expr}).values)))
    )