-
+
Parameters
@@ -3632,120 +3512,6 @@
norm
Functions for normalizing data.
-glean_baseline_client_info (UDF)
-Accepts a glean client_info struct as input and returns a modified struct that includes a few parsed or normalized variants of the input fields.
-Parameters
-INPUTS
-client_info ANY TYPE, metrics ANY TYPE
-
-OUTPUTS
-
-Source | Edit
-get_earliest_value (UDF)
-This UDF returns the earliest not-null value pair and datetime
-from a list of values and their corresponding timestamp.
-The function will return the first value pair in the input array,
-that is not null and has the earliest timestamp.
-Because there may be more than one value on the same date e.g. more
-than one value reported by different pings on the same date, the dates
-must be given as TIMESTAMPS and the values as STRING.
-Usage:
-SELECT
- mozfun.norm.get_earliest_value(ARRAY<STRUCT<value STRING, value_source STRING, value_date DATETIME>>) AS <alias>
-
-Parameters
-INPUTS
-value_set ARRAY<STRUCT<value STRING, value_source STRING, value_date DATETIME>>
-
-OUTPUTS
-STRUCT<earliest_value STRING, earliest_value_source STRING, earliest_date DATETIME>
-
-Source | Edit
-fenix_app_info (UDF)
-Returns canonical, human-understandable identification info for Fenix sources.
-The Glean telemetry library for Android by design routes pings based
-on the Play Store appId value of the published application.
-As of August 2020, there have been 5 separate Play Store appId
- values associated with different builds of Fenix,
- each corresponding to different datasets in BigQuery,
-and the mapping of appId to logical app names
-(Firefox vs. Firefox Preview) and channel names
- (nightly, beta, or release) has changed over time; see the
-spreadsheet of naming history for Mozilla's mobile browsers.>
-This function is intended as the source of truth for how to map a
-specific ping in BigQuery to a logical app names and channel.
-It should be expected that the output of this function may evolve
-over time. If we rename a product or channel, we may choose to
-update the values here so that analyses consistently get the new name.
-The first argument (app_id
) can be fairly fuzzy; it is tolerant
-of actual Google Play Store appId values like 'org.mozilla.firefox_beta'
-(mix of periods and underscores) as well as BigQuery dataset names
-with suffixes like 'org_mozilla_firefox_beta_stable'.
-The second argument (app_build_id
) should be the value
-in client_info.app_build.
-The function returns a STRUCT
that contains the logical app_name
-and channel
as well as the Play Store app_id
in the canonical
-form which would appear in Play Store URLs.
-Note that the naming of Fenix applications changed on 2020-07-03,
-so to get a continuous view of the pings associated with a logical
-app channel, you may need to union together tables from multiple
-BigQuery datasets. To see data for all Fenix channels together, it
-is necessary to union together tables from all 5 datasets.
-For basic usage information, consider using
-telemetry.fenix_clients_last_seen
which already handles the
-union. Otherwise, see the example below as a template for how
-construct a custom union.
-Mapping of channels to datasets:
-
-- release:
org_mozilla_firefox
-- beta:
org_mozilla_firefox_beta
(current) and org_mozilla_fenix
-- nightly:
org_mozilla_fenix
(current), org_mozilla_fennec_aurora
,
-and org_mozilla_fenix_nightly
-
--- Example of a query over all Fenix builds advertised as "Firefox Beta"
-CREATE TEMP FUNCTION extract_fields(app_id STRING, m ANY TYPE) AS (
- (
- SELECT AS STRUCT
- m.submission_timestamp,
- m.metrics.string.geckoview_version,
- mozfun.norm.fenix_app_info(app_id, m.client_info.app_build).*
- )
-);
-
-WITH base AS (
- SELECT
- extract_fields('org_mozilla_firefox_beta', m).*
- FROM
- org_mozilla_firefox_beta.metrics AS m
- UNION ALL
- SELECT
- extract_fields('org_mozilla_fenix', m).*
- FROM
- org_mozilla_fenix.metrics AS m
-)
-SELECT
- DATE(submission_timestamp) AS submission_date,
- geckoview_version,
- COUNT(*)
-FROM
- base
-WHERE
- app_name = 'Fenix' -- excludes 'Firefox Preview'
- AND channel = 'beta'
- AND DATE(submission_timestamp) = '2020-08-01'
-GROUP BY
- submission_date,
- geckoview_version
-
-Parameters
-INPUTS
-app_id STRING, app_build_id STRING
-
-OUTPUTS
-STRUCT<app_name STRING, channel STRING, app_id STRING>
-
-Source | Edit
product_info (UDF)
Returns a normalized app_name
and canonical_app_name
for a product based on legacy_app_name
and normalized_os
values.
@@ -3961,7 +3727,7 @@
product_info (UDF)
-Parameters
+Parameters
INPUTS
legacy_app_name STRING, normalized_os STRING
@@ -3971,14 +3737,14 @@ Parameters
Source | Edit
glean_ping_info (UDF)
Accepts a glean ping_info struct as input and returns a modified struct that includes a few parsed or normalized variants of the input fields.
-Parameters
+Parameters
INPUTS
Source | Edit
Accepts a pipeline metadata struct as input and returns a modified struct that includes a few parsed or normalized variants of the input metadata fields.
-Parameters
+Parameters
INPUTS
@@ -4183,7 +3949,7 @@ Mapping
-Parameters
+Parameters
INPUTS
@@ -4194,7 +3960,7 @@ Parameters
diff_months (UDF)
Determine the number of whole months after grace period between start and end. Month is dependent on timezone, so start and end must both be datetimes, or both be dates, in the correct timezone. Grace period can be used to account for billing delay, usually 1 day, and is counted after months. When inclusive is FALSE, start and end are not included in whole months.
For example, diff_months(start => '2021-01-01', end => '2021-03-01', grace_period => INTERVAL 0 day, inclusive => FALSE) returns 1, because start plus two months plus grace period is not less than end. Changing inclusive to TRUE returns 2, because start plus two months plus grace period is less than or equal to end. diff_months(start => '2021-01-01', end => '2021-03-02 00:00:00.000001', grace_period => INTERVAL 1 DAY, inclusive => FALSE) returns 2, because start plus two months plus grace period is less than end.
-Parameters
+Parameters
INPUTS
start DATETIME, `end` DATETIME, grace_period INTERVAL, inclusive BOOLEAN
@@ -4204,7 +3970,7 @@ windows_version_info (UDF)
of the operating system name.
Requires os, os_version and windows_build_number.
E.G. from windows_build_number >= 22000 return Windows 11
-Parameters
+Parameters
INPUTS
os STRING, os_version STRING, windows_build_number INT64
@@ -4215,7 +3981,7 @@ Parameters
result_type_to_product_name (UDF)
Convert urlbar result types into product-friendly names
This UDF converts result types from urlbar events (engagement, impression, abandonment) into product-friendly names.
-Parameters
+Parameters
INPUTS
@@ -4237,7 +4003,7 @@ truncate_version (UDF)
This is useful for grouping Linux and Mac operating system versions inside
aggregate datasets or queries where there may be many different patch
releases in the field.
-Parameters
+Parameters
INPUTS
os_version STRING, truncation_level STRING
@@ -4251,7 +4017,7 @@ os (UDF)
This is a reimplementation of
logic used in the data pipeline>
to populate normalized_os
.
-Parameters
+Parameters
INPUTS
@@ -4277,7 +4043,7 @@ fenix_build_to_datetime (UDF)
This function tolerates both formats.
After using this you may wish to DATETIME_TRUNC(result, DAY)
for
grouping by build date.
-Parameters
+Parameters
INPUTS
@@ -4301,7 +4067,7 @@
mozfun.norm.extract_version('96.05.01', 'minor') as minor_version, -- 5
mozfun.norm.extract_version('96.05.01', 'patch') as patch_version -- 1
-Parameters
+Parameters
INPUTS
version_string STRING, extraction_level STRING
@@ -4314,7 +4080,7 @@ browser_version_info (UDF)
This is a temporary solution that allows browser version analysis.
It should eventually be replaced with one or more browser version tables
that serves as a source of truth for version releases.
-Parameters
+Parameters
INPUTS
@@ -4324,7 +4090,7 @@ Parameters
Source | Edit
vpn_attribution (UDF)
Accepts vpn attribution fields as input and returns a struct of normalized fields.
-Parameters
+Parameters
INPUTS
utm_campaign STRING, utm_content STRING, utm_medium STRING, utm_source STRING
@@ -4332,6 +4098,120 @@ Parameters
STRUCT<normalized_acquisition_channel STRING, normalized_campaign STRING, normalized_content STRING, normalized_medium STRING, normalized_source STRING, website_channel_group STRING>
Source | Edit
+glean_baseline_client_info (UDF)
+Accepts a glean client_info struct as input and returns a modified struct that includes a few parsed or normalized variants of the input fields.
+Parameters
+INPUTS
+client_info ANY TYPE, metrics ANY TYPE
+
+OUTPUTS
+
+Source | Edit
+get_earliest_value (UDF)
+This UDF returns the earliest not-null value pair and datetime
+from a list of values and their corresponding timestamp.
+The function will return the first value pair in the input array,
+that is not null and has the earliest timestamp.
+Because there may be more than one value on the same date e.g. more
+than one value reported by different pings on the same date, the dates
+must be given as TIMESTAMPS and the values as STRING.
+Usage:
+SELECT
+ mozfun.norm.get_earliest_value(ARRAY<STRUCT<value STRING, value_source STRING, value_date DATETIME>>) AS <alias>
+
+Parameters
+INPUTS
+value_set ARRAY<STRUCT<value STRING, value_source STRING, value_date DATETIME>>
+
+OUTPUTS
+STRUCT<earliest_value STRING, earliest_value_source STRING, earliest_date DATETIME>
+
+Source | Edit
+fenix_app_info (UDF)
+Returns canonical, human-understandable identification info for Fenix sources.
+The Glean telemetry library for Android by design routes pings based
+on the Play Store appId value of the published application.
+As of August 2020, there have been 5 separate Play Store appId
+ values associated with different builds of Fenix,
+ each corresponding to different datasets in BigQuery,
+and the mapping of appId to logical app names
+(Firefox vs. Firefox Preview) and channel names
+ (nightly, beta, or release) has changed over time; see the
+spreadsheet of naming history for Mozilla's mobile browsers.>
+This function is intended as the source of truth for how to map a
+specific ping in BigQuery to a logical app names and channel.
+It should be expected that the output of this function may evolve
+over time. If we rename a product or channel, we may choose to
+update the values here so that analyses consistently get the new name.
+The first argument (app_id
) can be fairly fuzzy; it is tolerant
+of actual Google Play Store appId values like 'org.mozilla.firefox_beta'
+(mix of periods and underscores) as well as BigQuery dataset names
+with suffixes like 'org_mozilla_firefox_beta_stable'.
+The second argument (app_build_id
) should be the value
+in client_info.app_build.
+The function returns a STRUCT
that contains the logical app_name
+and channel
as well as the Play Store app_id
in the canonical
+form which would appear in Play Store URLs.
+Note that the naming of Fenix applications changed on 2020-07-03,
+so to get a continuous view of the pings associated with a logical
+app channel, you may need to union together tables from multiple
+BigQuery datasets. To see data for all Fenix channels together, it
+is necessary to union together tables from all 5 datasets.
+For basic usage information, consider using
+telemetry.fenix_clients_last_seen
which already handles the
+union. Otherwise, see the example below as a template for how
+construct a custom union.
+Mapping of channels to datasets:
+
+- release:
org_mozilla_firefox
+- beta:
org_mozilla_firefox_beta
(current) and org_mozilla_fenix
+- nightly:
org_mozilla_fenix
(current), org_mozilla_fennec_aurora
,
+and org_mozilla_fenix_nightly
+
+-- Example of a query over all Fenix builds advertised as "Firefox Beta"
+CREATE TEMP FUNCTION extract_fields(app_id STRING, m ANY TYPE) AS (
+ (
+ SELECT AS STRUCT
+ m.submission_timestamp,
+ m.metrics.string.geckoview_version,
+ mozfun.norm.fenix_app_info(app_id, m.client_info.app_build).*
+ )
+);
+
+WITH base AS (
+ SELECT
+ extract_fields('org_mozilla_firefox_beta', m).*
+ FROM
+ org_mozilla_firefox_beta.metrics AS m
+ UNION ALL
+ SELECT
+ extract_fields('org_mozilla_fenix', m).*
+ FROM
+ org_mozilla_fenix.metrics AS m
+)
+SELECT
+ DATE(submission_timestamp) AS submission_date,
+ geckoview_version,
+ COUNT(*)
+FROM
+ base
+WHERE
+ app_name = 'Fenix' -- excludes 'Firefox Preview'
+ AND channel = 'beta'
+ AND DATE(submission_timestamp) = '2020-08-01'
+GROUP BY
+ submission_date,
+ geckoview_version
+
+Parameters
+INPUTS
+app_id STRING, app_build_id STRING
+
+OUTPUTS
+STRUCT<app_name STRING, channel STRING, app_id STRING>
+
+Source | Edit
diff --git a/mozfun/stats/index.html b/mozfun/stats/index.html
index 05131a1e855..2b1f962887c 100644
--- a/mozfun/stats/index.html
+++ b/mozfun/stats/index.html
@@ -3000,11 +3000,11 @@
-
-
- mode_last_retain_nulls (UDF)
+
+ mode_last (UDF)
-