Skip to content

Functions

metric-hub

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

agg_sum

Sum

Calculates the sum of the select expression

Definition:
functools.partial(<function FunctionsSpec.from_dict.<locals>.<dictcomp>.<lambda> at 0x7f45e98493f0>, definition='COALESCE(SUM({select_expr}), 0)')

agg_any

Any

Returns true if any of the boolean selected values are TRUE, otherwise FALSE

Definition:
functools.partial(<function FunctionsSpec.from_dict.<locals>.<dictcomp>.<lambda> at 0x7f45e9849360>, definition='COALESCE(LOGICAL_OR({select_expr}), FALSE)')

agg_histogram_mean

Histogram Mean

Computes the mean of the histogram

Definition:
functools.partial(<function FunctionsSpec.from_dict.<locals>.<dictcomp>.<lambda> at 0x7f45e98492d0>, definition='    SAFE_DIVIDE(\n        SUM(CAST(JSON_EXTRACT_SCALAR({select_expr}, "$.sum") AS int64)),\n        SUM((SELECT SUM(value) FROM UNNEST(mozfun.hist.extract({select_expr}).values)))\n    )\n')

agg_hist_zero_fract

Histogram Zero Fraction

Computes the fraction of entries in a Histogram which are zero

Definition:
functools.partial(<function FunctionsSpec.from_dict.<locals>.<dictcomp>.<lambda> at 0x7f45e9849240>, definition='    SAFE_DIVIDE(\n        SUM(mozfun.map.get_key(mozfun.hist.extract({select_expr}).values,0)),\n        SUM(mozfun.hist.threshold_count({select_expr},0))\n    )\n')

jetstream-config

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:
functools.partial(<function FunctionsSpec.from_dict.<locals>.<dictcomp>.<lambda> at 0x7f45e9849630>, definition='COALESCE(SUM({select_expr}), 0)')

agg_any

Definition:
functools.partial(<function FunctionsSpec.from_dict.<locals>.<dictcomp>.<lambda> at 0x7f45e98495a0>, definition='COALESCE(LOGICAL_OR({select_expr}), FALSE)')

agg_histogram_mean

Definition:
functools.partial(<function FunctionsSpec.from_dict.<locals>.<dictcomp>.<lambda> at 0x7f45e9578af0>, definition='    SAFE_DIVIDE(\n        SUM(CAST(JSON_EXTRACT_SCALAR({select_expr}, "$.sum") AS int64)),\n        SUM((SELECT SUM(value) FROM UNNEST(mozfun.hist.extract({select_expr}).values)))\n    )\n')

agg_histogram_mean_glean

Definition:
functools.partial(<function FunctionsSpec.from_dict.<locals>.<dictcomp>.<lambda> at 0x7f45e9578c10>, definition='    SAFE_DIVIDE(\n        SUM({select_expr}.sum),\n        SUM((SELECT SUM(value) FROM UNNEST({select_expr}.values)))\n    )\n')