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 0x7fa8bd6d2170>, 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 0x7fa8bd6d20e0>, 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 0x7fa8bd6d2050>, 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 0x7fa8bd6d1fc0>, 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 0x7fa8bd6d2320>, definition='COALESCE(SUM({select_expr}), 0)')

agg_any

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

agg_histogram_mean

Definition:
functools.partial(<function FunctionsSpec.from_dict.<locals>.<dictcomp>.<lambda> at 0x7fa8bd5989d0>, 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 0x7fa8bd5981f0>, definition='    SAFE_DIVIDE(\n        SUM({select_expr}.sum),\n        SUM((SELECT SUM(value) FROM UNNEST({select_expr}.values)))\n    )\n')