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 0x7fbd6a886c20>, 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 0x7fbd6a886b90>, 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 0x7fbd6a886b00>, 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 0x7fbd6a886a70>, 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 0x7fbd6a886dd0>, definition='COALESCE(SUM({select_expr}), 0)')

agg_any

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

agg_histogram_mean

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