Remove generated content from main (#4867)
* Remove generated content from main * Fix file permissions and comments
This commit is contained in:
Родитель
e067426d97
Коммит
562544690f
|
@ -337,9 +337,7 @@ format:
|
|||
- sql/moz-fx-data-shared-prod/telemetry_derived/event_events_v1/init.sql
|
||||
- sql/moz-fx-data-shared-prod/telemetry_derived/event_events_v1/query.sql
|
||||
- sql/moz-fx-data-shared-prod/telemetry_derived/events_live/view.sql
|
||||
- sql/moz-fx-data-shared-prod/telemetry_derived/experiment_enrollment_aggregates_v1/init.sql
|
||||
- sql/moz-fx-data-shared-prod/telemetry_derived/experiment_enrollment_aggregates_v1/query.sql
|
||||
- sql/moz-fx-data-shared-prod/telemetry_derived/experiments_daily_active_clients_v1/init.sql
|
||||
- sql/moz-fx-data-shared-prod/telemetry_derived/firefox_desktop_exact_mau28_by_client_count_dimensions_v1/query.sql
|
||||
- sql/moz-fx-data-shared-prod/telemetry_derived/fxa_users_services_daily_v1/query.sql
|
||||
- sql/moz-fx-data-shared-prod/telemetry_derived/fxa_users_services_last_seen_v1/query.sql
|
||||
|
|
|
@ -1,8 +0,0 @@
|
|||
-- Generated by ./bqetl generate events_daily
|
||||
CREATE OR REPLACE VIEW
|
||||
`moz-fx-data-shared-prod.fenix.event_types`
|
||||
AS
|
||||
SELECT
|
||||
*
|
||||
FROM
|
||||
`moz-fx-data-shared-prod.fenix_derived.event_types_v1`
|
|
@ -1,8 +0,0 @@
|
|||
-- Generated by ./bqetl generate events_daily
|
||||
CREATE OR REPLACE VIEW
|
||||
`moz-fx-data-shared-prod.fenix.events_daily`
|
||||
AS
|
||||
SELECT
|
||||
*
|
||||
FROM
|
||||
`moz-fx-data-shared-prod.fenix_derived.events_daily_v1`
|
|
@ -1,181 +0,0 @@
|
|||
-- Generated by ./bqetl generate events_daily
|
||||
CREATE OR REPLACE TABLE
|
||||
fenix_derived.event_types_history_v1
|
||||
PARTITION BY
|
||||
submission_date
|
||||
CLUSTER BY
|
||||
category,
|
||||
event
|
||||
AS
|
||||
WITH source AS (
|
||||
SELECT
|
||||
DATE(submission_timestamp) AS submission_date,
|
||||
SAFE.TIMESTAMP_ADD(ping_info.parsed_start_time, INTERVAL timestamp MILLISECOND) AS timestamp,
|
||||
category,
|
||||
name AS event,
|
||||
extra,
|
||||
FROM
|
||||
org_mozilla_firefox.events e
|
||||
CROSS JOIN
|
||||
UNNEST(e.events) AS event
|
||||
UNION ALL
|
||||
SELECT
|
||||
DATE(submission_timestamp) AS submission_date,
|
||||
SAFE.TIMESTAMP_ADD(ping_info.parsed_start_time, INTERVAL timestamp MILLISECOND) AS timestamp,
|
||||
category,
|
||||
name AS event,
|
||||
extra,
|
||||
FROM
|
||||
org_mozilla_firefox_beta.events e
|
||||
CROSS JOIN
|
||||
UNNEST(e.events) AS event
|
||||
UNION ALL
|
||||
SELECT
|
||||
DATE(submission_timestamp) AS submission_date,
|
||||
SAFE.TIMESTAMP_ADD(ping_info.parsed_start_time, INTERVAL timestamp MILLISECOND) AS timestamp,
|
||||
category,
|
||||
name AS event,
|
||||
extra,
|
||||
FROM
|
||||
org_mozilla_fenix.events e
|
||||
CROSS JOIN
|
||||
UNNEST(e.events) AS event
|
||||
),
|
||||
sample AS (
|
||||
SELECT
|
||||
*
|
||||
FROM
|
||||
source
|
||||
WHERE
|
||||
submission_date >= '2020-01-01'
|
||||
),
|
||||
primary_event_types AS (
|
||||
SELECT
|
||||
category,
|
||||
event,
|
||||
MIN(timestamp) AS first_timestamp,
|
||||
ROW_NUMBER() OVER (ORDER BY MIN(timestamp) ASC, category ASC, event ASC) AS primary_index,
|
||||
FROM
|
||||
sample
|
||||
GROUP BY
|
||||
category,
|
||||
event
|
||||
),
|
||||
event_property_indices AS (
|
||||
SELECT
|
||||
category,
|
||||
event,
|
||||
MIN(timestamp) AS first_timestamp,
|
||||
event_property.key AS event_property,
|
||||
ROW_NUMBER() OVER (
|
||||
PARTITION BY
|
||||
category,
|
||||
event
|
||||
ORDER BY
|
||||
MIN(timestamp) ASC,
|
||||
event_property.key ASC
|
||||
) AS event_property_index,
|
||||
FROM
|
||||
sample,
|
||||
UNNEST(extra) AS event_property
|
||||
LEFT JOIN
|
||||
UNNEST(CAST(['time_ms'] AS ARRAY<STRING>)) skipped_property
|
||||
ON skipped_property = event_property.key
|
||||
WHERE
|
||||
skipped_property IS NULL
|
||||
GROUP BY
|
||||
category,
|
||||
event,
|
||||
event_property
|
||||
),
|
||||
event_property_value_indices AS (
|
||||
SELECT
|
||||
category,
|
||||
event,
|
||||
MIN(timestamp) AS first_timestamp,
|
||||
event_property.key AS event_property,
|
||||
event_property.value AS event_property_value,
|
||||
ROW_NUMBER() OVER (
|
||||
PARTITION BY
|
||||
category,
|
||||
event,
|
||||
event_property.key
|
||||
ORDER BY
|
||||
MIN(timestamp) ASC,
|
||||
event_property.value ASC
|
||||
) AS event_property_value_index,
|
||||
FROM
|
||||
sample,
|
||||
UNNEST(extra) AS event_property
|
||||
GROUP BY
|
||||
category,
|
||||
event,
|
||||
event_property,
|
||||
event_property_value
|
||||
),
|
||||
per_event_property AS (
|
||||
SELECT
|
||||
category,
|
||||
event,
|
||||
event_property,
|
||||
event_property_index,
|
||||
ARRAY_AGG(
|
||||
STRUCT(
|
||||
event_property_value AS key,
|
||||
udf.event_code_points_to_string([event_property_value_index]) AS value,
|
||||
event_property_value_index AS index
|
||||
)
|
||||
ORDER BY
|
||||
event_property_value_index ASC
|
||||
) AS values,
|
||||
FROM
|
||||
event_property_value_indices
|
||||
INNER JOIN
|
||||
event_property_indices
|
||||
USING (category, event, event_property)
|
||||
WHERE
|
||||
event_property_value_index <= 1000
|
||||
GROUP BY
|
||||
category,
|
||||
event,
|
||||
event_property,
|
||||
event_property_index
|
||||
),
|
||||
per_event AS (
|
||||
SELECT
|
||||
category,
|
||||
event,
|
||||
first_timestamp,
|
||||
primary_index AS numeric_index,
|
||||
udf.event_code_points_to_string([primary_index]) AS index,
|
||||
ARRAY_AGG(
|
||||
IF(
|
||||
event_property IS NULL,
|
||||
NULL,
|
||||
STRUCT(event_property AS key, VALUES AS value, event_property_index AS index)
|
||||
) IGNORE NULLS
|
||||
ORDER BY
|
||||
event_property_index ASC
|
||||
) AS event_properties
|
||||
FROM
|
||||
primary_event_types
|
||||
LEFT JOIN
|
||||
per_event_property
|
||||
USING (category, event)
|
||||
GROUP BY
|
||||
category,
|
||||
event,
|
||||
first_timestamp,
|
||||
primary_index
|
||||
),
|
||||
max_date AS (
|
||||
SELECT
|
||||
MAX(submission_date) AS submission_date
|
||||
FROM
|
||||
sample
|
||||
)
|
||||
SELECT
|
||||
*
|
||||
FROM
|
||||
per_event,
|
||||
max_date
|
|
@ -1,28 +0,0 @@
|
|||
# Generated by ./bqetl generate events_daily
|
||||
|
||||
---
|
||||
friendly_name: 'Firefox for Android Event Types History'
|
||||
description: >
|
||||
Retrieve the set of [events, event_properties]
|
||||
and record them in a table.
|
||||
This table stores all of history, partitioned by
|
||||
submission_date.
|
||||
owners:
|
||||
- wlachance@mozilla.com
|
||||
- akomar@mozilla.com
|
||||
labels:
|
||||
application: fenix
|
||||
incremental: true
|
||||
schedule: daily
|
||||
scheduling:
|
||||
dag_name: bqetl_fenix_event_rollup
|
||||
depends_on_past: true
|
||||
bigquery:
|
||||
time_partitioning:
|
||||
type: day
|
||||
field: submission_date
|
||||
require_partition_filter: false
|
||||
clustering:
|
||||
fields:
|
||||
- category
|
||||
- event
|
|
@ -1,279 +0,0 @@
|
|||
-- Generated by ./bqetl generate events_daily
|
||||
WITH all_events AS (
|
||||
SELECT
|
||||
DATE(submission_timestamp) AS submission_date,
|
||||
SAFE.TIMESTAMP_ADD(ping_info.parsed_start_time, INTERVAL timestamp MILLISECOND) AS timestamp,
|
||||
category,
|
||||
name AS event,
|
||||
extra,
|
||||
FROM
|
||||
org_mozilla_firefox.events e
|
||||
CROSS JOIN
|
||||
UNNEST(e.events) AS event
|
||||
UNION ALL
|
||||
SELECT
|
||||
DATE(submission_timestamp) AS submission_date,
|
||||
SAFE.TIMESTAMP_ADD(ping_info.parsed_start_time, INTERVAL timestamp MILLISECOND) AS timestamp,
|
||||
category,
|
||||
name AS event,
|
||||
extra,
|
||||
FROM
|
||||
org_mozilla_firefox_beta.events e
|
||||
CROSS JOIN
|
||||
UNNEST(e.events) AS event
|
||||
UNION ALL
|
||||
SELECT
|
||||
DATE(submission_timestamp) AS submission_date,
|
||||
SAFE.TIMESTAMP_ADD(ping_info.parsed_start_time, INTERVAL timestamp MILLISECOND) AS timestamp,
|
||||
category,
|
||||
name AS event,
|
||||
extra,
|
||||
FROM
|
||||
org_mozilla_fenix.events e
|
||||
CROSS JOIN
|
||||
UNNEST(e.events) AS event
|
||||
),
|
||||
current_events AS (
|
||||
SELECT
|
||||
*
|
||||
FROM
|
||||
all_events
|
||||
WHERE
|
||||
submission_date = @submission_date
|
||||
),
|
||||
event_types AS (
|
||||
SELECT
|
||||
*
|
||||
FROM
|
||||
fenix_derived.event_types_history_v1
|
||||
WHERE
|
||||
submission_date = DATE_SUB(@submission_date, INTERVAL 1 DAY)
|
||||
),
|
||||
new_primary_event_types AS (
|
||||
SELECT
|
||||
category,
|
||||
event,
|
||||
MIN(timestamp) AS first_timestamp,
|
||||
ROW_NUMBER() OVER (ORDER BY MIN(timestamp) ASC, category ASC, event ASC) + (
|
||||
SELECT
|
||||
MAX(numeric_index)
|
||||
FROM
|
||||
event_types
|
||||
) AS numeric_index,
|
||||
0 AS max_event_property_index
|
||||
FROM
|
||||
current_events
|
||||
LEFT JOIN
|
||||
event_types
|
||||
USING (category, event)
|
||||
WHERE
|
||||
event_types.event IS NULL
|
||||
GROUP BY
|
||||
category,
|
||||
event
|
||||
),
|
||||
all_primary_event_types AS (
|
||||
SELECT
|
||||
*
|
||||
FROM
|
||||
new_primary_event_types
|
||||
UNION ALL
|
||||
SELECT
|
||||
category,
|
||||
event,
|
||||
first_timestamp,
|
||||
numeric_index,
|
||||
MAX(COALESCE(event_property.index, 0)) AS max_event_property_index
|
||||
FROM
|
||||
event_types
|
||||
LEFT JOIN
|
||||
UNNEST(event_properties) AS event_property
|
||||
GROUP BY
|
||||
category,
|
||||
event,
|
||||
first_timestamp,
|
||||
numeric_index
|
||||
),
|
||||
new_event_property_indices AS (
|
||||
SELECT
|
||||
category,
|
||||
event,
|
||||
event_property.key AS event_property,
|
||||
ROW_NUMBER() OVER (
|
||||
PARTITION BY
|
||||
category,
|
||||
event
|
||||
ORDER BY
|
||||
MIN(timestamp) ASC,
|
||||
event_property.key ASC
|
||||
) + ANY_VALUE(max_event_property_index) AS event_property_index,
|
||||
0 AS max_event_property_value_index
|
||||
FROM
|
||||
current_events,
|
||||
UNNEST(extra) AS event_property
|
||||
LEFT JOIN
|
||||
(SELECT * FROM event_types, UNNEST(event_properties)) event_types
|
||||
USING (category, event, key)
|
||||
JOIN
|
||||
all_primary_event_types
|
||||
USING (event, category)
|
||||
LEFT JOIN
|
||||
UNNEST(CAST(['time_ms'] AS ARRAY<STRING>)) skipped_property
|
||||
ON skipped_property = event_property.key
|
||||
WHERE
|
||||
skipped_property IS NULL
|
||||
AND event_types.event IS NULL
|
||||
GROUP BY
|
||||
category,
|
||||
event,
|
||||
event_property
|
||||
),
|
||||
all_event_property_indices AS (
|
||||
SELECT
|
||||
*
|
||||
FROM
|
||||
new_event_property_indices
|
||||
UNION ALL
|
||||
SELECT
|
||||
category,
|
||||
event,
|
||||
event_property.key AS event_property,
|
||||
event_property.index AS event_property_index,
|
||||
MAX(COALESCE(`values`.index, 0)) AS max_event_property_value_index
|
||||
FROM
|
||||
event_types
|
||||
LEFT JOIN
|
||||
UNNEST(event_properties) AS event_property
|
||||
LEFT JOIN
|
||||
UNNEST(value) AS `values`
|
||||
GROUP BY
|
||||
category,
|
||||
event,
|
||||
first_timestamp,
|
||||
event_property,
|
||||
event_property_index
|
||||
),
|
||||
new_event_property_value_indices AS (
|
||||
SELECT
|
||||
current_events.category,
|
||||
current_events.event,
|
||||
event_property.key AS event_property,
|
||||
event_property.value AS event_property_value,
|
||||
ROW_NUMBER() OVER (
|
||||
PARTITION BY
|
||||
current_events.category,
|
||||
current_events.event,
|
||||
event_property.key
|
||||
ORDER BY
|
||||
MIN(timestamp) ASC,
|
||||
event_property.value ASC
|
||||
) + ANY_VALUE(max_event_property_value_index) AS event_property_value_index,
|
||||
FROM
|
||||
current_events,
|
||||
UNNEST(extra) AS event_property
|
||||
LEFT JOIN
|
||||
(
|
||||
SELECT
|
||||
event_types.* EXCEPT (event_properties),
|
||||
existing_event_property,
|
||||
`values`
|
||||
FROM
|
||||
event_types,
|
||||
UNNEST(event_properties) AS existing_event_property,
|
||||
UNNEST(value) AS `values`
|
||||
) AS existing_event_type_values
|
||||
ON current_events.category = existing_event_type_values.category
|
||||
AND current_events.event = existing_event_type_values.event
|
||||
AND event_property.key = existing_event_type_values.existing_event_property.key
|
||||
AND event_property.value = existing_event_type_values.`values`.key
|
||||
JOIN
|
||||
all_event_property_indices
|
||||
ON all_event_property_indices.category = current_events.category
|
||||
AND all_event_property_indices.event = current_events.event
|
||||
AND all_event_property_indices.event_property = event_property.key
|
||||
WHERE
|
||||
existing_event_type_values.event IS NULL
|
||||
GROUP BY
|
||||
category,
|
||||
event,
|
||||
event_property,
|
||||
event_property_value
|
||||
),
|
||||
all_event_property_value_indices AS (
|
||||
SELECT
|
||||
*
|
||||
FROM
|
||||
new_event_property_value_indices
|
||||
WHERE
|
||||
-- Doesn't remove historical event_property values
|
||||
event_property_value_index <= 1000
|
||||
UNION ALL
|
||||
SELECT
|
||||
category,
|
||||
event,
|
||||
event_property.key AS event_property,
|
||||
`values`.key AS event_property_value,
|
||||
`values`.index AS event_property_value_index
|
||||
FROM
|
||||
event_types,
|
||||
UNNEST(event_properties) AS event_property,
|
||||
UNNEST(value) AS `values`
|
||||
),
|
||||
per_event_property AS (
|
||||
SELECT
|
||||
category,
|
||||
event,
|
||||
event_property,
|
||||
event_property_index,
|
||||
ARRAY_AGG(
|
||||
STRUCT(
|
||||
event_property_value AS key,
|
||||
udf.event_code_points_to_string([event_property_value_index]) AS value,
|
||||
event_property_value_index AS index
|
||||
)
|
||||
ORDER BY
|
||||
event_property_value_index ASC
|
||||
) AS `values`,
|
||||
FROM
|
||||
all_event_property_value_indices
|
||||
INNER JOIN
|
||||
all_event_property_indices
|
||||
USING (category, event, event_property)
|
||||
GROUP BY
|
||||
category,
|
||||
event,
|
||||
event_property,
|
||||
event_property_index
|
||||
),
|
||||
per_event AS (
|
||||
SELECT
|
||||
category,
|
||||
event,
|
||||
first_timestamp,
|
||||
numeric_index,
|
||||
udf.event_code_points_to_string([numeric_index]) AS index,
|
||||
ARRAY_AGG(
|
||||
IF(
|
||||
event_property IS NULL,
|
||||
NULL,
|
||||
STRUCT(event_property AS key, `values` AS value, event_property_index AS index)
|
||||
) IGNORE NULLS
|
||||
ORDER BY
|
||||
event_property_index ASC
|
||||
) AS event_properties
|
||||
FROM
|
||||
all_primary_event_types
|
||||
LEFT JOIN
|
||||
per_event_property
|
||||
USING (category, event)
|
||||
GROUP BY
|
||||
category,
|
||||
event,
|
||||
first_timestamp,
|
||||
numeric_index
|
||||
)
|
||||
SELECT
|
||||
@submission_date AS submission_date,
|
||||
*
|
||||
FROM
|
||||
per_event
|
|
@ -1,44 +0,0 @@
|
|||
# Generated by ./bqetl generate events_daily
|
||||
|
||||
fields:
|
||||
- mode: NULLABLE
|
||||
name: submission_date
|
||||
type: DATE
|
||||
- mode: NULLABLE
|
||||
name: category
|
||||
type: STRING
|
||||
- mode: NULLABLE
|
||||
name: event
|
||||
type: STRING
|
||||
- mode: NULLABLE
|
||||
name: first_timestamp
|
||||
type: TIMESTAMP
|
||||
- mode: NULLABLE
|
||||
name: numeric_index
|
||||
type: INTEGER
|
||||
- mode: NULLABLE
|
||||
name: index
|
||||
type: STRING
|
||||
- fields:
|
||||
- mode: NULLABLE
|
||||
name: key
|
||||
type: STRING
|
||||
- fields:
|
||||
- mode: NULLABLE
|
||||
name: key
|
||||
type: STRING
|
||||
- mode: NULLABLE
|
||||
name: value
|
||||
type: STRING
|
||||
- mode: NULLABLE
|
||||
name: index
|
||||
type: INTEGER
|
||||
mode: REPEATED
|
||||
name: value
|
||||
type: RECORD
|
||||
- mode: NULLABLE
|
||||
name: index
|
||||
type: INTEGER
|
||||
mode: REPEATED
|
||||
name: event_properties
|
||||
type: RECORD
|
|
@ -1,8 +0,0 @@
|
|||
-- Generated by ./bqetl generate events_daily
|
||||
CREATE OR REPLACE TABLE
|
||||
fenix_derived.event_types_v1
|
||||
AS
|
||||
SELECT
|
||||
* EXCEPT (submission_date)
|
||||
FROM
|
||||
fenix_derived.event_types_history_v1
|
|
@ -1,17 +0,0 @@
|
|||
# Generated by ./bqetl generate events_daily
|
||||
|
||||
---
|
||||
friendly_name: Firefox for Android Event Types
|
||||
description: >
|
||||
A materialized view of the most recent day of event_types data
|
||||
owners:
|
||||
- wlachance@mozilla.com
|
||||
- akomar@mozilla.com
|
||||
labels:
|
||||
application: fenix
|
||||
incremental: false
|
||||
schedule: daily
|
||||
scheduling:
|
||||
dag_name: bqetl_fenix_event_rollup
|
||||
date_partition_parameter: null
|
||||
parameters: ["submission_date:DATE:{{ds}}"]
|
|
@ -1,7 +0,0 @@
|
|||
-- Generated by ./bqetl generate events_daily
|
||||
SELECT
|
||||
* EXCEPT (submission_date)
|
||||
FROM
|
||||
fenix_derived.event_types_history_v1
|
||||
WHERE
|
||||
submission_date = @submission_date
|
|
@ -1,36 +0,0 @@
|
|||
-- Generated by ./bqetl generate events_daily
|
||||
CREATE OR REPLACE TABLE
|
||||
fenix_derived.events_daily_v1
|
||||
PARTITION BY
|
||||
submission_date
|
||||
CLUSTER BY
|
||||
sample_id
|
||||
OPTIONS
|
||||
(require_partition_filter = TRUE)
|
||||
AS
|
||||
SELECT
|
||||
CAST(NULL AS date) AS submission_date,
|
||||
CAST(NULL AS STRING) AS client_id,
|
||||
CAST(NULL AS INT64) AS sample_id,
|
||||
CAST(NULL AS STRING) AS events,
|
||||
-- client info
|
||||
CAST(NULL AS STRING) AS android_sdk_version,
|
||||
CAST(NULL AS STRING) AS app_build,
|
||||
CAST(NULL AS STRING) AS app_channel,
|
||||
CAST(NULL AS STRING) AS app_display_version,
|
||||
CAST(NULL AS STRING) AS architecture,
|
||||
CAST(NULL AS STRING) AS device_manufacturer,
|
||||
CAST(NULL AS STRING) AS device_model,
|
||||
CAST(NULL AS STRING) AS first_run_date,
|
||||
CAST(NULL AS STRING) AS telemetry_sdk_build,
|
||||
CAST(NULL AS STRING) AS locale,
|
||||
-- metadata
|
||||
CAST(NULL AS STRING) AS city,
|
||||
CAST(NULL AS STRING) AS country,
|
||||
CAST(NULL AS STRING) AS subdivision1,
|
||||
-- normalized fields
|
||||
CAST(NULL AS STRING) AS channel,
|
||||
CAST(NULL AS STRING) AS os,
|
||||
CAST(NULL AS STRING) AS os_version,
|
||||
-- ping info
|
||||
CAST(NULL AS ARRAY<STRUCT<key STRING, value STRING>>) AS experiments
|
|
@ -1,23 +0,0 @@
|
|||
# Generated by ./bqetl generate events_daily
|
||||
|
||||
---
|
||||
friendly_name: 'Firefox for Android Events Daily'
|
||||
description: >
|
||||
Packed event representation with one-row per-client
|
||||
owners:
|
||||
- wlachance@mozilla.com
|
||||
- akomar@mozilla.com
|
||||
labels:
|
||||
application: fenix
|
||||
schedule: daily
|
||||
incremental: true
|
||||
scheduling:
|
||||
dag_name: bqetl_fenix_event_rollup
|
||||
bigquery:
|
||||
time_partitioning:
|
||||
type: day
|
||||
field: submission_date
|
||||
require_partition_filter: true
|
||||
clustering:
|
||||
fields:
|
||||
- sample_id
|
|
@ -1,155 +0,0 @@
|
|||
-- Generated by ./bqetl generate events_daily
|
||||
WITH sample AS (
|
||||
SELECT
|
||||
DATE(submission_timestamp) AS submission_date,
|
||||
name AS event,
|
||||
category,
|
||||
extra,
|
||||
sample_id,
|
||||
timestamp,
|
||||
metadata,
|
||||
normalized_channel,
|
||||
normalized_os,
|
||||
normalized_os_version,
|
||||
client_info.client_id AS client_id,
|
||||
client_info.android_sdk_version AS android_sdk_version,
|
||||
client_info.app_build AS app_build,
|
||||
client_info.app_channel AS app_channel,
|
||||
client_info.app_display_version AS app_display_version,
|
||||
client_info.architecture AS architecture,
|
||||
client_info.device_manufacturer AS device_manufacturer,
|
||||
client_info.device_model AS device_model,
|
||||
client_info.first_run_date AS first_run_date,
|
||||
client_info.telemetry_sdk_build AS telemetry_sdk_build,
|
||||
client_info.locale AS locale,
|
||||
(
|
||||
SELECT
|
||||
ARRAY_AGG(STRUCT(key, value.branch AS value))
|
||||
FROM
|
||||
UNNEST(ping_info.experiments)
|
||||
) AS experiments
|
||||
FROM
|
||||
org_mozilla_firefox.events e
|
||||
CROSS JOIN
|
||||
UNNEST(e.events) AS event
|
||||
UNION ALL
|
||||
SELECT
|
||||
DATE(submission_timestamp) AS submission_date,
|
||||
name AS event,
|
||||
category,
|
||||
extra,
|
||||
sample_id,
|
||||
timestamp,
|
||||
metadata,
|
||||
normalized_channel,
|
||||
normalized_os,
|
||||
normalized_os_version,
|
||||
client_info.client_id AS client_id,
|
||||
client_info.android_sdk_version AS android_sdk_version,
|
||||
client_info.app_build AS app_build,
|
||||
client_info.app_channel AS app_channel,
|
||||
client_info.app_display_version AS app_display_version,
|
||||
client_info.architecture AS architecture,
|
||||
client_info.device_manufacturer AS device_manufacturer,
|
||||
client_info.device_model AS device_model,
|
||||
client_info.first_run_date AS first_run_date,
|
||||
client_info.telemetry_sdk_build AS telemetry_sdk_build,
|
||||
client_info.locale AS locale,
|
||||
(
|
||||
SELECT
|
||||
ARRAY_AGG(STRUCT(key, value.branch AS value))
|
||||
FROM
|
||||
UNNEST(ping_info.experiments)
|
||||
) AS experiments
|
||||
FROM
|
||||
org_mozilla_firefox_beta.events e
|
||||
CROSS JOIN
|
||||
UNNEST(e.events) AS event
|
||||
UNION ALL
|
||||
SELECT
|
||||
DATE(submission_timestamp) AS submission_date,
|
||||
name AS event,
|
||||
category,
|
||||
extra,
|
||||
sample_id,
|
||||
timestamp,
|
||||
metadata,
|
||||
normalized_channel,
|
||||
normalized_os,
|
||||
normalized_os_version,
|
||||
client_info.client_id AS client_id,
|
||||
client_info.android_sdk_version AS android_sdk_version,
|
||||
client_info.app_build AS app_build,
|
||||
client_info.app_channel AS app_channel,
|
||||
client_info.app_display_version AS app_display_version,
|
||||
client_info.architecture AS architecture,
|
||||
client_info.device_manufacturer AS device_manufacturer,
|
||||
client_info.device_model AS device_model,
|
||||
client_info.first_run_date AS first_run_date,
|
||||
client_info.telemetry_sdk_build AS telemetry_sdk_build,
|
||||
client_info.locale AS locale,
|
||||
(
|
||||
SELECT
|
||||
ARRAY_AGG(STRUCT(key, value.branch AS value))
|
||||
FROM
|
||||
UNNEST(ping_info.experiments)
|
||||
) AS experiments
|
||||
FROM
|
||||
org_mozilla_fenix.events e
|
||||
CROSS JOIN
|
||||
UNNEST(e.events) AS event
|
||||
),
|
||||
events AS (
|
||||
SELECT
|
||||
*
|
||||
FROM
|
||||
sample
|
||||
WHERE
|
||||
(
|
||||
submission_date = @submission_date
|
||||
OR (@submission_date IS NULL AND submission_date >= '2020-01-01')
|
||||
)
|
||||
AND client_id IS NOT NULL
|
||||
),
|
||||
joined AS (
|
||||
SELECT
|
||||
CONCAT(udf.pack_event_properties(events.extra, event_types.event_properties), index) AS index,
|
||||
events.* EXCEPT (category, event, extra)
|
||||
FROM
|
||||
events
|
||||
INNER JOIN
|
||||
fenix.event_types event_types
|
||||
USING (category, event)
|
||||
)
|
||||
SELECT
|
||||
submission_date,
|
||||
client_id,
|
||||
sample_id,
|
||||
CONCAT(STRING_AGG(index, ',' ORDER BY timestamp ASC), ',') AS events,
|
||||
-- client info
|
||||
mozfun.stats.mode_last(ARRAY_AGG(android_sdk_version)) AS android_sdk_version,
|
||||
mozfun.stats.mode_last(ARRAY_AGG(app_build)) AS app_build,
|
||||
mozfun.stats.mode_last(ARRAY_AGG(app_channel)) AS app_channel,
|
||||
mozfun.stats.mode_last(ARRAY_AGG(app_display_version)) AS app_display_version,
|
||||
mozfun.stats.mode_last(ARRAY_AGG(architecture)) AS architecture,
|
||||
mozfun.stats.mode_last(ARRAY_AGG(device_manufacturer)) AS device_manufacturer,
|
||||
mozfun.stats.mode_last(ARRAY_AGG(device_model)) AS device_model,
|
||||
mozfun.stats.mode_last(ARRAY_AGG(first_run_date)) AS first_run_date,
|
||||
mozfun.stats.mode_last(ARRAY_AGG(telemetry_sdk_build)) AS telemetry_sdk_build,
|
||||
mozfun.stats.mode_last(ARRAY_AGG(locale)) AS locale,
|
||||
-- metadata
|
||||
mozfun.stats.mode_last(ARRAY_AGG(metadata.geo.city)) AS city,
|
||||
mozfun.stats.mode_last(ARRAY_AGG(metadata.geo.country)) AS country,
|
||||
mozfun.stats.mode_last(ARRAY_AGG(metadata.geo.subdivision1)) AS subdivision1,
|
||||
-- normalized fields
|
||||
mozfun.stats.mode_last(ARRAY_AGG(normalized_channel)) AS channel,
|
||||
mozfun.stats.mode_last(ARRAY_AGG(normalized_os)) AS os,
|
||||
mozfun.stats.mode_last(ARRAY_AGG(normalized_os_version)) AS os_version,
|
||||
-- ping info
|
||||
mozfun.map.mode_last(ARRAY_CONCAT_AGG(experiments)) AS experiments
|
||||
FROM
|
||||
joined
|
||||
GROUP BY
|
||||
submission_date,
|
||||
client_id,
|
||||
sample_id
|
|
@ -1,5 +1,3 @@
|
|||
# Generated by ./bqetl generate events_daily
|
||||
|
||||
---
|
||||
friendly_name: 'Google Ad Campaign Cost Breakdown'
|
||||
description: >
|
||||
|
|
|
@ -1,8 +0,0 @@
|
|||
-- Generated by ./bqetl generate events_daily
|
||||
CREATE OR REPLACE VIEW
|
||||
`moz-fx-data-shared-prod.firefox_accounts.event_types`
|
||||
AS
|
||||
SELECT
|
||||
*
|
||||
FROM
|
||||
`moz-fx-data-shared-prod.firefox_accounts_derived.event_types_v1`
|
|
@ -1,8 +0,0 @@
|
|||
-- Generated by ./bqetl generate events_daily
|
||||
CREATE OR REPLACE VIEW
|
||||
`moz-fx-data-shared-prod.firefox_accounts.events_daily`
|
||||
AS
|
||||
SELECT
|
||||
*
|
||||
FROM
|
||||
`moz-fx-data-shared-prod.firefox_accounts_derived.events_daily_v1`
|
|
@ -1,153 +0,0 @@
|
|||
-- Generated by ./bqetl generate events_daily
|
||||
CREATE OR REPLACE TABLE
|
||||
firefox_accounts_derived.event_types_history_v1
|
||||
PARTITION BY
|
||||
submission_date
|
||||
CLUSTER BY
|
||||
category,
|
||||
event
|
||||
AS
|
||||
WITH source AS (
|
||||
SELECT
|
||||
*
|
||||
FROM
|
||||
firefox_accounts_derived.funnel_events_source_v1
|
||||
),
|
||||
sample AS (
|
||||
SELECT
|
||||
*
|
||||
FROM
|
||||
source
|
||||
WHERE
|
||||
submission_date >= '2020-01-01'
|
||||
),
|
||||
primary_event_types AS (
|
||||
SELECT
|
||||
category,
|
||||
event,
|
||||
MIN(timestamp) AS first_timestamp,
|
||||
ROW_NUMBER() OVER (ORDER BY MIN(timestamp) ASC, category ASC, event ASC) AS primary_index,
|
||||
FROM
|
||||
sample
|
||||
GROUP BY
|
||||
category,
|
||||
event
|
||||
),
|
||||
event_property_indices AS (
|
||||
SELECT
|
||||
category,
|
||||
event,
|
||||
MIN(timestamp) AS first_timestamp,
|
||||
event_property.key AS event_property,
|
||||
ROW_NUMBER() OVER (
|
||||
PARTITION BY
|
||||
category,
|
||||
event
|
||||
ORDER BY
|
||||
MIN(timestamp) ASC,
|
||||
event_property.key ASC
|
||||
) AS event_property_index,
|
||||
FROM
|
||||
sample,
|
||||
UNNEST(extra) AS event_property
|
||||
LEFT JOIN
|
||||
UNNEST(CAST([] AS ARRAY<STRING>)) skipped_property
|
||||
ON skipped_property = event_property.key
|
||||
WHERE
|
||||
skipped_property IS NULL
|
||||
GROUP BY
|
||||
category,
|
||||
event,
|
||||
event_property
|
||||
),
|
||||
event_property_value_indices AS (
|
||||
SELECT
|
||||
category,
|
||||
event,
|
||||
MIN(timestamp) AS first_timestamp,
|
||||
event_property.key AS event_property,
|
||||
event_property.value AS event_property_value,
|
||||
ROW_NUMBER() OVER (
|
||||
PARTITION BY
|
||||
category,
|
||||
event,
|
||||
event_property.key
|
||||
ORDER BY
|
||||
MIN(timestamp) ASC,
|
||||
event_property.value ASC
|
||||
) AS event_property_value_index,
|
||||
FROM
|
||||
sample,
|
||||
UNNEST(extra) AS event_property
|
||||
GROUP BY
|
||||
category,
|
||||
event,
|
||||
event_property,
|
||||
event_property_value
|
||||
),
|
||||
per_event_property AS (
|
||||
SELECT
|
||||
category,
|
||||
event,
|
||||
event_property,
|
||||
event_property_index,
|
||||
ARRAY_AGG(
|
||||
STRUCT(
|
||||
event_property_value AS key,
|
||||
udf.event_code_points_to_string([event_property_value_index]) AS value,
|
||||
event_property_value_index AS index
|
||||
)
|
||||
ORDER BY
|
||||
event_property_value_index ASC
|
||||
) AS values,
|
||||
FROM
|
||||
event_property_value_indices
|
||||
INNER JOIN
|
||||
event_property_indices
|
||||
USING (category, event, event_property)
|
||||
WHERE
|
||||
event_property_value_index <= 1000
|
||||
GROUP BY
|
||||
category,
|
||||
event,
|
||||
event_property,
|
||||
event_property_index
|
||||
),
|
||||
per_event AS (
|
||||
SELECT
|
||||
category,
|
||||
event,
|
||||
first_timestamp,
|
||||
primary_index AS numeric_index,
|
||||
udf.event_code_points_to_string([primary_index]) AS index,
|
||||
ARRAY_AGG(
|
||||
IF(
|
||||
event_property IS NULL,
|
||||
NULL,
|
||||
STRUCT(event_property AS key, VALUES AS value, event_property_index AS index)
|
||||
) IGNORE NULLS
|
||||
ORDER BY
|
||||
event_property_index ASC
|
||||
) AS event_properties
|
||||
FROM
|
||||
primary_event_types
|
||||
LEFT JOIN
|
||||
per_event_property
|
||||
USING (category, event)
|
||||
GROUP BY
|
||||
category,
|
||||
event,
|
||||
first_timestamp,
|
||||
primary_index
|
||||
),
|
||||
max_date AS (
|
||||
SELECT
|
||||
MAX(submission_date) AS submission_date
|
||||
FROM
|
||||
sample
|
||||
)
|
||||
SELECT
|
||||
*
|
||||
FROM
|
||||
per_event,
|
||||
max_date
|
|
@ -1,28 +0,0 @@
|
|||
# Generated by ./bqetl generate events_daily
|
||||
|
||||
---
|
||||
friendly_name: 'Firefox Accounts Event Types History'
|
||||
description: >
|
||||
Retrieve the set of [events, event_properties]
|
||||
and record them in a table.
|
||||
This table stores all of history, partitioned by
|
||||
submission_date.
|
||||
owners:
|
||||
- wlachance@mozilla.com
|
||||
- akomar@mozilla.com
|
||||
labels:
|
||||
application: firefox_accounts
|
||||
incremental: true
|
||||
schedule: daily
|
||||
scheduling:
|
||||
dag_name: bqetl_event_rollup
|
||||
depends_on_past: true
|
||||
bigquery:
|
||||
time_partitioning:
|
||||
type: day
|
||||
field: submission_date
|
||||
require_partition_filter: false
|
||||
clustering:
|
||||
fields:
|
||||
- category
|
||||
- event
|
|
@ -1,251 +0,0 @@
|
|||
-- Generated by ./bqetl generate events_daily
|
||||
WITH all_events AS (
|
||||
SELECT
|
||||
*
|
||||
FROM
|
||||
firefox_accounts_derived.funnel_events_source_v1
|
||||
),
|
||||
current_events AS (
|
||||
SELECT
|
||||
*
|
||||
FROM
|
||||
all_events
|
||||
WHERE
|
||||
submission_date = @submission_date
|
||||
),
|
||||
event_types AS (
|
||||
SELECT
|
||||
*
|
||||
FROM
|
||||
firefox_accounts_derived.event_types_history_v1
|
||||
WHERE
|
||||
submission_date = DATE_SUB(@submission_date, INTERVAL 1 DAY)
|
||||
),
|
||||
new_primary_event_types AS (
|
||||
SELECT
|
||||
category,
|
||||
event,
|
||||
MIN(timestamp) AS first_timestamp,
|
||||
ROW_NUMBER() OVER (ORDER BY MIN(timestamp) ASC, category ASC, event ASC) + (
|
||||
SELECT
|
||||
MAX(numeric_index)
|
||||
FROM
|
||||
event_types
|
||||
) AS numeric_index,
|
||||
0 AS max_event_property_index
|
||||
FROM
|
||||
current_events
|
||||
LEFT JOIN
|
||||
event_types
|
||||
USING (category, event)
|
||||
WHERE
|
||||
event_types.event IS NULL
|
||||
GROUP BY
|
||||
category,
|
||||
event
|
||||
),
|
||||
all_primary_event_types AS (
|
||||
SELECT
|
||||
*
|
||||
FROM
|
||||
new_primary_event_types
|
||||
UNION ALL
|
||||
SELECT
|
||||
category,
|
||||
event,
|
||||
first_timestamp,
|
||||
numeric_index,
|
||||
MAX(COALESCE(event_property.index, 0)) AS max_event_property_index
|
||||
FROM
|
||||
event_types
|
||||
LEFT JOIN
|
||||
UNNEST(event_properties) AS event_property
|
||||
GROUP BY
|
||||
category,
|
||||
event,
|
||||
first_timestamp,
|
||||
numeric_index
|
||||
),
|
||||
new_event_property_indices AS (
|
||||
SELECT
|
||||
category,
|
||||
event,
|
||||
event_property.key AS event_property,
|
||||
ROW_NUMBER() OVER (
|
||||
PARTITION BY
|
||||
category,
|
||||
event
|
||||
ORDER BY
|
||||
MIN(timestamp) ASC,
|
||||
event_property.key ASC
|
||||
) + ANY_VALUE(max_event_property_index) AS event_property_index,
|
||||
0 AS max_event_property_value_index
|
||||
FROM
|
||||
current_events,
|
||||
UNNEST(extra) AS event_property
|
||||
LEFT JOIN
|
||||
(SELECT * FROM event_types, UNNEST(event_properties)) event_types
|
||||
USING (category, event, key)
|
||||
JOIN
|
||||
all_primary_event_types
|
||||
USING (event, category)
|
||||
LEFT JOIN
|
||||
UNNEST(CAST([] AS ARRAY<STRING>)) skipped_property
|
||||
ON skipped_property = event_property.key
|
||||
WHERE
|
||||
skipped_property IS NULL
|
||||
AND event_types.event IS NULL
|
||||
GROUP BY
|
||||
category,
|
||||
event,
|
||||
event_property
|
||||
),
|
||||
all_event_property_indices AS (
|
||||
SELECT
|
||||
*
|
||||
FROM
|
||||
new_event_property_indices
|
||||
UNION ALL
|
||||
SELECT
|
||||
category,
|
||||
event,
|
||||
event_property.key AS event_property,
|
||||
event_property.index AS event_property_index,
|
||||
MAX(COALESCE(`values`.index, 0)) AS max_event_property_value_index
|
||||
FROM
|
||||
event_types
|
||||
LEFT JOIN
|
||||
UNNEST(event_properties) AS event_property
|
||||
LEFT JOIN
|
||||
UNNEST(value) AS `values`
|
||||
GROUP BY
|
||||
category,
|
||||
event,
|
||||
first_timestamp,
|
||||
event_property,
|
||||
event_property_index
|
||||
),
|
||||
new_event_property_value_indices AS (
|
||||
SELECT
|
||||
current_events.category,
|
||||
current_events.event,
|
||||
event_property.key AS event_property,
|
||||
event_property.value AS event_property_value,
|
||||
ROW_NUMBER() OVER (
|
||||
PARTITION BY
|
||||
current_events.category,
|
||||
current_events.event,
|
||||
event_property.key
|
||||
ORDER BY
|
||||
MIN(timestamp) ASC,
|
||||
event_property.value ASC
|
||||
) + ANY_VALUE(max_event_property_value_index) AS event_property_value_index,
|
||||
FROM
|
||||
current_events,
|
||||
UNNEST(extra) AS event_property
|
||||
LEFT JOIN
|
||||
(
|
||||
SELECT
|
||||
event_types.* EXCEPT (event_properties),
|
||||
existing_event_property,
|
||||
`values`
|
||||
FROM
|
||||
event_types,
|
||||
UNNEST(event_properties) AS existing_event_property,
|
||||
UNNEST(value) AS `values`
|
||||
) AS existing_event_type_values
|
||||
ON current_events.category = existing_event_type_values.category
|
||||
AND current_events.event = existing_event_type_values.event
|
||||
AND event_property.key = existing_event_type_values.existing_event_property.key
|
||||
AND event_property.value = existing_event_type_values.`values`.key
|
||||
JOIN
|
||||
all_event_property_indices
|
||||
ON all_event_property_indices.category = current_events.category
|
||||
AND all_event_property_indices.event = current_events.event
|
||||
AND all_event_property_indices.event_property = event_property.key
|
||||
WHERE
|
||||
existing_event_type_values.event IS NULL
|
||||
GROUP BY
|
||||
category,
|
||||
event,
|
||||
event_property,
|
||||
event_property_value
|
||||
),
|
||||
all_event_property_value_indices AS (
|
||||
SELECT
|
||||
*
|
||||
FROM
|
||||
new_event_property_value_indices
|
||||
WHERE
|
||||
-- Doesn't remove historical event_property values
|
||||
event_property_value_index <= 1000
|
||||
UNION ALL
|
||||
SELECT
|
||||
category,
|
||||
event,
|
||||
event_property.key AS event_property,
|
||||
`values`.key AS event_property_value,
|
||||
`values`.index AS event_property_value_index
|
||||
FROM
|
||||
event_types,
|
||||
UNNEST(event_properties) AS event_property,
|
||||
UNNEST(value) AS `values`
|
||||
),
|
||||
per_event_property AS (
|
||||
SELECT
|
||||
category,
|
||||
event,
|
||||
event_property,
|
||||
event_property_index,
|
||||
ARRAY_AGG(
|
||||
STRUCT(
|
||||
event_property_value AS key,
|
||||
udf.event_code_points_to_string([event_property_value_index]) AS value,
|
||||
event_property_value_index AS index
|
||||
)
|
||||
ORDER BY
|
||||
event_property_value_index ASC
|
||||
) AS `values`,
|
||||
FROM
|
||||
all_event_property_value_indices
|
||||
INNER JOIN
|
||||
all_event_property_indices
|
||||
USING (category, event, event_property)
|
||||
GROUP BY
|
||||
category,
|
||||
event,
|
||||
event_property,
|
||||
event_property_index
|
||||
),
|
||||
per_event AS (
|
||||
SELECT
|
||||
category,
|
||||
event,
|
||||
first_timestamp,
|
||||
numeric_index,
|
||||
udf.event_code_points_to_string([numeric_index]) AS index,
|
||||
ARRAY_AGG(
|
||||
IF(
|
||||
event_property IS NULL,
|
||||
NULL,
|
||||
STRUCT(event_property AS key, `values` AS value, event_property_index AS index)
|
||||
) IGNORE NULLS
|
||||
ORDER BY
|
||||
event_property_index ASC
|
||||
) AS event_properties
|
||||
FROM
|
||||
all_primary_event_types
|
||||
LEFT JOIN
|
||||
per_event_property
|
||||
USING (category, event)
|
||||
GROUP BY
|
||||
category,
|
||||
event,
|
||||
first_timestamp,
|
||||
numeric_index
|
||||
)
|
||||
SELECT
|
||||
@submission_date AS submission_date,
|
||||
*
|
||||
FROM
|
||||
per_event
|
|
@ -1,44 +0,0 @@
|
|||
# Generated by ./bqetl generate events_daily
|
||||
|
||||
fields:
|
||||
- mode: NULLABLE
|
||||
name: submission_date
|
||||
type: DATE
|
||||
- mode: NULLABLE
|
||||
name: category
|
||||
type: STRING
|
||||
- mode: NULLABLE
|
||||
name: event
|
||||
type: STRING
|
||||
- mode: NULLABLE
|
||||
name: first_timestamp
|
||||
type: TIMESTAMP
|
||||
- mode: NULLABLE
|
||||
name: numeric_index
|
||||
type: INTEGER
|
||||
- mode: NULLABLE
|
||||
name: index
|
||||
type: STRING
|
||||
- fields:
|
||||
- mode: NULLABLE
|
||||
name: key
|
||||
type: STRING
|
||||
- fields:
|
||||
- mode: NULLABLE
|
||||
name: key
|
||||
type: STRING
|
||||
- mode: NULLABLE
|
||||
name: value
|
||||
type: STRING
|
||||
- mode: NULLABLE
|
||||
name: index
|
||||
type: INTEGER
|
||||
mode: REPEATED
|
||||
name: value
|
||||
type: RECORD
|
||||
- mode: NULLABLE
|
||||
name: index
|
||||
type: INTEGER
|
||||
mode: REPEATED
|
||||
name: event_properties
|
||||
type: RECORD
|
|
@ -1,8 +0,0 @@
|
|||
-- Generated by ./bqetl generate events_daily
|
||||
CREATE OR REPLACE TABLE
|
||||
firefox_accounts_derived.event_types_v1
|
||||
AS
|
||||
SELECT
|
||||
* EXCEPT (submission_date)
|
||||
FROM
|
||||
firefox_accounts_derived.event_types_history_v1
|
|
@ -1,17 +0,0 @@
|
|||
# Generated by ./bqetl generate events_daily
|
||||
|
||||
---
|
||||
friendly_name: Firefox Accounts Event Types
|
||||
description: >
|
||||
A materialized view of the most recent day of event_types data
|
||||
owners:
|
||||
- wlachance@mozilla.com
|
||||
- akomar@mozilla.com
|
||||
labels:
|
||||
application: firefox_accounts
|
||||
incremental: false
|
||||
schedule: daily
|
||||
scheduling:
|
||||
dag_name: bqetl_event_rollup
|
||||
date_partition_parameter: null
|
||||
parameters: ["submission_date:DATE:{{ds}}"]
|
|
@ -1,7 +0,0 @@
|
|||
-- Generated by ./bqetl generate events_daily
|
||||
SELECT
|
||||
* EXCEPT (submission_date)
|
||||
FROM
|
||||
firefox_accounts_derived.event_types_history_v1
|
||||
WHERE
|
||||
submission_date = @submission_date
|
|
@ -1,39 +0,0 @@
|
|||
fields:
|
||||
- name: category
|
||||
type: STRING
|
||||
mode: NULLABLE
|
||||
- name: event
|
||||
type: STRING
|
||||
mode: NULLABLE
|
||||
- name: first_timestamp
|
||||
type: TIMESTAMP
|
||||
mode: NULLABLE
|
||||
- name: numeric_index
|
||||
type: INTEGER
|
||||
mode: NULLABLE
|
||||
- name: index
|
||||
type: STRING
|
||||
mode: NULLABLE
|
||||
- name: event_properties
|
||||
type: RECORD
|
||||
mode: REPEATED
|
||||
fields:
|
||||
- name: key
|
||||
type: STRING
|
||||
mode: NULLABLE
|
||||
- name: value
|
||||
type: RECORD
|
||||
mode: REPEATED
|
||||
fields:
|
||||
- name: key
|
||||
type: STRING
|
||||
mode: NULLABLE
|
||||
- name: value
|
||||
type: STRING
|
||||
mode: NULLABLE
|
||||
- name: index
|
||||
type: INTEGER
|
||||
mode: NULLABLE
|
||||
- name: index
|
||||
type: INTEGER
|
||||
mode: NULLABLE
|
|
@ -1,37 +0,0 @@
|
|||
-- Generated by ./bqetl generate events_daily
|
||||
CREATE OR REPLACE TABLE
|
||||
firefox_accounts_derived.events_daily_v1
|
||||
PARTITION BY
|
||||
submission_date
|
||||
CLUSTER BY
|
||||
sample_id
|
||||
OPTIONS
|
||||
(require_partition_filter = TRUE)
|
||||
AS
|
||||
SELECT
|
||||
CAST(NULL AS date) AS submission_date,
|
||||
CAST(NULL AS STRING) AS client_id,
|
||||
CAST(NULL AS INT64) AS sample_id,
|
||||
CAST(NULL AS STRING) AS events,
|
||||
-- client info
|
||||
CAST(NULL AS STRING) AS utm_term,
|
||||
CAST(NULL AS STRING) AS utm_source,
|
||||
CAST(NULL AS STRING) AS utm_medium,
|
||||
CAST(NULL AS STRING) AS utm_campaign,
|
||||
CAST(NULL AS STRING) AS ua_version,
|
||||
CAST(NULL AS STRING) AS ua_browser,
|
||||
CAST(NULL AS STRING) AS entrypoint,
|
||||
CAST(NULL AS STRING) AS flow_id,
|
||||
CAST(NULL AS STRING) AS sync_device_count,
|
||||
CAST(NULL AS STRING) AS sync_active_devices_day,
|
||||
CAST(NULL AS STRING) AS sync_active_devices_week,
|
||||
CAST(NULL AS STRING) AS sync_active_devices_month,
|
||||
CAST(NULL AS STRING) AS app_version,
|
||||
CAST(NULL AS STRING) AS os_name,
|
||||
CAST(NULL AS STRING) AS os_version,
|
||||
CAST(NULL AS STRING) AS country,
|
||||
CAST(NULL AS STRING) AS language,
|
||||
-- metadata
|
||||
-- normalized fields
|
||||
-- ping info
|
||||
CAST(NULL AS ARRAY<STRUCT<key STRING, value STRING>>) AS experiments
|
|
@ -1,23 +0,0 @@
|
|||
# Generated by ./bqetl generate events_daily
|
||||
|
||||
---
|
||||
friendly_name: 'Firefox Accounts Events Daily'
|
||||
description: >
|
||||
Packed event representation with one-row per-client
|
||||
owners:
|
||||
- wlachance@mozilla.com
|
||||
- akomar@mozilla.com
|
||||
labels:
|
||||
application: firefox_accounts
|
||||
schedule: daily
|
||||
incremental: true
|
||||
scheduling:
|
||||
dag_name: bqetl_event_rollup
|
||||
bigquery:
|
||||
time_partitioning:
|
||||
type: day
|
||||
field: submission_date
|
||||
require_partition_filter: true
|
||||
clustering:
|
||||
fields:
|
||||
- sample_id
|
|
@ -1,62 +0,0 @@
|
|||
-- Generated by ./bqetl generate events_daily
|
||||
WITH sample AS (
|
||||
SELECT
|
||||
*
|
||||
FROM
|
||||
firefox_accounts_derived.funnel_events_source_v1
|
||||
),
|
||||
events AS (
|
||||
SELECT
|
||||
*
|
||||
FROM
|
||||
sample
|
||||
WHERE
|
||||
(
|
||||
submission_date = @submission_date
|
||||
OR (@submission_date IS NULL AND submission_date >= '2020-01-01')
|
||||
)
|
||||
AND client_id IS NOT NULL
|
||||
),
|
||||
joined AS (
|
||||
SELECT
|
||||
CONCAT(udf.pack_event_properties(events.extra, event_types.event_properties), index) AS index,
|
||||
events.* EXCEPT (category, event, extra)
|
||||
FROM
|
||||
events
|
||||
INNER JOIN
|
||||
firefox_accounts.event_types event_types
|
||||
USING (category, event)
|
||||
)
|
||||
SELECT
|
||||
submission_date,
|
||||
client_id,
|
||||
sample_id,
|
||||
CONCAT(STRING_AGG(index, ',' ORDER BY timestamp ASC), ',') AS events,
|
||||
-- client info
|
||||
mozfun.stats.mode_last(ARRAY_AGG(utm_term)) AS utm_term,
|
||||
mozfun.stats.mode_last(ARRAY_AGG(utm_source)) AS utm_source,
|
||||
mozfun.stats.mode_last(ARRAY_AGG(utm_medium)) AS utm_medium,
|
||||
mozfun.stats.mode_last(ARRAY_AGG(utm_campaign)) AS utm_campaign,
|
||||
mozfun.stats.mode_last(ARRAY_AGG(ua_version)) AS ua_version,
|
||||
mozfun.stats.mode_last(ARRAY_AGG(ua_browser)) AS ua_browser,
|
||||
mozfun.stats.mode_last(ARRAY_AGG(entrypoint)) AS entrypoint,
|
||||
mozfun.stats.mode_last(ARRAY_AGG(flow_id)) AS flow_id,
|
||||
mozfun.stats.mode_last(ARRAY_AGG(sync_device_count)) AS sync_device_count,
|
||||
mozfun.stats.mode_last(ARRAY_AGG(sync_active_devices_day)) AS sync_active_devices_day,
|
||||
mozfun.stats.mode_last(ARRAY_AGG(sync_active_devices_week)) AS sync_active_devices_week,
|
||||
mozfun.stats.mode_last(ARRAY_AGG(sync_active_devices_month)) AS sync_active_devices_month,
|
||||
mozfun.stats.mode_last(ARRAY_AGG(app_version)) AS app_version,
|
||||
mozfun.stats.mode_last(ARRAY_AGG(os_name)) AS os_name,
|
||||
mozfun.stats.mode_last(ARRAY_AGG(os_version)) AS os_version,
|
||||
mozfun.stats.mode_last(ARRAY_AGG(country)) AS country,
|
||||
mozfun.stats.mode_last(ARRAY_AGG(LANGUAGE)) AS language,
|
||||
-- metadata
|
||||
-- normalized fields
|
||||
-- ping info
|
||||
mozfun.map.mode_last(ARRAY_CONCAT_AGG(experiments)) AS experiments
|
||||
FROM
|
||||
joined
|
||||
GROUP BY
|
||||
submission_date,
|
||||
client_id,
|
||||
sample_id
|
|
@ -1,74 +0,0 @@
|
|||
fields:
|
||||
- name: submission_date
|
||||
type: DATE
|
||||
mode: NULLABLE
|
||||
- name: client_id
|
||||
type: STRING
|
||||
mode: NULLABLE
|
||||
- name: sample_id
|
||||
type: INTEGER
|
||||
mode: NULLABLE
|
||||
- name: events
|
||||
type: STRING
|
||||
mode: NULLABLE
|
||||
- name: utm_term
|
||||
type: STRING
|
||||
mode: NULLABLE
|
||||
- name: utm_source
|
||||
type: STRING
|
||||
mode: NULLABLE
|
||||
- name: utm_medium
|
||||
type: STRING
|
||||
mode: NULLABLE
|
||||
- name: utm_campaign
|
||||
type: STRING
|
||||
mode: NULLABLE
|
||||
- name: ua_version
|
||||
type: STRING
|
||||
mode: NULLABLE
|
||||
- name: ua_browser
|
||||
type: STRING
|
||||
mode: NULLABLE
|
||||
- name: entrypoint
|
||||
type: STRING
|
||||
mode: NULLABLE
|
||||
- name: flow_id
|
||||
type: STRING
|
||||
mode: NULLABLE
|
||||
- name: sync_device_count
|
||||
type: STRING
|
||||
mode: NULLABLE
|
||||
- name: sync_active_devices_day
|
||||
type: STRING
|
||||
mode: NULLABLE
|
||||
- name: sync_active_devices_week
|
||||
type: STRING
|
||||
mode: NULLABLE
|
||||
- name: sync_active_devices_month
|
||||
type: STRING
|
||||
mode: NULLABLE
|
||||
- name: app_version
|
||||
type: STRING
|
||||
mode: NULLABLE
|
||||
- name: os_name
|
||||
type: STRING
|
||||
mode: NULLABLE
|
||||
- name: os_version
|
||||
type: STRING
|
||||
mode: NULLABLE
|
||||
- name: country
|
||||
type: STRING
|
||||
mode: NULLABLE
|
||||
- name: language
|
||||
type: STRING
|
||||
mode: NULLABLE
|
||||
- name: experiments
|
||||
type: RECORD
|
||||
mode: REPEATED
|
||||
fields:
|
||||
- name: key
|
||||
type: STRING
|
||||
mode: NULLABLE
|
||||
- name: value
|
||||
type: STRING
|
||||
mode: NULLABLE
|
|
@ -1,8 +0,0 @@
|
|||
-- Generated by ./bqetl generate events_daily
|
||||
CREATE OR REPLACE VIEW
|
||||
`moz-fx-data-shared-prod.messaging_system.event_types`
|
||||
AS
|
||||
SELECT
|
||||
*
|
||||
FROM
|
||||
`moz-fx-data-shared-prod.messaging_system_derived.event_types_v1`
|
|
@ -1,8 +0,0 @@
|
|||
-- Generated by ./bqetl generate events_daily
|
||||
CREATE OR REPLACE VIEW
|
||||
`moz-fx-data-shared-prod.messaging_system.events_daily`
|
||||
AS
|
||||
SELECT
|
||||
*
|
||||
FROM
|
||||
`moz-fx-data-shared-prod.messaging_system_derived.events_daily_v1`
|
|
@ -1,153 +0,0 @@
|
|||
-- Generated by ./bqetl generate events_daily
|
||||
CREATE OR REPLACE TABLE
|
||||
messaging_system_derived.event_types_history_v1
|
||||
PARTITION BY
|
||||
submission_date
|
||||
CLUSTER BY
|
||||
category,
|
||||
event
|
||||
AS
|
||||
WITH source AS (
|
||||
SELECT
|
||||
*
|
||||
FROM
|
||||
messaging_system_derived.normalized_onboarding_events
|
||||
),
|
||||
sample AS (
|
||||
SELECT
|
||||
*
|
||||
FROM
|
||||
source
|
||||
WHERE
|
||||
submission_date >= '2020-01-01'
|
||||
),
|
||||
primary_event_types AS (
|
||||
SELECT
|
||||
category,
|
||||
event,
|
||||
MIN(timestamp) AS first_timestamp,
|
||||
ROW_NUMBER() OVER (ORDER BY MIN(timestamp) ASC, category ASC, event ASC) AS primary_index,
|
||||
FROM
|
||||
sample
|
||||
GROUP BY
|
||||
category,
|
||||
event
|
||||
),
|
||||
event_property_indices AS (
|
||||
SELECT
|
||||
category,
|
||||
event,
|
||||
MIN(timestamp) AS first_timestamp,
|
||||
event_property.key AS event_property,
|
||||
ROW_NUMBER() OVER (
|
||||
PARTITION BY
|
||||
category,
|
||||
event
|
||||
ORDER BY
|
||||
MIN(timestamp) ASC,
|
||||
event_property.key ASC
|
||||
) AS event_property_index,
|
||||
FROM
|
||||
sample,
|
||||
UNNEST(extra) AS event_property
|
||||
LEFT JOIN
|
||||
UNNEST(CAST([] AS ARRAY<STRING>)) skipped_property
|
||||
ON skipped_property = event_property.key
|
||||
WHERE
|
||||
skipped_property IS NULL
|
||||
GROUP BY
|
||||
category,
|
||||
event,
|
||||
event_property
|
||||
),
|
||||
event_property_value_indices AS (
|
||||
SELECT
|
||||
category,
|
||||
event,
|
||||
MIN(timestamp) AS first_timestamp,
|
||||
event_property.key AS event_property,
|
||||
event_property.value AS event_property_value,
|
||||
ROW_NUMBER() OVER (
|
||||
PARTITION BY
|
||||
category,
|
||||
event,
|
||||
event_property.key
|
||||
ORDER BY
|
||||
MIN(timestamp) ASC,
|
||||
event_property.value ASC
|
||||
) AS event_property_value_index,
|
||||
FROM
|
||||
sample,
|
||||
UNNEST(extra) AS event_property
|
||||
GROUP BY
|
||||
category,
|
||||
event,
|
||||
event_property,
|
||||
event_property_value
|
||||
),
|
||||
per_event_property AS (
|
||||
SELECT
|
||||
category,
|
||||
event,
|
||||
event_property,
|
||||
event_property_index,
|
||||
ARRAY_AGG(
|
||||
STRUCT(
|
||||
event_property_value AS key,
|
||||
udf.event_code_points_to_string([event_property_value_index]) AS value,
|
||||
event_property_value_index AS index
|
||||
)
|
||||
ORDER BY
|
||||
event_property_value_index ASC
|
||||
) AS values,
|
||||
FROM
|
||||
event_property_value_indices
|
||||
INNER JOIN
|
||||
event_property_indices
|
||||
USING (category, event, event_property)
|
||||
WHERE
|
||||
event_property_value_index <= 1000
|
||||
GROUP BY
|
||||
category,
|
||||
event,
|
||||
event_property,
|
||||
event_property_index
|
||||
),
|
||||
per_event AS (
|
||||
SELECT
|
||||
category,
|
||||
event,
|
||||
first_timestamp,
|
||||
primary_index AS numeric_index,
|
||||
udf.event_code_points_to_string([primary_index]) AS index,
|
||||
ARRAY_AGG(
|
||||
IF(
|
||||
event_property IS NULL,
|
||||
NULL,
|
||||
STRUCT(event_property AS key, VALUES AS value, event_property_index AS index)
|
||||
) IGNORE NULLS
|
||||
ORDER BY
|
||||
event_property_index ASC
|
||||
) AS event_properties
|
||||
FROM
|
||||
primary_event_types
|
||||
LEFT JOIN
|
||||
per_event_property
|
||||
USING (category, event)
|
||||
GROUP BY
|
||||
category,
|
||||
event,
|
||||
first_timestamp,
|
||||
primary_index
|
||||
),
|
||||
max_date AS (
|
||||
SELECT
|
||||
MAX(submission_date) AS submission_date
|
||||
FROM
|
||||
sample
|
||||
)
|
||||
SELECT
|
||||
*
|
||||
FROM
|
||||
per_event,
|
||||
max_date
|
|
@ -1,28 +0,0 @@
|
|||
# Generated by ./bqetl generate events_daily
|
||||
|
||||
---
|
||||
friendly_name: 'Firefox Messaging System Event Types History'
|
||||
description: >
|
||||
Retrieve the set of [events, event_properties]
|
||||
and record them in a table.
|
||||
This table stores all of history, partitioned by
|
||||
submission_date.
|
||||
owners:
|
||||
- wlachance@mozilla.com
|
||||
- akomar@mozilla.com
|
||||
labels:
|
||||
application: messaging_system
|
||||
incremental: true
|
||||
schedule: daily
|
||||
scheduling:
|
||||
dag_name: bqetl_event_rollup
|
||||
depends_on_past: true
|
||||
bigquery:
|
||||
time_partitioning:
|
||||
type: day
|
||||
field: submission_date
|
||||
require_partition_filter: false
|
||||
clustering:
|
||||
fields:
|
||||
- category
|
||||
- event
|
|
@ -1,251 +0,0 @@
|
|||
-- Generated by ./bqetl generate events_daily
|
||||
WITH all_events AS (
|
||||
SELECT
|
||||
*
|
||||
FROM
|
||||
messaging_system_derived.normalized_onboarding_events
|
||||
),
|
||||
current_events AS (
|
||||
SELECT
|
||||
*
|
||||
FROM
|
||||
all_events
|
||||
WHERE
|
||||
submission_date = @submission_date
|
||||
),
|
||||
event_types AS (
|
||||
SELECT
|
||||
*
|
||||
FROM
|
||||
messaging_system_derived.event_types_history_v1
|
||||
WHERE
|
||||
submission_date = DATE_SUB(@submission_date, INTERVAL 1 DAY)
|
||||
),
|
||||
new_primary_event_types AS (
|
||||
SELECT
|
||||
category,
|
||||
event,
|
||||
MIN(timestamp) AS first_timestamp,
|
||||
ROW_NUMBER() OVER (ORDER BY MIN(timestamp) ASC, category ASC, event ASC) + (
|
||||
SELECT
|
||||
MAX(numeric_index)
|
||||
FROM
|
||||
event_types
|
||||
) AS numeric_index,
|
||||
0 AS max_event_property_index
|
||||
FROM
|
||||
current_events
|
||||
LEFT JOIN
|
||||
event_types
|
||||
USING (category, event)
|
||||
WHERE
|
||||
event_types.event IS NULL
|
||||
GROUP BY
|
||||
category,
|
||||
event
|
||||
),
|
||||
all_primary_event_types AS (
|
||||
SELECT
|
||||
*
|
||||
FROM
|
||||
new_primary_event_types
|
||||
UNION ALL
|
||||
SELECT
|
||||
category,
|
||||
event,
|
||||
first_timestamp,
|
||||
numeric_index,
|
||||
MAX(COALESCE(event_property.index, 0)) AS max_event_property_index
|
||||
FROM
|
||||
event_types
|
||||
LEFT JOIN
|
||||
UNNEST(event_properties) AS event_property
|
||||
GROUP BY
|
||||
category,
|
||||
event,
|
||||
first_timestamp,
|
||||
numeric_index
|
||||
),
|
||||
new_event_property_indices AS (
|
||||
SELECT
|
||||
category,
|
||||
event,
|
||||
event_property.key AS event_property,
|
||||
ROW_NUMBER() OVER (
|
||||
PARTITION BY
|
||||
category,
|
||||
event
|
||||
ORDER BY
|
||||
MIN(timestamp) ASC,
|
||||
event_property.key ASC
|
||||
) + ANY_VALUE(max_event_property_index) AS event_property_index,
|
||||
0 AS max_event_property_value_index
|
||||
FROM
|
||||
current_events,
|
||||
UNNEST(extra) AS event_property
|
||||
LEFT JOIN
|
||||
(SELECT * FROM event_types, UNNEST(event_properties)) event_types
|
||||
USING (category, event, key)
|
||||
JOIN
|
||||
all_primary_event_types
|
||||
USING (event, category)
|
||||
LEFT JOIN
|
||||
UNNEST(CAST([] AS ARRAY<STRING>)) skipped_property
|
||||
ON skipped_property = event_property.key
|
||||
WHERE
|
||||
skipped_property IS NULL
|
||||
AND event_types.event IS NULL
|
||||
GROUP BY
|
||||
category,
|
||||
event,
|
||||
event_property
|
||||
),
|
||||
all_event_property_indices AS (
|
||||
SELECT
|
||||
*
|
||||
FROM
|
||||
new_event_property_indices
|
||||
UNION ALL
|
||||
SELECT
|
||||
category,
|
||||
event,
|
||||
event_property.key AS event_property,
|
||||
event_property.index AS event_property_index,
|
||||
MAX(COALESCE(`values`.index, 0)) AS max_event_property_value_index
|
||||
FROM
|
||||
event_types
|
||||
LEFT JOIN
|
||||
UNNEST(event_properties) AS event_property
|
||||
LEFT JOIN
|
||||
UNNEST(value) AS `values`
|
||||
GROUP BY
|
||||
category,
|
||||
event,
|
||||
first_timestamp,
|
||||
event_property,
|
||||
event_property_index
|
||||
),
|
||||
new_event_property_value_indices AS (
|
||||
SELECT
|
||||
current_events.category,
|
||||
current_events.event,
|
||||
event_property.key AS event_property,
|
||||
event_property.value AS event_property_value,
|
||||
ROW_NUMBER() OVER (
|
||||
PARTITION BY
|
||||
current_events.category,
|
||||
current_events.event,
|
||||
event_property.key
|
||||
ORDER BY
|
||||
MIN(timestamp) ASC,
|
||||
event_property.value ASC
|
||||
) + ANY_VALUE(max_event_property_value_index) AS event_property_value_index,
|
||||
FROM
|
||||
current_events,
|
||||
UNNEST(extra) AS event_property
|
||||
LEFT JOIN
|
||||
(
|
||||
SELECT
|
||||
event_types.* EXCEPT (event_properties),
|
||||
existing_event_property,
|
||||
`values`
|
||||
FROM
|
||||
event_types,
|
||||
UNNEST(event_properties) AS existing_event_property,
|
||||
UNNEST(value) AS `values`
|
||||
) AS existing_event_type_values
|
||||
ON current_events.category = existing_event_type_values.category
|
||||
AND current_events.event = existing_event_type_values.event
|
||||
AND event_property.key = existing_event_type_values.existing_event_property.key
|
||||
AND event_property.value = existing_event_type_values.`values`.key
|
||||
JOIN
|
||||
all_event_property_indices
|
||||
ON all_event_property_indices.category = current_events.category
|
||||
AND all_event_property_indices.event = current_events.event
|
||||
AND all_event_property_indices.event_property = event_property.key
|
||||
WHERE
|
||||
existing_event_type_values.event IS NULL
|
||||
GROUP BY
|
||||
category,
|
||||
event,
|
||||
event_property,
|
||||
event_property_value
|
||||
),
|
||||
all_event_property_value_indices AS (
|
||||
SELECT
|
||||
*
|
||||
FROM
|
||||
new_event_property_value_indices
|
||||
WHERE
|
||||
-- Doesn't remove historical event_property values
|
||||
event_property_value_index <= 1000
|
||||
UNION ALL
|
||||
SELECT
|
||||
category,
|
||||
event,
|
||||
event_property.key AS event_property,
|
||||
`values`.key AS event_property_value,
|
||||
`values`.index AS event_property_value_index
|
||||
FROM
|
||||
event_types,
|
||||
UNNEST(event_properties) AS event_property,
|
||||
UNNEST(value) AS `values`
|
||||
),
|
||||
per_event_property AS (
|
||||
SELECT
|
||||
category,
|
||||
event,
|
||||
event_property,
|
||||
event_property_index,
|
||||
ARRAY_AGG(
|
||||
STRUCT(
|
||||
event_property_value AS key,
|
||||
udf.event_code_points_to_string([event_property_value_index]) AS value,
|
||||
event_property_value_index AS index
|
||||
)
|
||||
ORDER BY
|
||||
event_property_value_index ASC
|
||||
) AS `values`,
|
||||
FROM
|
||||
all_event_property_value_indices
|
||||
INNER JOIN
|
||||
all_event_property_indices
|
||||
USING (category, event, event_property)
|
||||
GROUP BY
|
||||
category,
|
||||
event,
|
||||
event_property,
|
||||
event_property_index
|
||||
),
|
||||
per_event AS (
|
||||
SELECT
|
||||
category,
|
||||
event,
|
||||
first_timestamp,
|
||||
numeric_index,
|
||||
udf.event_code_points_to_string([numeric_index]) AS index,
|
||||
ARRAY_AGG(
|
||||
IF(
|
||||
event_property IS NULL,
|
||||
NULL,
|
||||
STRUCT(event_property AS key, `values` AS value, event_property_index AS index)
|
||||
) IGNORE NULLS
|
||||
ORDER BY
|
||||
event_property_index ASC
|
||||
) AS event_properties
|
||||
FROM
|
||||
all_primary_event_types
|
||||
LEFT JOIN
|
||||
per_event_property
|
||||
USING (category, event)
|
||||
GROUP BY
|
||||
category,
|
||||
event,
|
||||
first_timestamp,
|
||||
numeric_index
|
||||
)
|
||||
SELECT
|
||||
@submission_date AS submission_date,
|
||||
*
|
||||
FROM
|
||||
per_event
|
|
@ -1,44 +0,0 @@
|
|||
# Generated by ./bqetl generate events_daily
|
||||
|
||||
fields:
|
||||
- mode: NULLABLE
|
||||
name: submission_date
|
||||
type: DATE
|
||||
- mode: NULLABLE
|
||||
name: category
|
||||
type: STRING
|
||||
- mode: NULLABLE
|
||||
name: event
|
||||
type: STRING
|
||||
- mode: NULLABLE
|
||||
name: first_timestamp
|
||||
type: TIMESTAMP
|
||||
- mode: NULLABLE
|
||||
name: numeric_index
|
||||
type: INTEGER
|
||||
- mode: NULLABLE
|
||||
name: index
|
||||
type: STRING
|
||||
- fields:
|
||||
- mode: NULLABLE
|
||||
name: key
|
||||
type: STRING
|
||||
- fields:
|
||||
- mode: NULLABLE
|
||||
name: key
|
||||
type: STRING
|
||||
- mode: NULLABLE
|
||||
name: value
|
||||
type: STRING
|
||||
- mode: NULLABLE
|
||||
name: index
|
||||
type: INTEGER
|
||||
mode: REPEATED
|
||||
name: value
|
||||
type: RECORD
|
||||
- mode: NULLABLE
|
||||
name: index
|
||||
type: INTEGER
|
||||
mode: REPEATED
|
||||
name: event_properties
|
||||
type: RECORD
|
|
@ -1,8 +0,0 @@
|
|||
-- Generated by ./bqetl generate events_daily
|
||||
CREATE OR REPLACE TABLE
|
||||
messaging_system_derived.event_types_v1
|
||||
AS
|
||||
SELECT
|
||||
* EXCEPT (submission_date)
|
||||
FROM
|
||||
messaging_system_derived.event_types_history_v1
|
|
@ -1,16 +0,0 @@
|
|||
# Generated by ./bqetl generate events_daily
|
||||
|
||||
---
|
||||
friendly_name: Firefox Messaging System Event Types
|
||||
description: >
|
||||
A materialized view of the most recent day of event_types data
|
||||
owners:
|
||||
- akomar@mozilla.com
|
||||
labels:
|
||||
application: messaging_system
|
||||
incremental: false
|
||||
schedule: daily
|
||||
scheduling:
|
||||
dag_name: bqetl_event_rollup
|
||||
date_partition_parameter: null
|
||||
parameters: ["submission_date:DATE:{{ds}}"]
|
|
@ -1,7 +0,0 @@
|
|||
-- Generated by ./bqetl generate events_daily
|
||||
SELECT
|
||||
* EXCEPT (submission_date)
|
||||
FROM
|
||||
messaging_system_derived.event_types_history_v1
|
||||
WHERE
|
||||
submission_date = @submission_date
|
|
@ -1,28 +0,0 @@
|
|||
-- Generated by ./bqetl generate events_daily
|
||||
CREATE OR REPLACE TABLE
|
||||
messaging_system_derived.events_daily_v1
|
||||
PARTITION BY
|
||||
submission_date
|
||||
CLUSTER BY
|
||||
sample_id
|
||||
OPTIONS
|
||||
(require_partition_filter = TRUE)
|
||||
AS
|
||||
SELECT
|
||||
CAST(NULL AS date) AS submission_date,
|
||||
CAST(NULL AS STRING) AS client_id,
|
||||
CAST(NULL AS INT64) AS sample_id,
|
||||
CAST(NULL AS STRING) AS events,
|
||||
-- client info
|
||||
CAST(NULL AS STRING) AS app_version,
|
||||
CAST(NULL AS STRING) AS os,
|
||||
CAST(NULL AS STRING) AS addon_version,
|
||||
CAST(NULL AS STRING) AS locale,
|
||||
CAST(NULL AS STRING) AS normalized_channel,
|
||||
-- metadata
|
||||
CAST(NULL AS STRING) AS city,
|
||||
CAST(NULL AS STRING) AS country,
|
||||
CAST(NULL AS STRING) AS subdivision1,
|
||||
-- normalized fields
|
||||
-- ping info
|
||||
CAST(NULL AS ARRAY<STRUCT<key STRING, value STRING>>) AS experiments
|
|
@ -1,22 +0,0 @@
|
|||
# Generated by ./bqetl generate events_daily
|
||||
|
||||
---
|
||||
friendly_name: 'Firefox Messaging System Events Daily'
|
||||
description: >
|
||||
Packed event representation with one-row per-client
|
||||
owners:
|
||||
- akomar@mozilla.com
|
||||
labels:
|
||||
application: messaging_system
|
||||
schedule: daily
|
||||
incremental: true
|
||||
scheduling:
|
||||
dag_name: bqetl_event_rollup
|
||||
bigquery:
|
||||
time_partitioning:
|
||||
type: day
|
||||
field: submission_date
|
||||
require_partition_filter: true
|
||||
clustering:
|
||||
fields:
|
||||
- sample_id
|
|
@ -1,53 +0,0 @@
|
|||
-- Generated by ./bqetl generate events_daily
|
||||
WITH sample AS (
|
||||
SELECT
|
||||
*
|
||||
FROM
|
||||
messaging_system_derived.normalized_onboarding_events
|
||||
),
|
||||
events AS (
|
||||
SELECT
|
||||
*
|
||||
FROM
|
||||
sample
|
||||
WHERE
|
||||
(
|
||||
submission_date = @submission_date
|
||||
OR (@submission_date IS NULL AND submission_date >= '2020-01-01')
|
||||
)
|
||||
AND client_id IS NOT NULL
|
||||
),
|
||||
joined AS (
|
||||
SELECT
|
||||
CONCAT(udf.pack_event_properties(events.extra, event_types.event_properties), index) AS index,
|
||||
events.* EXCEPT (category, event, extra)
|
||||
FROM
|
||||
events
|
||||
INNER JOIN
|
||||
messaging_system.event_types event_types
|
||||
USING (category, event)
|
||||
)
|
||||
SELECT
|
||||
submission_date,
|
||||
client_id,
|
||||
sample_id,
|
||||
CONCAT(STRING_AGG(index, ',' ORDER BY timestamp ASC), ',') AS events,
|
||||
-- client info
|
||||
mozfun.stats.mode_last(ARRAY_AGG(version)) AS app_version,
|
||||
mozfun.stats.mode_last(ARRAY_AGG(metadata.user_agent.os)) AS os,
|
||||
mozfun.stats.mode_last(ARRAY_AGG(addon_version)) AS addon_version,
|
||||
mozfun.stats.mode_last(ARRAY_AGG(locale)) AS locale,
|
||||
mozfun.stats.mode_last(ARRAY_AGG(normalized_channel)) AS normalized_channel,
|
||||
-- metadata
|
||||
mozfun.stats.mode_last(ARRAY_AGG(metadata.geo.city)) AS city,
|
||||
mozfun.stats.mode_last(ARRAY_AGG(metadata.geo.country)) AS country,
|
||||
mozfun.stats.mode_last(ARRAY_AGG(metadata.geo.subdivision1)) AS subdivision1,
|
||||
-- normalized fields
|
||||
-- ping info
|
||||
mozfun.map.mode_last(ARRAY_CONCAT_AGG(experiments)) AS experiments
|
||||
FROM
|
||||
joined
|
||||
GROUP BY
|
||||
submission_date,
|
||||
client_id,
|
||||
sample_id
|
|
@ -1,72 +0,0 @@
|
|||
-- Generated via ./bqetl generate experiment_monitoring
|
||||
CREATE MATERIALIZED VIEW
|
||||
IF
|
||||
NOT EXISTS monitor_cirrus_derived.experiment_events_live_v1
|
||||
OPTIONS
|
||||
(enable_refresh = TRUE, refresh_interval_minutes = 5)
|
||||
AS
|
||||
-- Cirrus apps uses specialized Glean structure per events
|
||||
WITH all_events AS (
|
||||
SELECT
|
||||
submission_timestamp,
|
||||
events
|
||||
FROM
|
||||
`moz-fx-data-shared-prod.monitor_cirrus_live.enrollment_v1`
|
||||
),
|
||||
experiment_events AS (
|
||||
SELECT
|
||||
submission_timestamp AS `timestamp`,
|
||||
event.category AS `type`,
|
||||
CAST(event.extra[SAFE_OFFSET(i)].value AS STRING) AS branch,
|
||||
CAST(event.extra[SAFE_OFFSET(j)].value AS STRING) AS experiment,
|
||||
event.name AS event_method
|
||||
FROM
|
||||
all_events,
|
||||
UNNEST(events) AS event,
|
||||
-- Workaround for https://issuetracker.google.com/issues/182829918
|
||||
-- To prevent having the branch name set to the experiment slug,
|
||||
-- the number of generated array indices needs to be different.
|
||||
UNNEST(GENERATE_ARRAY(0, 50)) AS i,
|
||||
UNNEST(GENERATE_ARRAY(0, 51)) AS j
|
||||
WHERE
|
||||
event.category = 'cirrus_events'
|
||||
AND CAST(event.extra[SAFE_OFFSET(i)].key AS STRING) = 'branch'
|
||||
AND CAST(event.extra[SAFE_OFFSET(j)].key AS STRING) = 'experiment'
|
||||
)
|
||||
SELECT
|
||||
DATE(`timestamp`) AS submission_date,
|
||||
`type`,
|
||||
experiment,
|
||||
branch,
|
||||
TIMESTAMP_ADD(
|
||||
TIMESTAMP_TRUNC(`timestamp`, HOUR),
|
||||
-- Aggregates event counts over 5-minute intervals
|
||||
INTERVAL(DIV(EXTRACT(MINUTE FROM `timestamp`), 5) * 5) MINUTE
|
||||
) AS window_start,
|
||||
TIMESTAMP_ADD(
|
||||
TIMESTAMP_TRUNC(`timestamp`, HOUR),
|
||||
INTERVAL((DIV(EXTRACT(MINUTE FROM `timestamp`), 5) + 1) * 5) MINUTE
|
||||
) AS window_end,
|
||||
COUNTIF(event_method = 'enroll' OR event_method = 'enrollment') AS enroll_count,
|
||||
COUNTIF(event_method = 'unenroll' OR event_method = 'unenrollment') AS unenroll_count,
|
||||
COUNTIF(event_method = 'graduate') AS graduate_count,
|
||||
COUNTIF(event_method = 'update') AS update_count,
|
||||
COUNTIF(event_method = 'enrollFailed') AS enroll_failed_count,
|
||||
COUNTIF(event_method = 'unenrollFailed') AS unenroll_failed_count,
|
||||
COUNTIF(event_method = 'updateFailed') AS update_failed_count,
|
||||
COUNTIF(event_method = 'disqualification') AS disqualification_count,
|
||||
COUNTIF(event_method = 'expose' OR event_method = 'exposure') AS exposure_count,
|
||||
COUNTIF(event_method = 'validationFailed') AS validation_failed_count
|
||||
FROM
|
||||
experiment_events
|
||||
WHERE
|
||||
-- Limit the amount of data the materialized view is going to backfill when created.
|
||||
-- This date can be moved forward whenever new changes of the materialized views need to be deployed.
|
||||
timestamp > TIMESTAMP('2023-10-10')
|
||||
GROUP BY
|
||||
submission_date,
|
||||
`type`,
|
||||
experiment,
|
||||
branch,
|
||||
window_start,
|
||||
window_end
|
|
@ -1,8 +0,0 @@
|
|||
friendly_name: Experiment Events Live
|
||||
description: |-
|
||||
Materialized view of experimentation related events
|
||||
coming from monitor_cirrus.
|
||||
owners:
|
||||
- ascholtz@mozilla.com
|
||||
labels:
|
||||
materialized_view: true
|
|
@ -1,43 +0,0 @@
|
|||
-- Generated via ./bqetl generate experiment_monitoring
|
||||
CREATE MATERIALIZED VIEW
|
||||
IF
|
||||
NOT EXISTS `moz-fx-data-shared-prod.monitor_cirrus_derived.experiment_search_events_live_v1`
|
||||
OPTIONS
|
||||
(enable_refresh = TRUE, refresh_interval_minutes = 5)
|
||||
AS
|
||||
SELECT
|
||||
DATE(submission_timestamp) AS submission_date,
|
||||
experiment.key AS experiment,
|
||||
experiment.value.branch AS branch,
|
||||
TIMESTAMP_ADD(
|
||||
TIMESTAMP_TRUNC(submission_timestamp, HOUR),
|
||||
-- Aggregates event counts over 5-minute intervals
|
||||
INTERVAL(DIV(EXTRACT(MINUTE FROM submission_timestamp), 5) * 5) MINUTE
|
||||
) AS window_start,
|
||||
TIMESTAMP_ADD(
|
||||
TIMESTAMP_TRUNC(submission_timestamp, HOUR),
|
||||
INTERVAL((DIV(EXTRACT(MINUTE FROM submission_timestamp), 5) + 1) * 5) MINUTE
|
||||
) AS window_end,
|
||||
-- Concatenating an element with value = 0 ensures that the count values are not null even if the array is empty
|
||||
-- Materialized views don't support COALESCE or IFNULL
|
||||
SUM(0) AS ad_clicks_count,
|
||||
SUM(0) AS search_with_ads_count,
|
||||
SUM(0) AS search_count,
|
||||
FROM
|
||||
`moz-fx-data-shared-prod.monitor_cirrus_live.enrollment_v1`
|
||||
LEFT JOIN
|
||||
UNNEST(ping_info.experiments) AS experiment
|
||||
-- We don't expect cirrus events to be search events
|
||||
CROSS JOIN
|
||||
-- Max. number of entries is around 10
|
||||
UNNEST(GENERATE_ARRAY(0, 50)) AS i
|
||||
WHERE
|
||||
-- Limit the amount of data the materialized view is going to backfill when created.
|
||||
-- This date can be moved forward whenever new changes of the materialized views need to be deployed.
|
||||
DATE(submission_timestamp) > '2023-10-10'
|
||||
GROUP BY
|
||||
submission_date,
|
||||
experiment,
|
||||
branch,
|
||||
window_start,
|
||||
window_end
|
|
@ -1,8 +0,0 @@
|
|||
friendly_name: Experiment Search Events Live
|
||||
description: |-
|
||||
Materialized view of experimentation related search events
|
||||
coming from monitor_cirrus clients.
|
||||
owners:
|
||||
- ascholtz@mozilla.com
|
||||
labels:
|
||||
materialized_view: true
|
|
@ -1,8 +0,0 @@
|
|||
-- Generated by ./bqetl generate events_daily
|
||||
CREATE OR REPLACE VIEW
|
||||
`moz-fx-data-shared-prod.mozilla_vpn.event_types`
|
||||
AS
|
||||
SELECT
|
||||
*
|
||||
FROM
|
||||
`moz-fx-data-shared-prod.mozilla_vpn_derived.event_types_v1`
|
|
@ -1,8 +0,0 @@
|
|||
-- Generated by ./bqetl generate events_daily
|
||||
CREATE OR REPLACE VIEW
|
||||
`moz-fx-data-shared-prod.mozilla_vpn.events_daily`
|
||||
AS
|
||||
SELECT
|
||||
*
|
||||
FROM
|
||||
`moz-fx-data-shared-prod.mozilla_vpn_derived.events_daily_v1`
|
|
@ -1,181 +0,0 @@
|
|||
-- Generated by ./bqetl generate events_daily
|
||||
CREATE OR REPLACE TABLE
|
||||
mozilla_vpn_derived.event_types_history_v1
|
||||
PARTITION BY
|
||||
submission_date
|
||||
CLUSTER BY
|
||||
category,
|
||||
event
|
||||
AS
|
||||
WITH source AS (
|
||||
SELECT
|
||||
DATE(submission_timestamp) AS submission_date,
|
||||
SAFE.TIMESTAMP_ADD(ping_info.parsed_start_time, INTERVAL timestamp MILLISECOND) AS timestamp,
|
||||
category,
|
||||
name AS event,
|
||||
extra,
|
||||
FROM
|
||||
mozillavpn.main e
|
||||
CROSS JOIN
|
||||
UNNEST(e.events) AS event
|
||||
UNION ALL
|
||||
SELECT
|
||||
DATE(submission_timestamp) AS submission_date,
|
||||
SAFE.TIMESTAMP_ADD(ping_info.parsed_start_time, INTERVAL timestamp MILLISECOND) AS timestamp,
|
||||
category,
|
||||
name AS event,
|
||||
extra,
|
||||
FROM
|
||||
org_mozilla_firefox_vpn.main e
|
||||
CROSS JOIN
|
||||
UNNEST(e.events) AS event
|
||||
UNION ALL
|
||||
SELECT
|
||||
DATE(submission_timestamp) AS submission_date,
|
||||
SAFE.TIMESTAMP_ADD(ping_info.parsed_start_time, INTERVAL timestamp MILLISECOND) AS timestamp,
|
||||
category,
|
||||
name AS event,
|
||||
extra,
|
||||
FROM
|
||||
org_mozilla_ios_firefoxvpn.main e
|
||||
CROSS JOIN
|
||||
UNNEST(e.events) AS event
|
||||
),
|
||||
sample AS (
|
||||
SELECT
|
||||
*
|
||||
FROM
|
||||
source
|
||||
WHERE
|
||||
submission_date >= '2021-10-01'
|
||||
),
|
||||
primary_event_types AS (
|
||||
SELECT
|
||||
category,
|
||||
event,
|
||||
MIN(timestamp) AS first_timestamp,
|
||||
ROW_NUMBER() OVER (ORDER BY MIN(timestamp) ASC, category ASC, event ASC) AS primary_index,
|
||||
FROM
|
||||
sample
|
||||
GROUP BY
|
||||
category,
|
||||
event
|
||||
),
|
||||
event_property_indices AS (
|
||||
SELECT
|
||||
category,
|
||||
event,
|
||||
MIN(timestamp) AS first_timestamp,
|
||||
event_property.key AS event_property,
|
||||
ROW_NUMBER() OVER (
|
||||
PARTITION BY
|
||||
category,
|
||||
event
|
||||
ORDER BY
|
||||
MIN(timestamp) ASC,
|
||||
event_property.key ASC
|
||||
) AS event_property_index,
|
||||
FROM
|
||||
sample,
|
||||
UNNEST(extra) AS event_property
|
||||
LEFT JOIN
|
||||
UNNEST(CAST(['time_ms'] AS ARRAY<STRING>)) skipped_property
|
||||
ON skipped_property = event_property.key
|
||||
WHERE
|
||||
skipped_property IS NULL
|
||||
GROUP BY
|
||||
category,
|
||||
event,
|
||||
event_property
|
||||
),
|
||||
event_property_value_indices AS (
|
||||
SELECT
|
||||
category,
|
||||
event,
|
||||
MIN(timestamp) AS first_timestamp,
|
||||
event_property.key AS event_property,
|
||||
event_property.value AS event_property_value,
|
||||
ROW_NUMBER() OVER (
|
||||
PARTITION BY
|
||||
category,
|
||||
event,
|
||||
event_property.key
|
||||
ORDER BY
|
||||
MIN(timestamp) ASC,
|
||||
event_property.value ASC
|
||||
) AS event_property_value_index,
|
||||
FROM
|
||||
sample,
|
||||
UNNEST(extra) AS event_property
|
||||
GROUP BY
|
||||
category,
|
||||
event,
|
||||
event_property,
|
||||
event_property_value
|
||||
),
|
||||
per_event_property AS (
|
||||
SELECT
|
||||
category,
|
||||
event,
|
||||
event_property,
|
||||
event_property_index,
|
||||
ARRAY_AGG(
|
||||
STRUCT(
|
||||
event_property_value AS key,
|
||||
udf.event_code_points_to_string([event_property_value_index]) AS value,
|
||||
event_property_value_index AS index
|
||||
)
|
||||
ORDER BY
|
||||
event_property_value_index ASC
|
||||
) AS values,
|
||||
FROM
|
||||
event_property_value_indices
|
||||
INNER JOIN
|
||||
event_property_indices
|
||||
USING (category, event, event_property)
|
||||
WHERE
|
||||
event_property_value_index <= 1000
|
||||
GROUP BY
|
||||
category,
|
||||
event,
|
||||
event_property,
|
||||
event_property_index
|
||||
),
|
||||
per_event AS (
|
||||
SELECT
|
||||
category,
|
||||
event,
|
||||
first_timestamp,
|
||||
primary_index AS numeric_index,
|
||||
udf.event_code_points_to_string([primary_index]) AS index,
|
||||
ARRAY_AGG(
|
||||
IF(
|
||||
event_property IS NULL,
|
||||
NULL,
|
||||
STRUCT(event_property AS key, VALUES AS value, event_property_index AS index)
|
||||
) IGNORE NULLS
|
||||
ORDER BY
|
||||
event_property_index ASC
|
||||
) AS event_properties
|
||||
FROM
|
||||
primary_event_types
|
||||
LEFT JOIN
|
||||
per_event_property
|
||||
USING (category, event)
|
||||
GROUP BY
|
||||
category,
|
||||
event,
|
||||
first_timestamp,
|
||||
primary_index
|
||||
),
|
||||
max_date AS (
|
||||
SELECT
|
||||
MAX(submission_date) AS submission_date
|
||||
FROM
|
||||
sample
|
||||
)
|
||||
SELECT
|
||||
*
|
||||
FROM
|
||||
per_event,
|
||||
max_date
|
|
@ -1,28 +0,0 @@
|
|||
# Generated by ./bqetl generate events_daily
|
||||
|
||||
---
|
||||
friendly_name: 'Mozilla VPN Event Types History'
|
||||
description: >
|
||||
Retrieve the set of [events, event_properties]
|
||||
and record them in a table.
|
||||
This table stores all of history, partitioned by
|
||||
submission_date.
|
||||
owners:
|
||||
- wlachance@mozilla.com
|
||||
- akomar@mozilla.com
|
||||
labels:
|
||||
application: mozilla_vpn
|
||||
incremental: true
|
||||
schedule: daily
|
||||
scheduling:
|
||||
dag_name: bqetl_event_rollup
|
||||
depends_on_past: true
|
||||
bigquery:
|
||||
time_partitioning:
|
||||
type: day
|
||||
field: submission_date
|
||||
require_partition_filter: false
|
||||
clustering:
|
||||
fields:
|
||||
- category
|
||||
- event
|
|
@ -1,279 +0,0 @@
|
|||
-- Generated by ./bqetl generate events_daily
|
||||
WITH all_events AS (
|
||||
SELECT
|
||||
DATE(submission_timestamp) AS submission_date,
|
||||
SAFE.TIMESTAMP_ADD(ping_info.parsed_start_time, INTERVAL timestamp MILLISECOND) AS timestamp,
|
||||
category,
|
||||
name AS event,
|
||||
extra,
|
||||
FROM
|
||||
mozillavpn.main e
|
||||
CROSS JOIN
|
||||
UNNEST(e.events) AS event
|
||||
UNION ALL
|
||||
SELECT
|
||||
DATE(submission_timestamp) AS submission_date,
|
||||
SAFE.TIMESTAMP_ADD(ping_info.parsed_start_time, INTERVAL timestamp MILLISECOND) AS timestamp,
|
||||
category,
|
||||
name AS event,
|
||||
extra,
|
||||
FROM
|
||||
org_mozilla_firefox_vpn.main e
|
||||
CROSS JOIN
|
||||
UNNEST(e.events) AS event
|
||||
UNION ALL
|
||||
SELECT
|
||||
DATE(submission_timestamp) AS submission_date,
|
||||
SAFE.TIMESTAMP_ADD(ping_info.parsed_start_time, INTERVAL timestamp MILLISECOND) AS timestamp,
|
||||
category,
|
||||
name AS event,
|
||||
extra,
|
||||
FROM
|
||||
org_mozilla_ios_firefoxvpn.main e
|
||||
CROSS JOIN
|
||||
UNNEST(e.events) AS event
|
||||
),
|
||||
current_events AS (
|
||||
SELECT
|
||||
*
|
||||
FROM
|
||||
all_events
|
||||
WHERE
|
||||
submission_date = @submission_date
|
||||
),
|
||||
event_types AS (
|
||||
SELECT
|
||||
*
|
||||
FROM
|
||||
mozilla_vpn_derived.event_types_history_v1
|
||||
WHERE
|
||||
submission_date = DATE_SUB(@submission_date, INTERVAL 1 DAY)
|
||||
),
|
||||
new_primary_event_types AS (
|
||||
SELECT
|
||||
category,
|
||||
event,
|
||||
MIN(timestamp) AS first_timestamp,
|
||||
ROW_NUMBER() OVER (ORDER BY MIN(timestamp) ASC, category ASC, event ASC) + (
|
||||
SELECT
|
||||
MAX(numeric_index)
|
||||
FROM
|
||||
event_types
|
||||
) AS numeric_index,
|
||||
0 AS max_event_property_index
|
||||
FROM
|
||||
current_events
|
||||
LEFT JOIN
|
||||
event_types
|
||||
USING (category, event)
|
||||
WHERE
|
||||
event_types.event IS NULL
|
||||
GROUP BY
|
||||
category,
|
||||
event
|
||||
),
|
||||
all_primary_event_types AS (
|
||||
SELECT
|
||||
*
|
||||
FROM
|
||||
new_primary_event_types
|
||||
UNION ALL
|
||||
SELECT
|
||||
category,
|
||||
event,
|
||||
first_timestamp,
|
||||
numeric_index,
|
||||
MAX(COALESCE(event_property.index, 0)) AS max_event_property_index
|
||||
FROM
|
||||
event_types
|
||||
LEFT JOIN
|
||||
UNNEST(event_properties) AS event_property
|
||||
GROUP BY
|
||||
category,
|
||||
event,
|
||||
first_timestamp,
|
||||
numeric_index
|
||||
),
|
||||
new_event_property_indices AS (
|
||||
SELECT
|
||||
category,
|
||||
event,
|
||||
event_property.key AS event_property,
|
||||
ROW_NUMBER() OVER (
|
||||
PARTITION BY
|
||||
category,
|
||||
event
|
||||
ORDER BY
|
||||
MIN(timestamp) ASC,
|
||||
event_property.key ASC
|
||||
) + ANY_VALUE(max_event_property_index) AS event_property_index,
|
||||
0 AS max_event_property_value_index
|
||||
FROM
|
||||
current_events,
|
||||
UNNEST(extra) AS event_property
|
||||
LEFT JOIN
|
||||
(SELECT * FROM event_types, UNNEST(event_properties)) event_types
|
||||
USING (category, event, key)
|
||||
JOIN
|
||||
all_primary_event_types
|
||||
USING (event, category)
|
||||
LEFT JOIN
|
||||
UNNEST(CAST(['time_ms'] AS ARRAY<STRING>)) skipped_property
|
||||
ON skipped_property = event_property.key
|
||||
WHERE
|
||||
skipped_property IS NULL
|
||||
AND event_types.event IS NULL
|
||||
GROUP BY
|
||||
category,
|
||||
event,
|
||||
event_property
|
||||
),
|
||||
all_event_property_indices AS (
|
||||
SELECT
|
||||
*
|
||||
FROM
|
||||
new_event_property_indices
|
||||
UNION ALL
|
||||
SELECT
|
||||
category,
|
||||
event,
|
||||
event_property.key AS event_property,
|
||||
event_property.index AS event_property_index,
|
||||
MAX(COALESCE(`values`.index, 0)) AS max_event_property_value_index
|
||||
FROM
|
||||
event_types
|
||||
LEFT JOIN
|
||||
UNNEST(event_properties) AS event_property
|
||||
LEFT JOIN
|
||||
UNNEST(value) AS `values`
|
||||
GROUP BY
|
||||
category,
|
||||
event,
|
||||
first_timestamp,
|
||||
event_property,
|
||||
event_property_index
|
||||
),
|
||||
new_event_property_value_indices AS (
|
||||
SELECT
|
||||
current_events.category,
|
||||
current_events.event,
|
||||
event_property.key AS event_property,
|
||||
event_property.value AS event_property_value,
|
||||
ROW_NUMBER() OVER (
|
||||
PARTITION BY
|
||||
current_events.category,
|
||||
current_events.event,
|
||||
event_property.key
|
||||
ORDER BY
|
||||
MIN(timestamp) ASC,
|
||||
event_property.value ASC
|
||||
) + ANY_VALUE(max_event_property_value_index) AS event_property_value_index,
|
||||
FROM
|
||||
current_events,
|
||||
UNNEST(extra) AS event_property
|
||||
LEFT JOIN
|
||||
(
|
||||
SELECT
|
||||
event_types.* EXCEPT (event_properties),
|
||||
existing_event_property,
|
||||
`values`
|
||||
FROM
|
||||
event_types,
|
||||
UNNEST(event_properties) AS existing_event_property,
|
||||
UNNEST(value) AS `values`
|
||||
) AS existing_event_type_values
|
||||
ON current_events.category = existing_event_type_values.category
|
||||
AND current_events.event = existing_event_type_values.event
|
||||
AND event_property.key = existing_event_type_values.existing_event_property.key
|
||||
AND event_property.value = existing_event_type_values.`values`.key
|
||||
JOIN
|
||||
all_event_property_indices
|
||||
ON all_event_property_indices.category = current_events.category
|
||||
AND all_event_property_indices.event = current_events.event
|
||||
AND all_event_property_indices.event_property = event_property.key
|
||||
WHERE
|
||||
existing_event_type_values.event IS NULL
|
||||
GROUP BY
|
||||
category,
|
||||
event,
|
||||
event_property,
|
||||
event_property_value
|
||||
),
|
||||
all_event_property_value_indices AS (
|
||||
SELECT
|
||||
*
|
||||
FROM
|
||||
new_event_property_value_indices
|
||||
WHERE
|
||||
-- Doesn't remove historical event_property values
|
||||
event_property_value_index <= 1000
|
||||
UNION ALL
|
||||
SELECT
|
||||
category,
|
||||
event,
|
||||
event_property.key AS event_property,
|
||||
`values`.key AS event_property_value,
|
||||
`values`.index AS event_property_value_index
|
||||
FROM
|
||||
event_types,
|
||||
UNNEST(event_properties) AS event_property,
|
||||
UNNEST(value) AS `values`
|
||||
),
|
||||
per_event_property AS (
|
||||
SELECT
|
||||
category,
|
||||
event,
|
||||
event_property,
|
||||
event_property_index,
|
||||
ARRAY_AGG(
|
||||
STRUCT(
|
||||
event_property_value AS key,
|
||||
udf.event_code_points_to_string([event_property_value_index]) AS value,
|
||||
event_property_value_index AS index
|
||||
)
|
||||
ORDER BY
|
||||
event_property_value_index ASC
|
||||
) AS `values`,
|
||||
FROM
|
||||
all_event_property_value_indices
|
||||
INNER JOIN
|
||||
all_event_property_indices
|
||||
USING (category, event, event_property)
|
||||
GROUP BY
|
||||
category,
|
||||
event,
|
||||
event_property,
|
||||
event_property_index
|
||||
),
|
||||
per_event AS (
|
||||
SELECT
|
||||
category,
|
||||
event,
|
||||
first_timestamp,
|
||||
numeric_index,
|
||||
udf.event_code_points_to_string([numeric_index]) AS index,
|
||||
ARRAY_AGG(
|
||||
IF(
|
||||
event_property IS NULL,
|
||||
NULL,
|
||||
STRUCT(event_property AS key, `values` AS value, event_property_index AS index)
|
||||
) IGNORE NULLS
|
||||
ORDER BY
|
||||
event_property_index ASC
|
||||
) AS event_properties
|
||||
FROM
|
||||
all_primary_event_types
|
||||
LEFT JOIN
|
||||
per_event_property
|
||||
USING (category, event)
|
||||
GROUP BY
|
||||
category,
|
||||
event,
|
||||
first_timestamp,
|
||||
numeric_index
|
||||
)
|
||||
SELECT
|
||||
@submission_date AS submission_date,
|
||||
*
|
||||
FROM
|
||||
per_event
|
|
@ -1,44 +0,0 @@
|
|||
# Generated by ./bqetl generate events_daily
|
||||
|
||||
fields:
|
||||
- mode: NULLABLE
|
||||
name: submission_date
|
||||
type: DATE
|
||||
- mode: NULLABLE
|
||||
name: category
|
||||
type: STRING
|
||||
- mode: NULLABLE
|
||||
name: event
|
||||
type: STRING
|
||||
- mode: NULLABLE
|
||||
name: first_timestamp
|
||||
type: TIMESTAMP
|
||||
- mode: NULLABLE
|
||||
name: numeric_index
|
||||
type: INTEGER
|
||||
- mode: NULLABLE
|
||||
name: index
|
||||
type: STRING
|
||||
- fields:
|
||||
- mode: NULLABLE
|
||||
name: key
|
||||
type: STRING
|
||||
- fields:
|
||||
- mode: NULLABLE
|
||||
name: key
|
||||
type: STRING
|
||||
- mode: NULLABLE
|
||||
name: value
|
||||
type: STRING
|
||||
- mode: NULLABLE
|
||||
name: index
|
||||
type: INTEGER
|
||||
mode: REPEATED
|
||||
name: value
|
||||
type: RECORD
|
||||
- mode: NULLABLE
|
||||
name: index
|
||||
type: INTEGER
|
||||
mode: REPEATED
|
||||
name: event_properties
|
||||
type: RECORD
|
|
@ -1,8 +0,0 @@
|
|||
-- Generated by ./bqetl generate events_daily
|
||||
CREATE OR REPLACE TABLE
|
||||
mozilla_vpn_derived.event_types_v1
|
||||
AS
|
||||
SELECT
|
||||
* EXCEPT (submission_date)
|
||||
FROM
|
||||
mozilla_vpn_derived.event_types_history_v1
|
|
@ -1,16 +0,0 @@
|
|||
# Generated by ./bqetl generate events_daily
|
||||
|
||||
---
|
||||
friendly_name: Mozilla VPN Event Types
|
||||
description: >
|
||||
A materialized view of the most recent day of event_types data
|
||||
owners:
|
||||
- akomar@mozilla.com
|
||||
labels:
|
||||
application: mozilla_vpn
|
||||
incremental: false
|
||||
schedule: daily
|
||||
scheduling:
|
||||
dag_name: bqetl_event_rollup
|
||||
date_partition_parameter: null
|
||||
parameters: ["submission_date:DATE:{{ds}}"]
|
|
@ -1,7 +0,0 @@
|
|||
-- Generated by ./bqetl generate events_daily
|
||||
SELECT
|
||||
* EXCEPT (submission_date)
|
||||
FROM
|
||||
mozilla_vpn_derived.event_types_history_v1
|
||||
WHERE
|
||||
submission_date = @submission_date
|
|
@ -1,34 +0,0 @@
|
|||
-- Generated by ./bqetl generate events_daily
|
||||
CREATE OR REPLACE TABLE
|
||||
mozilla_vpn_derived.events_daily_v1
|
||||
PARTITION BY
|
||||
submission_date
|
||||
CLUSTER BY
|
||||
sample_id
|
||||
OPTIONS
|
||||
(require_partition_filter = TRUE)
|
||||
AS
|
||||
SELECT
|
||||
CAST(NULL AS date) AS submission_date,
|
||||
CAST(NULL AS STRING) AS client_id,
|
||||
CAST(NULL AS INT64) AS sample_id,
|
||||
CAST(NULL AS STRING) AS events,
|
||||
-- client info
|
||||
CAST(NULL AS STRING) AS app_build,
|
||||
CAST(NULL AS STRING) AS app_channel,
|
||||
CAST(NULL AS STRING) AS app_display_version,
|
||||
CAST(NULL AS STRING) AS architecture,
|
||||
CAST(NULL AS STRING) AS first_run_date,
|
||||
CAST(NULL AS STRING) AS telemetry_agent,
|
||||
CAST(NULL AS STRING) AS telemetry_sdk_build,
|
||||
CAST(NULL AS STRING) AS locale,
|
||||
-- metadata
|
||||
CAST(NULL AS STRING) AS city,
|
||||
CAST(NULL AS STRING) AS country,
|
||||
CAST(NULL AS STRING) AS subdivision1,
|
||||
-- normalized fields
|
||||
CAST(NULL AS STRING) AS channel,
|
||||
CAST(NULL AS STRING) AS os,
|
||||
CAST(NULL AS STRING) AS os_version,
|
||||
-- ping info
|
||||
CAST(NULL AS ARRAY<STRUCT<key STRING, value STRING>>) AS experiments
|
|
@ -1,22 +0,0 @@
|
|||
# Generated by ./bqetl generate events_daily
|
||||
|
||||
---
|
||||
friendly_name: 'Mozilla VPN Events Daily'
|
||||
description: >
|
||||
Packed event representation with one-row per-client
|
||||
owners:
|
||||
- akomar@mozilla.com
|
||||
labels:
|
||||
application: mozilla_vpn
|
||||
schedule: daily
|
||||
incremental: true
|
||||
scheduling:
|
||||
dag_name: bqetl_event_rollup
|
||||
bigquery:
|
||||
time_partitioning:
|
||||
type: day
|
||||
field: submission_date
|
||||
require_partition_filter: true
|
||||
clustering:
|
||||
fields:
|
||||
- sample_id
|
|
@ -1,147 +0,0 @@
|
|||
-- Generated by ./bqetl generate events_daily
|
||||
WITH sample AS (
|
||||
SELECT
|
||||
DATE(submission_timestamp) AS submission_date,
|
||||
name AS event,
|
||||
category,
|
||||
extra,
|
||||
sample_id,
|
||||
timestamp,
|
||||
metadata,
|
||||
normalized_channel,
|
||||
normalized_os,
|
||||
normalized_os_version,
|
||||
client_info.client_id AS client_id,
|
||||
client_info.app_build AS app_build,
|
||||
client_info.app_channel AS app_channel,
|
||||
client_info.app_display_version AS app_display_version,
|
||||
client_info.architecture AS architecture,
|
||||
client_info.first_run_date AS first_run_date,
|
||||
metadata.header.x_telemetry_agent AS telemetry_agent,
|
||||
client_info.telemetry_sdk_build AS telemetry_sdk_build,
|
||||
client_info.locale AS locale,
|
||||
(
|
||||
SELECT
|
||||
ARRAY_AGG(STRUCT(key, value.branch AS value))
|
||||
FROM
|
||||
UNNEST(ping_info.experiments)
|
||||
) AS experiments
|
||||
FROM
|
||||
mozillavpn.main e
|
||||
CROSS JOIN
|
||||
UNNEST(e.events) AS event
|
||||
UNION ALL
|
||||
SELECT
|
||||
DATE(submission_timestamp) AS submission_date,
|
||||
name AS event,
|
||||
category,
|
||||
extra,
|
||||
sample_id,
|
||||
timestamp,
|
||||
metadata,
|
||||
normalized_channel,
|
||||
normalized_os,
|
||||
normalized_os_version,
|
||||
client_info.client_id AS client_id,
|
||||
client_info.app_build AS app_build,
|
||||
client_info.app_channel AS app_channel,
|
||||
client_info.app_display_version AS app_display_version,
|
||||
client_info.architecture AS architecture,
|
||||
client_info.first_run_date AS first_run_date,
|
||||
metadata.header.x_telemetry_agent AS telemetry_agent,
|
||||
client_info.telemetry_sdk_build AS telemetry_sdk_build,
|
||||
client_info.locale AS locale,
|
||||
(
|
||||
SELECT
|
||||
ARRAY_AGG(STRUCT(key, value.branch AS value))
|
||||
FROM
|
||||
UNNEST(ping_info.experiments)
|
||||
) AS experiments
|
||||
FROM
|
||||
org_mozilla_firefox_vpn.main e
|
||||
CROSS JOIN
|
||||
UNNEST(e.events) AS event
|
||||
UNION ALL
|
||||
SELECT
|
||||
DATE(submission_timestamp) AS submission_date,
|
||||
name AS event,
|
||||
category,
|
||||
extra,
|
||||
sample_id,
|
||||
timestamp,
|
||||
metadata,
|
||||
normalized_channel,
|
||||
normalized_os,
|
||||
normalized_os_version,
|
||||
client_info.client_id AS client_id,
|
||||
client_info.app_build AS app_build,
|
||||
client_info.app_channel AS app_channel,
|
||||
client_info.app_display_version AS app_display_version,
|
||||
client_info.architecture AS architecture,
|
||||
client_info.first_run_date AS first_run_date,
|
||||
metadata.header.x_telemetry_agent AS telemetry_agent,
|
||||
client_info.telemetry_sdk_build AS telemetry_sdk_build,
|
||||
client_info.locale AS locale,
|
||||
(
|
||||
SELECT
|
||||
ARRAY_AGG(STRUCT(key, value.branch AS value))
|
||||
FROM
|
||||
UNNEST(ping_info.experiments)
|
||||
) AS experiments
|
||||
FROM
|
||||
org_mozilla_ios_firefoxvpn.main e
|
||||
CROSS JOIN
|
||||
UNNEST(e.events) AS event
|
||||
),
|
||||
events AS (
|
||||
SELECT
|
||||
*
|
||||
FROM
|
||||
sample
|
||||
WHERE
|
||||
(
|
||||
submission_date = @submission_date
|
||||
OR (@submission_date IS NULL AND submission_date >= '2021-10-01')
|
||||
)
|
||||
AND client_id IS NOT NULL
|
||||
),
|
||||
joined AS (
|
||||
SELECT
|
||||
CONCAT(udf.pack_event_properties(events.extra, event_types.event_properties), index) AS index,
|
||||
events.* EXCEPT (category, event, extra)
|
||||
FROM
|
||||
events
|
||||
INNER JOIN
|
||||
mozilla_vpn.event_types event_types
|
||||
USING (category, event)
|
||||
)
|
||||
SELECT
|
||||
submission_date,
|
||||
client_id,
|
||||
sample_id,
|
||||
CONCAT(STRING_AGG(index, ',' ORDER BY timestamp ASC), ',') AS events,
|
||||
-- client info
|
||||
mozfun.stats.mode_last(ARRAY_AGG(app_build)) AS app_build,
|
||||
mozfun.stats.mode_last(ARRAY_AGG(app_channel)) AS app_channel,
|
||||
mozfun.stats.mode_last(ARRAY_AGG(app_display_version)) AS app_display_version,
|
||||
mozfun.stats.mode_last(ARRAY_AGG(architecture)) AS architecture,
|
||||
mozfun.stats.mode_last(ARRAY_AGG(first_run_date)) AS first_run_date,
|
||||
mozfun.stats.mode_last(ARRAY_AGG(telemetry_agent)) AS telemetry_agent,
|
||||
mozfun.stats.mode_last(ARRAY_AGG(telemetry_sdk_build)) AS telemetry_sdk_build,
|
||||
mozfun.stats.mode_last(ARRAY_AGG(locale)) AS locale,
|
||||
-- metadata
|
||||
mozfun.stats.mode_last(ARRAY_AGG(metadata.geo.city)) AS city,
|
||||
mozfun.stats.mode_last(ARRAY_AGG(metadata.geo.country)) AS country,
|
||||
mozfun.stats.mode_last(ARRAY_AGG(metadata.geo.subdivision1)) AS subdivision1,
|
||||
-- normalized fields
|
||||
mozfun.stats.mode_last(ARRAY_AGG(normalized_channel)) AS channel,
|
||||
mozfun.stats.mode_last(ARRAY_AGG(normalized_os)) AS os,
|
||||
mozfun.stats.mode_last(ARRAY_AGG(normalized_os_version)) AS os_version,
|
||||
-- ping info
|
||||
mozfun.map.mode_last(ARRAY_CONCAT_AGG(experiments)) AS experiments
|
||||
FROM
|
||||
joined
|
||||
GROUP BY
|
||||
submission_date,
|
||||
client_id,
|
||||
sample_id
|
|
@ -1,72 +0,0 @@
|
|||
-- Generated via ./bqetl generate experiment_monitoring
|
||||
CREATE MATERIALIZED VIEW
|
||||
IF
|
||||
NOT EXISTS org_mozilla_fenix_derived.experiment_events_live_v1
|
||||
OPTIONS
|
||||
(enable_refresh = TRUE, refresh_interval_minutes = 5)
|
||||
AS
|
||||
-- Glean apps use Nimbus for experimentation
|
||||
WITH all_events AS (
|
||||
SELECT
|
||||
submission_timestamp,
|
||||
events
|
||||
FROM
|
||||
`moz-fx-data-shared-prod.org_mozilla_fenix_live.events_v1`
|
||||
),
|
||||
experiment_events AS (
|
||||
SELECT
|
||||
submission_timestamp AS `timestamp`,
|
||||
event.category AS `type`,
|
||||
CAST(event.extra[SAFE_OFFSET(i)].value AS STRING) AS branch,
|
||||
CAST(event.extra[SAFE_OFFSET(j)].value AS STRING) AS experiment,
|
||||
event.name AS event_method
|
||||
FROM
|
||||
all_events,
|
||||
UNNEST(events) AS event,
|
||||
-- Workaround for https://issuetracker.google.com/issues/182829918
|
||||
-- To prevent having the branch name set to the experiment slug,
|
||||
-- the number of generated array indices needs to be different.
|
||||
UNNEST(GENERATE_ARRAY(0, 50)) AS i,
|
||||
UNNEST(GENERATE_ARRAY(0, 51)) AS j
|
||||
WHERE
|
||||
event.category = 'nimbus_events'
|
||||
AND CAST(event.extra[SAFE_OFFSET(i)].key AS STRING) = 'branch'
|
||||
AND CAST(event.extra[SAFE_OFFSET(j)].key AS STRING) = 'experiment'
|
||||
)
|
||||
SELECT
|
||||
DATE(`timestamp`) AS submission_date,
|
||||
`type`,
|
||||
experiment,
|
||||
branch,
|
||||
TIMESTAMP_ADD(
|
||||
TIMESTAMP_TRUNC(`timestamp`, HOUR),
|
||||
-- Aggregates event counts over 5-minute intervals
|
||||
INTERVAL(DIV(EXTRACT(MINUTE FROM `timestamp`), 5) * 5) MINUTE
|
||||
) AS window_start,
|
||||
TIMESTAMP_ADD(
|
||||
TIMESTAMP_TRUNC(`timestamp`, HOUR),
|
||||
INTERVAL((DIV(EXTRACT(MINUTE FROM `timestamp`), 5) + 1) * 5) MINUTE
|
||||
) AS window_end,
|
||||
COUNTIF(event_method = 'enroll' OR event_method = 'enrollment') AS enroll_count,
|
||||
COUNTIF(event_method = 'unenroll' OR event_method = 'unenrollment') AS unenroll_count,
|
||||
COUNTIF(event_method = 'graduate') AS graduate_count,
|
||||
COUNTIF(event_method = 'update') AS update_count,
|
||||
COUNTIF(event_method = 'enrollFailed') AS enroll_failed_count,
|
||||
COUNTIF(event_method = 'unenrollFailed') AS unenroll_failed_count,
|
||||
COUNTIF(event_method = 'updateFailed') AS update_failed_count,
|
||||
COUNTIF(event_method = 'disqualification') AS disqualification_count,
|
||||
COUNTIF(event_method = 'expose' OR event_method = 'exposure') AS exposure_count,
|
||||
COUNTIF(event_method = 'validationFailed') AS validation_failed_count
|
||||
FROM
|
||||
experiment_events
|
||||
WHERE
|
||||
-- Limit the amount of data the materialized view is going to backfill when created.
|
||||
-- This date can be moved forward whenever new changes of the materialized views need to be deployed.
|
||||
timestamp > TIMESTAMP('2023-10-10')
|
||||
GROUP BY
|
||||
submission_date,
|
||||
`type`,
|
||||
experiment,
|
||||
branch,
|
||||
window_start,
|
||||
window_end
|
|
@ -1,8 +0,0 @@
|
|||
friendly_name: Experiment Events Live
|
||||
description: |-
|
||||
Materialized view of experimentation related events
|
||||
coming from org_mozilla_fenix.
|
||||
owners:
|
||||
- ascholtz@mozilla.com
|
||||
labels:
|
||||
materialized_view: true
|
|
@ -1,60 +0,0 @@
|
|||
-- Generated via ./bqetl generate experiment_monitoring
|
||||
CREATE MATERIALIZED VIEW
|
||||
IF
|
||||
NOT EXISTS `moz-fx-data-shared-prod.org_mozilla_fenix_derived.experiment_search_events_live_v1`
|
||||
OPTIONS
|
||||
(enable_refresh = TRUE, refresh_interval_minutes = 5)
|
||||
AS
|
||||
SELECT
|
||||
DATE(submission_timestamp) AS submission_date,
|
||||
experiment.key AS experiment,
|
||||
experiment.value.branch AS branch,
|
||||
TIMESTAMP_ADD(
|
||||
TIMESTAMP_TRUNC(submission_timestamp, HOUR),
|
||||
-- Aggregates event counts over 5-minute intervals
|
||||
INTERVAL(DIV(EXTRACT(MINUTE FROM submission_timestamp), 5) * 5) MINUTE
|
||||
) AS window_start,
|
||||
TIMESTAMP_ADD(
|
||||
TIMESTAMP_TRUNC(submission_timestamp, HOUR),
|
||||
INTERVAL((DIV(EXTRACT(MINUTE FROM submission_timestamp), 5) + 1) * 5) MINUTE
|
||||
) AS window_end,
|
||||
-- Concatenating an element with value = 0 ensures that the count values are not null even if the array is empty
|
||||
-- Materialized views don't support COALESCE or IFNULL
|
||||
SUM(
|
||||
CAST(
|
||||
ARRAY_CONCAT(metrics.labeled_counter.browser_search_ad_clicks, [('', 0)])[
|
||||
SAFE_OFFSET(i)
|
||||
].value AS INT64
|
||||
)
|
||||
) AS ad_clicks_count,
|
||||
SUM(
|
||||
CAST(
|
||||
ARRAY_CONCAT(metrics.labeled_counter.browser_search_with_ads, [('', 0)])[
|
||||
SAFE_OFFSET(i)
|
||||
].value AS INT64
|
||||
)
|
||||
) AS search_with_ads_count,
|
||||
SUM(
|
||||
CAST(
|
||||
ARRAY_CONCAT(metrics.labeled_counter.metrics_search_count, [('', 0)])[
|
||||
SAFE_OFFSET(i)
|
||||
].value AS INT64
|
||||
)
|
||||
) AS search_count,
|
||||
FROM
|
||||
`moz-fx-data-shared-prod.org_mozilla_fenix_live.metrics_v1`
|
||||
LEFT JOIN
|
||||
UNNEST(ping_info.experiments) AS experiment
|
||||
CROSS JOIN
|
||||
-- Max. number of entries is around 10
|
||||
UNNEST(GENERATE_ARRAY(0, 50)) AS i
|
||||
WHERE
|
||||
-- Limit the amount of data the materialized view is going to backfill when created.
|
||||
-- This date can be moved forward whenever new changes of the materialized views need to be deployed.
|
||||
DATE(submission_timestamp) > '2023-10-10'
|
||||
GROUP BY
|
||||
submission_date,
|
||||
experiment,
|
||||
branch,
|
||||
window_start,
|
||||
window_end
|
|
@ -1,8 +0,0 @@
|
|||
friendly_name: Experiment Search Events Live
|
||||
description: |-
|
||||
Materialized view of experimentation related search events
|
||||
coming from org_mozilla_fenix clients.
|
||||
owners:
|
||||
- ascholtz@mozilla.com
|
||||
labels:
|
||||
materialized_view: true
|
|
@ -1,72 +0,0 @@
|
|||
-- Generated via ./bqetl generate experiment_monitoring
|
||||
CREATE MATERIALIZED VIEW
|
||||
IF
|
||||
NOT EXISTS org_mozilla_firefox_beta_derived.experiment_events_live_v1
|
||||
OPTIONS
|
||||
(enable_refresh = TRUE, refresh_interval_minutes = 5)
|
||||
AS
|
||||
-- Glean apps use Nimbus for experimentation
|
||||
WITH all_events AS (
|
||||
SELECT
|
||||
submission_timestamp,
|
||||
events
|
||||
FROM
|
||||
`moz-fx-data-shared-prod.org_mozilla_firefox_beta_live.events_v1`
|
||||
),
|
||||
experiment_events AS (
|
||||
SELECT
|
||||
submission_timestamp AS `timestamp`,
|
||||
event.category AS `type`,
|
||||
CAST(event.extra[SAFE_OFFSET(i)].value AS STRING) AS branch,
|
||||
CAST(event.extra[SAFE_OFFSET(j)].value AS STRING) AS experiment,
|
||||
event.name AS event_method
|
||||
FROM
|
||||
all_events,
|
||||
UNNEST(events) AS event,
|
||||
-- Workaround for https://issuetracker.google.com/issues/182829918
|
||||
-- To prevent having the branch name set to the experiment slug,
|
||||
-- the number of generated array indices needs to be different.
|
||||
UNNEST(GENERATE_ARRAY(0, 50)) AS i,
|
||||
UNNEST(GENERATE_ARRAY(0, 51)) AS j
|
||||
WHERE
|
||||
event.category = 'nimbus_events'
|
||||
AND CAST(event.extra[SAFE_OFFSET(i)].key AS STRING) = 'branch'
|
||||
AND CAST(event.extra[SAFE_OFFSET(j)].key AS STRING) = 'experiment'
|
||||
)
|
||||
SELECT
|
||||
DATE(`timestamp`) AS submission_date,
|
||||
`type`,
|
||||
experiment,
|
||||
branch,
|
||||
TIMESTAMP_ADD(
|
||||
TIMESTAMP_TRUNC(`timestamp`, HOUR),
|
||||
-- Aggregates event counts over 5-minute intervals
|
||||
INTERVAL(DIV(EXTRACT(MINUTE FROM `timestamp`), 5) * 5) MINUTE
|
||||
) AS window_start,
|
||||
TIMESTAMP_ADD(
|
||||
TIMESTAMP_TRUNC(`timestamp`, HOUR),
|
||||
INTERVAL((DIV(EXTRACT(MINUTE FROM `timestamp`), 5) + 1) * 5) MINUTE
|
||||
) AS window_end,
|
||||
COUNTIF(event_method = 'enroll' OR event_method = 'enrollment') AS enroll_count,
|
||||
COUNTIF(event_method = 'unenroll' OR event_method = 'unenrollment') AS unenroll_count,
|
||||
COUNTIF(event_method = 'graduate') AS graduate_count,
|
||||
COUNTIF(event_method = 'update') AS update_count,
|
||||
COUNTIF(event_method = 'enrollFailed') AS enroll_failed_count,
|
||||
COUNTIF(event_method = 'unenrollFailed') AS unenroll_failed_count,
|
||||
COUNTIF(event_method = 'updateFailed') AS update_failed_count,
|
||||
COUNTIF(event_method = 'disqualification') AS disqualification_count,
|
||||
COUNTIF(event_method = 'expose' OR event_method = 'exposure') AS exposure_count,
|
||||
COUNTIF(event_method = 'validationFailed') AS validation_failed_count
|
||||
FROM
|
||||
experiment_events
|
||||
WHERE
|
||||
-- Limit the amount of data the materialized view is going to backfill when created.
|
||||
-- This date can be moved forward whenever new changes of the materialized views need to be deployed.
|
||||
timestamp > TIMESTAMP('2023-10-10')
|
||||
GROUP BY
|
||||
submission_date,
|
||||
`type`,
|
||||
experiment,
|
||||
branch,
|
||||
window_start,
|
||||
window_end
|
|
@ -1,8 +0,0 @@
|
|||
friendly_name: Experiment Events Live
|
||||
description: |-
|
||||
Materialized view of experimentation related events
|
||||
coming from org_mozilla_firefox_beta.
|
||||
owners:
|
||||
- ascholtz@mozilla.com
|
||||
labels:
|
||||
materialized_view: true
|
|
@ -1,60 +0,0 @@
|
|||
-- Generated via ./bqetl generate experiment_monitoring
|
||||
CREATE MATERIALIZED VIEW
|
||||
IF
|
||||
NOT EXISTS `moz-fx-data-shared-prod.org_mozilla_firefox_beta_derived.experiment_search_events_live_v1`
|
||||
OPTIONS
|
||||
(enable_refresh = TRUE, refresh_interval_minutes = 5)
|
||||
AS
|
||||
SELECT
|
||||
DATE(submission_timestamp) AS submission_date,
|
||||
experiment.key AS experiment,
|
||||
experiment.value.branch AS branch,
|
||||
TIMESTAMP_ADD(
|
||||
TIMESTAMP_TRUNC(submission_timestamp, HOUR),
|
||||
-- Aggregates event counts over 5-minute intervals
|
||||
INTERVAL(DIV(EXTRACT(MINUTE FROM submission_timestamp), 5) * 5) MINUTE
|
||||
) AS window_start,
|
||||
TIMESTAMP_ADD(
|
||||
TIMESTAMP_TRUNC(submission_timestamp, HOUR),
|
||||
INTERVAL((DIV(EXTRACT(MINUTE FROM submission_timestamp), 5) + 1) * 5) MINUTE
|
||||
) AS window_end,
|
||||
-- Concatenating an element with value = 0 ensures that the count values are not null even if the array is empty
|
||||
-- Materialized views don't support COALESCE or IFNULL
|
||||
SUM(
|
||||
CAST(
|
||||
ARRAY_CONCAT(metrics.labeled_counter.browser_search_ad_clicks, [('', 0)])[
|
||||
SAFE_OFFSET(i)
|
||||
].value AS INT64
|
||||
)
|
||||
) AS ad_clicks_count,
|
||||
SUM(
|
||||
CAST(
|
||||
ARRAY_CONCAT(metrics.labeled_counter.browser_search_with_ads, [('', 0)])[
|
||||
SAFE_OFFSET(i)
|
||||
].value AS INT64
|
||||
)
|
||||
) AS search_with_ads_count,
|
||||
SUM(
|
||||
CAST(
|
||||
ARRAY_CONCAT(metrics.labeled_counter.metrics_search_count, [('', 0)])[
|
||||
SAFE_OFFSET(i)
|
||||
].value AS INT64
|
||||
)
|
||||
) AS search_count,
|
||||
FROM
|
||||
`moz-fx-data-shared-prod.org_mozilla_firefox_beta_live.metrics_v1`
|
||||
LEFT JOIN
|
||||
UNNEST(ping_info.experiments) AS experiment
|
||||
CROSS JOIN
|
||||
-- Max. number of entries is around 10
|
||||
UNNEST(GENERATE_ARRAY(0, 50)) AS i
|
||||
WHERE
|
||||
-- Limit the amount of data the materialized view is going to backfill when created.
|
||||
-- This date can be moved forward whenever new changes of the materialized views need to be deployed.
|
||||
DATE(submission_timestamp) > '2023-10-10'
|
||||
GROUP BY
|
||||
submission_date,
|
||||
experiment,
|
||||
branch,
|
||||
window_start,
|
||||
window_end
|
|
@ -1,8 +0,0 @@
|
|||
friendly_name: Experiment Search Events Live
|
||||
description: |-
|
||||
Materialized view of experimentation related search events
|
||||
coming from org_mozilla_firefox_beta clients.
|
||||
owners:
|
||||
- ascholtz@mozilla.com
|
||||
labels:
|
||||
materialized_view: true
|
|
@ -1,72 +0,0 @@
|
|||
-- Generated via ./bqetl generate experiment_monitoring
|
||||
CREATE MATERIALIZED VIEW
|
||||
IF
|
||||
NOT EXISTS org_mozilla_firefox_derived.experiment_events_live_v1
|
||||
OPTIONS
|
||||
(enable_refresh = TRUE, refresh_interval_minutes = 5)
|
||||
AS
|
||||
-- Glean apps use Nimbus for experimentation
|
||||
WITH all_events AS (
|
||||
SELECT
|
||||
submission_timestamp,
|
||||
events
|
||||
FROM
|
||||
`moz-fx-data-shared-prod.org_mozilla_firefox_live.events_v1`
|
||||
),
|
||||
experiment_events AS (
|
||||
SELECT
|
||||
submission_timestamp AS `timestamp`,
|
||||
event.category AS `type`,
|
||||
CAST(event.extra[SAFE_OFFSET(i)].value AS STRING) AS branch,
|
||||
CAST(event.extra[SAFE_OFFSET(j)].value AS STRING) AS experiment,
|
||||
event.name AS event_method
|
||||
FROM
|
||||
all_events,
|
||||
UNNEST(events) AS event,
|
||||
-- Workaround for https://issuetracker.google.com/issues/182829918
|
||||
-- To prevent having the branch name set to the experiment slug,
|
||||
-- the number of generated array indices needs to be different.
|
||||
UNNEST(GENERATE_ARRAY(0, 50)) AS i,
|
||||
UNNEST(GENERATE_ARRAY(0, 51)) AS j
|
||||
WHERE
|
||||
event.category = 'nimbus_events'
|
||||
AND CAST(event.extra[SAFE_OFFSET(i)].key AS STRING) = 'branch'
|
||||
AND CAST(event.extra[SAFE_OFFSET(j)].key AS STRING) = 'experiment'
|
||||
)
|
||||
SELECT
|
||||
DATE(`timestamp`) AS submission_date,
|
||||
`type`,
|
||||
experiment,
|
||||
branch,
|
||||
TIMESTAMP_ADD(
|
||||
TIMESTAMP_TRUNC(`timestamp`, HOUR),
|
||||
-- Aggregates event counts over 5-minute intervals
|
||||
INTERVAL(DIV(EXTRACT(MINUTE FROM `timestamp`), 5) * 5) MINUTE
|
||||
) AS window_start,
|
||||
TIMESTAMP_ADD(
|
||||
TIMESTAMP_TRUNC(`timestamp`, HOUR),
|
||||
INTERVAL((DIV(EXTRACT(MINUTE FROM `timestamp`), 5) + 1) * 5) MINUTE
|
||||
) AS window_end,
|
||||
COUNTIF(event_method = 'enroll' OR event_method = 'enrollment') AS enroll_count,
|
||||
COUNTIF(event_method = 'unenroll' OR event_method = 'unenrollment') AS unenroll_count,
|
||||
COUNTIF(event_method = 'graduate') AS graduate_count,
|
||||
COUNTIF(event_method = 'update') AS update_count,
|
||||
COUNTIF(event_method = 'enrollFailed') AS enroll_failed_count,
|
||||
COUNTIF(event_method = 'unenrollFailed') AS unenroll_failed_count,
|
||||
COUNTIF(event_method = 'updateFailed') AS update_failed_count,
|
||||
COUNTIF(event_method = 'disqualification') AS disqualification_count,
|
||||
COUNTIF(event_method = 'expose' OR event_method = 'exposure') AS exposure_count,
|
||||
COUNTIF(event_method = 'validationFailed') AS validation_failed_count
|
||||
FROM
|
||||
experiment_events
|
||||
WHERE
|
||||
-- Limit the amount of data the materialized view is going to backfill when created.
|
||||
-- This date can be moved forward whenever new changes of the materialized views need to be deployed.
|
||||
timestamp > TIMESTAMP('2023-10-10')
|
||||
GROUP BY
|
||||
submission_date,
|
||||
`type`,
|
||||
experiment,
|
||||
branch,
|
||||
window_start,
|
||||
window_end
|
|
@ -1,8 +0,0 @@
|
|||
friendly_name: Experiment Events Live
|
||||
description: |-
|
||||
Materialized view of experimentation related events
|
||||
coming from org_mozilla_firefox.
|
||||
owners:
|
||||
- ascholtz@mozilla.com
|
||||
labels:
|
||||
materialized_view: true
|
|
@ -1,60 +0,0 @@
|
|||
-- Generated via ./bqetl generate experiment_monitoring
|
||||
CREATE MATERIALIZED VIEW
|
||||
IF
|
||||
NOT EXISTS `moz-fx-data-shared-prod.org_mozilla_firefox_derived.experiment_search_events_live_v1`
|
||||
OPTIONS
|
||||
(enable_refresh = TRUE, refresh_interval_minutes = 5)
|
||||
AS
|
||||
SELECT
|
||||
DATE(submission_timestamp) AS submission_date,
|
||||
experiment.key AS experiment,
|
||||
experiment.value.branch AS branch,
|
||||
TIMESTAMP_ADD(
|
||||
TIMESTAMP_TRUNC(submission_timestamp, HOUR),
|
||||
-- Aggregates event counts over 5-minute intervals
|
||||
INTERVAL(DIV(EXTRACT(MINUTE FROM submission_timestamp), 5) * 5) MINUTE
|
||||
) AS window_start,
|
||||
TIMESTAMP_ADD(
|
||||
TIMESTAMP_TRUNC(submission_timestamp, HOUR),
|
||||
INTERVAL((DIV(EXTRACT(MINUTE FROM submission_timestamp), 5) + 1) * 5) MINUTE
|
||||
) AS window_end,
|
||||
-- Concatenating an element with value = 0 ensures that the count values are not null even if the array is empty
|
||||
-- Materialized views don't support COALESCE or IFNULL
|
||||
SUM(
|
||||
CAST(
|
||||
ARRAY_CONCAT(metrics.labeled_counter.browser_search_ad_clicks, [('', 0)])[
|
||||
SAFE_OFFSET(i)
|
||||
].value AS INT64
|
||||
)
|
||||
) AS ad_clicks_count,
|
||||
SUM(
|
||||
CAST(
|
||||
ARRAY_CONCAT(metrics.labeled_counter.browser_search_with_ads, [('', 0)])[
|
||||
SAFE_OFFSET(i)
|
||||
].value AS INT64
|
||||
)
|
||||
) AS search_with_ads_count,
|
||||
SUM(
|
||||
CAST(
|
||||
ARRAY_CONCAT(metrics.labeled_counter.metrics_search_count, [('', 0)])[
|
||||
SAFE_OFFSET(i)
|
||||
].value AS INT64
|
||||
)
|
||||
) AS search_count,
|
||||
FROM
|
||||
`moz-fx-data-shared-prod.org_mozilla_firefox_live.metrics_v1`
|
||||
LEFT JOIN
|
||||
UNNEST(ping_info.experiments) AS experiment
|
||||
CROSS JOIN
|
||||
-- Max. number of entries is around 10
|
||||
UNNEST(GENERATE_ARRAY(0, 50)) AS i
|
||||
WHERE
|
||||
-- Limit the amount of data the materialized view is going to backfill when created.
|
||||
-- This date can be moved forward whenever new changes of the materialized views need to be deployed.
|
||||
DATE(submission_timestamp) > '2023-10-10'
|
||||
GROUP BY
|
||||
submission_date,
|
||||
experiment,
|
||||
branch,
|
||||
window_start,
|
||||
window_end
|
|
@ -1,8 +0,0 @@
|
|||
friendly_name: Experiment Search Events Live
|
||||
description: |-
|
||||
Materialized view of experimentation related search events
|
||||
coming from org_mozilla_firefox clients.
|
||||
owners:
|
||||
- ascholtz@mozilla.com
|
||||
labels:
|
||||
materialized_view: true
|
|
@ -1,72 +0,0 @@
|
|||
-- Generated via ./bqetl generate experiment_monitoring
|
||||
CREATE MATERIALIZED VIEW
|
||||
IF
|
||||
NOT EXISTS org_mozilla_focus_beta_derived.experiment_events_live_v1
|
||||
OPTIONS
|
||||
(enable_refresh = TRUE, refresh_interval_minutes = 5)
|
||||
AS
|
||||
-- Glean apps use Nimbus for experimentation
|
||||
WITH all_events AS (
|
||||
SELECT
|
||||
submission_timestamp,
|
||||
events
|
||||
FROM
|
||||
`moz-fx-data-shared-prod.org_mozilla_focus_beta_live.events_v1`
|
||||
),
|
||||
experiment_events AS (
|
||||
SELECT
|
||||
submission_timestamp AS `timestamp`,
|
||||
event.category AS `type`,
|
||||
CAST(event.extra[SAFE_OFFSET(i)].value AS STRING) AS branch,
|
||||
CAST(event.extra[SAFE_OFFSET(j)].value AS STRING) AS experiment,
|
||||
event.name AS event_method
|
||||
FROM
|
||||
all_events,
|
||||
UNNEST(events) AS event,
|
||||
-- Workaround for https://issuetracker.google.com/issues/182829918
|
||||
-- To prevent having the branch name set to the experiment slug,
|
||||
-- the number of generated array indices needs to be different.
|
||||
UNNEST(GENERATE_ARRAY(0, 50)) AS i,
|
||||
UNNEST(GENERATE_ARRAY(0, 51)) AS j
|
||||
WHERE
|
||||
event.category = 'nimbus_events'
|
||||
AND CAST(event.extra[SAFE_OFFSET(i)].key AS STRING) = 'branch'
|
||||
AND CAST(event.extra[SAFE_OFFSET(j)].key AS STRING) = 'experiment'
|
||||
)
|
||||
SELECT
|
||||
DATE(`timestamp`) AS submission_date,
|
||||
`type`,
|
||||
experiment,
|
||||
branch,
|
||||
TIMESTAMP_ADD(
|
||||
TIMESTAMP_TRUNC(`timestamp`, HOUR),
|
||||
-- Aggregates event counts over 5-minute intervals
|
||||
INTERVAL(DIV(EXTRACT(MINUTE FROM `timestamp`), 5) * 5) MINUTE
|
||||
) AS window_start,
|
||||
TIMESTAMP_ADD(
|
||||
TIMESTAMP_TRUNC(`timestamp`, HOUR),
|
||||
INTERVAL((DIV(EXTRACT(MINUTE FROM `timestamp`), 5) + 1) * 5) MINUTE
|
||||
) AS window_end,
|
||||
COUNTIF(event_method = 'enroll' OR event_method = 'enrollment') AS enroll_count,
|
||||
COUNTIF(event_method = 'unenroll' OR event_method = 'unenrollment') AS unenroll_count,
|
||||
COUNTIF(event_method = 'graduate') AS graduate_count,
|
||||
COUNTIF(event_method = 'update') AS update_count,
|
||||
COUNTIF(event_method = 'enrollFailed') AS enroll_failed_count,
|
||||
COUNTIF(event_method = 'unenrollFailed') AS unenroll_failed_count,
|
||||
COUNTIF(event_method = 'updateFailed') AS update_failed_count,
|
||||
COUNTIF(event_method = 'disqualification') AS disqualification_count,
|
||||
COUNTIF(event_method = 'expose' OR event_method = 'exposure') AS exposure_count,
|
||||
COUNTIF(event_method = 'validationFailed') AS validation_failed_count
|
||||
FROM
|
||||
experiment_events
|
||||
WHERE
|
||||
-- Limit the amount of data the materialized view is going to backfill when created.
|
||||
-- This date can be moved forward whenever new changes of the materialized views need to be deployed.
|
||||
timestamp > TIMESTAMP('2023-10-10')
|
||||
GROUP BY
|
||||
submission_date,
|
||||
`type`,
|
||||
experiment,
|
||||
branch,
|
||||
window_start,
|
||||
window_end
|
|
@ -1,8 +0,0 @@
|
|||
friendly_name: Experiment Events Live
|
||||
description: |-
|
||||
Materialized view of experimentation related events
|
||||
coming from org_mozilla_focus_beta.
|
||||
owners:
|
||||
- ascholtz@mozilla.com
|
||||
labels:
|
||||
materialized_view: true
|
|
@ -1,54 +0,0 @@
|
|||
-- Generated via ./bqetl generate experiment_monitoring
|
||||
CREATE MATERIALIZED VIEW
|
||||
IF
|
||||
NOT EXISTS `moz-fx-data-shared-prod.org_mozilla_focus_beta_derived.experiment_search_events_live_v1`
|
||||
OPTIONS
|
||||
(enable_refresh = TRUE, refresh_interval_minutes = 5)
|
||||
AS
|
||||
SELECT
|
||||
DATE(submission_timestamp) AS submission_date,
|
||||
experiment.key AS experiment,
|
||||
experiment.value.branch AS branch,
|
||||
TIMESTAMP_ADD(
|
||||
TIMESTAMP_TRUNC(submission_timestamp, HOUR),
|
||||
-- Aggregates event counts over 5-minute intervals
|
||||
INTERVAL(DIV(EXTRACT(MINUTE FROM submission_timestamp), 5) * 5) MINUTE
|
||||
) AS window_start,
|
||||
TIMESTAMP_ADD(
|
||||
TIMESTAMP_TRUNC(submission_timestamp, HOUR),
|
||||
INTERVAL((DIV(EXTRACT(MINUTE FROM submission_timestamp), 5) + 1) * 5) MINUTE
|
||||
) AS window_end,
|
||||
-- Concatenating an element with value = 0 ensures that the count values are not null even if the array is empty
|
||||
-- Materialized views don't support COALESCE or IFNULL
|
||||
SUM(
|
||||
CAST(
|
||||
ARRAY_CONCAT(metrics.labeled_counter.browser_search_ad_clicks, [('', 0)])[
|
||||
SAFE_OFFSET(i)
|
||||
].value AS INT64
|
||||
)
|
||||
) AS ad_clicks_count,
|
||||
SUM(
|
||||
CAST(
|
||||
ARRAY_CONCAT(metrics.labeled_counter.browser_search_with_ads, [('', 0)])[
|
||||
SAFE_OFFSET(i)
|
||||
].value AS INT64
|
||||
)
|
||||
) AS search_with_ads_count,
|
||||
SUM(0) AS search_count,
|
||||
FROM
|
||||
`moz-fx-data-shared-prod.org_mozilla_focus_beta_live.metrics_v1`
|
||||
LEFT JOIN
|
||||
UNNEST(ping_info.experiments) AS experiment
|
||||
CROSS JOIN
|
||||
-- Max. number of entries is around 10
|
||||
UNNEST(GENERATE_ARRAY(0, 50)) AS i
|
||||
WHERE
|
||||
-- Limit the amount of data the materialized view is going to backfill when created.
|
||||
-- This date can be moved forward whenever new changes of the materialized views need to be deployed.
|
||||
DATE(submission_timestamp) > '2023-10-10'
|
||||
GROUP BY
|
||||
submission_date,
|
||||
experiment,
|
||||
branch,
|
||||
window_start,
|
||||
window_end
|
|
@ -1,8 +0,0 @@
|
|||
friendly_name: Experiment Search Events Live
|
||||
description: |-
|
||||
Materialized view of experimentation related search events
|
||||
coming from org_mozilla_focus_beta clients.
|
||||
owners:
|
||||
- ascholtz@mozilla.com
|
||||
labels:
|
||||
materialized_view: true
|
|
@ -1,72 +0,0 @@
|
|||
-- Generated via ./bqetl generate experiment_monitoring
|
||||
CREATE MATERIALIZED VIEW
|
||||
IF
|
||||
NOT EXISTS org_mozilla_focus_derived.experiment_events_live_v1
|
||||
OPTIONS
|
||||
(enable_refresh = TRUE, refresh_interval_minutes = 5)
|
||||
AS
|
||||
-- Glean apps use Nimbus for experimentation
|
||||
WITH all_events AS (
|
||||
SELECT
|
||||
submission_timestamp,
|
||||
events
|
||||
FROM
|
||||
`moz-fx-data-shared-prod.org_mozilla_focus_live.events_v1`
|
||||
),
|
||||
experiment_events AS (
|
||||
SELECT
|
||||
submission_timestamp AS `timestamp`,
|
||||
event.category AS `type`,
|
||||
CAST(event.extra[SAFE_OFFSET(i)].value AS STRING) AS branch,
|
||||
CAST(event.extra[SAFE_OFFSET(j)].value AS STRING) AS experiment,
|
||||
event.name AS event_method
|
||||
FROM
|
||||
all_events,
|
||||
UNNEST(events) AS event,
|
||||
-- Workaround for https://issuetracker.google.com/issues/182829918
|
||||
-- To prevent having the branch name set to the experiment slug,
|
||||
-- the number of generated array indices needs to be different.
|
||||
UNNEST(GENERATE_ARRAY(0, 50)) AS i,
|
||||
UNNEST(GENERATE_ARRAY(0, 51)) AS j
|
||||
WHERE
|
||||
event.category = 'nimbus_events'
|
||||
AND CAST(event.extra[SAFE_OFFSET(i)].key AS STRING) = 'branch'
|
||||
AND CAST(event.extra[SAFE_OFFSET(j)].key AS STRING) = 'experiment'
|
||||
)
|
||||
SELECT
|
||||
DATE(`timestamp`) AS submission_date,
|
||||
`type`,
|
||||
experiment,
|
||||
branch,
|
||||
TIMESTAMP_ADD(
|
||||
TIMESTAMP_TRUNC(`timestamp`, HOUR),
|
||||
-- Aggregates event counts over 5-minute intervals
|
||||
INTERVAL(DIV(EXTRACT(MINUTE FROM `timestamp`), 5) * 5) MINUTE
|
||||
) AS window_start,
|
||||
TIMESTAMP_ADD(
|
||||
TIMESTAMP_TRUNC(`timestamp`, HOUR),
|
||||
INTERVAL((DIV(EXTRACT(MINUTE FROM `timestamp`), 5) + 1) * 5) MINUTE
|
||||
) AS window_end,
|
||||
COUNTIF(event_method = 'enroll' OR event_method = 'enrollment') AS enroll_count,
|
||||
COUNTIF(event_method = 'unenroll' OR event_method = 'unenrollment') AS unenroll_count,
|
||||
COUNTIF(event_method = 'graduate') AS graduate_count,
|
||||
COUNTIF(event_method = 'update') AS update_count,
|
||||
COUNTIF(event_method = 'enrollFailed') AS enroll_failed_count,
|
||||
COUNTIF(event_method = 'unenrollFailed') AS unenroll_failed_count,
|
||||
COUNTIF(event_method = 'updateFailed') AS update_failed_count,
|
||||
COUNTIF(event_method = 'disqualification') AS disqualification_count,
|
||||
COUNTIF(event_method = 'expose' OR event_method = 'exposure') AS exposure_count,
|
||||
COUNTIF(event_method = 'validationFailed') AS validation_failed_count
|
||||
FROM
|
||||
experiment_events
|
||||
WHERE
|
||||
-- Limit the amount of data the materialized view is going to backfill when created.
|
||||
-- This date can be moved forward whenever new changes of the materialized views need to be deployed.
|
||||
timestamp > TIMESTAMP('2023-10-10')
|
||||
GROUP BY
|
||||
submission_date,
|
||||
`type`,
|
||||
experiment,
|
||||
branch,
|
||||
window_start,
|
||||
window_end
|
|
@ -1,8 +0,0 @@
|
|||
friendly_name: Experiment Events Live
|
||||
description: |-
|
||||
Materialized view of experimentation related events
|
||||
coming from org_mozilla_focus.
|
||||
owners:
|
||||
- ascholtz@mozilla.com
|
||||
labels:
|
||||
materialized_view: true
|
|
@ -1,54 +0,0 @@
|
|||
-- Generated via ./bqetl generate experiment_monitoring
|
||||
CREATE MATERIALIZED VIEW
|
||||
IF
|
||||
NOT EXISTS `moz-fx-data-shared-prod.org_mozilla_focus_derived.experiment_search_events_live_v1`
|
||||
OPTIONS
|
||||
(enable_refresh = TRUE, refresh_interval_minutes = 5)
|
||||
AS
|
||||
SELECT
|
||||
DATE(submission_timestamp) AS submission_date,
|
||||
experiment.key AS experiment,
|
||||
experiment.value.branch AS branch,
|
||||
TIMESTAMP_ADD(
|
||||
TIMESTAMP_TRUNC(submission_timestamp, HOUR),
|
||||
-- Aggregates event counts over 5-minute intervals
|
||||
INTERVAL(DIV(EXTRACT(MINUTE FROM submission_timestamp), 5) * 5) MINUTE
|
||||
) AS window_start,
|
||||
TIMESTAMP_ADD(
|
||||
TIMESTAMP_TRUNC(submission_timestamp, HOUR),
|
||||
INTERVAL((DIV(EXTRACT(MINUTE FROM submission_timestamp), 5) + 1) * 5) MINUTE
|
||||
) AS window_end,
|
||||
-- Concatenating an element with value = 0 ensures that the count values are not null even if the array is empty
|
||||
-- Materialized views don't support COALESCE or IFNULL
|
||||
SUM(
|
||||
CAST(
|
||||
ARRAY_CONCAT(metrics.labeled_counter.browser_search_ad_clicks, [('', 0)])[
|
||||
SAFE_OFFSET(i)
|
||||
].value AS INT64
|
||||
)
|
||||
) AS ad_clicks_count,
|
||||
SUM(
|
||||
CAST(
|
||||
ARRAY_CONCAT(metrics.labeled_counter.browser_search_with_ads, [('', 0)])[
|
||||
SAFE_OFFSET(i)
|
||||
].value AS INT64
|
||||
)
|
||||
) AS search_with_ads_count,
|
||||
SUM(0) AS search_count,
|
||||
FROM
|
||||
`moz-fx-data-shared-prod.org_mozilla_focus_live.metrics_v1`
|
||||
LEFT JOIN
|
||||
UNNEST(ping_info.experiments) AS experiment
|
||||
CROSS JOIN
|
||||
-- Max. number of entries is around 10
|
||||
UNNEST(GENERATE_ARRAY(0, 50)) AS i
|
||||
WHERE
|
||||
-- Limit the amount of data the materialized view is going to backfill when created.
|
||||
-- This date can be moved forward whenever new changes of the materialized views need to be deployed.
|
||||
DATE(submission_timestamp) > '2023-10-10'
|
||||
GROUP BY
|
||||
submission_date,
|
||||
experiment,
|
||||
branch,
|
||||
window_start,
|
||||
window_end
|
|
@ -1,8 +0,0 @@
|
|||
friendly_name: Experiment Search Events Live
|
||||
description: |-
|
||||
Materialized view of experimentation related search events
|
||||
coming from org_mozilla_focus clients.
|
||||
owners:
|
||||
- ascholtz@mozilla.com
|
||||
labels:
|
||||
materialized_view: true
|
|
@ -1,72 +0,0 @@
|
|||
-- Generated via ./bqetl generate experiment_monitoring
|
||||
CREATE MATERIALIZED VIEW
|
||||
IF
|
||||
NOT EXISTS org_mozilla_focus_nightly_derived.experiment_events_live_v1
|
||||
OPTIONS
|
||||
(enable_refresh = TRUE, refresh_interval_minutes = 5)
|
||||
AS
|
||||
-- Glean apps use Nimbus for experimentation
|
||||
WITH all_events AS (
|
||||
SELECT
|
||||
submission_timestamp,
|
||||
events
|
||||
FROM
|
||||
`moz-fx-data-shared-prod.org_mozilla_focus_nightly_live.events_v1`
|
||||
),
|
||||
experiment_events AS (
|
||||
SELECT
|
||||
submission_timestamp AS `timestamp`,
|
||||
event.category AS `type`,
|
||||
CAST(event.extra[SAFE_OFFSET(i)].value AS STRING) AS branch,
|
||||
CAST(event.extra[SAFE_OFFSET(j)].value AS STRING) AS experiment,
|
||||
event.name AS event_method
|
||||
FROM
|
||||
all_events,
|
||||
UNNEST(events) AS event,
|
||||
-- Workaround for https://issuetracker.google.com/issues/182829918
|
||||
-- To prevent having the branch name set to the experiment slug,
|
||||
-- the number of generated array indices needs to be different.
|
||||
UNNEST(GENERATE_ARRAY(0, 50)) AS i,
|
||||
UNNEST(GENERATE_ARRAY(0, 51)) AS j
|
||||
WHERE
|
||||
event.category = 'nimbus_events'
|
||||
AND CAST(event.extra[SAFE_OFFSET(i)].key AS STRING) = 'branch'
|
||||
AND CAST(event.extra[SAFE_OFFSET(j)].key AS STRING) = 'experiment'
|
||||
)
|
||||
SELECT
|
||||
DATE(`timestamp`) AS submission_date,
|
||||
`type`,
|
||||
experiment,
|
||||
branch,
|
||||
TIMESTAMP_ADD(
|
||||
TIMESTAMP_TRUNC(`timestamp`, HOUR),
|
||||
-- Aggregates event counts over 5-minute intervals
|
||||
INTERVAL(DIV(EXTRACT(MINUTE FROM `timestamp`), 5) * 5) MINUTE
|
||||
) AS window_start,
|
||||
TIMESTAMP_ADD(
|
||||
TIMESTAMP_TRUNC(`timestamp`, HOUR),
|
||||
INTERVAL((DIV(EXTRACT(MINUTE FROM `timestamp`), 5) + 1) * 5) MINUTE
|
||||
) AS window_end,
|
||||
COUNTIF(event_method = 'enroll' OR event_method = 'enrollment') AS enroll_count,
|
||||
COUNTIF(event_method = 'unenroll' OR event_method = 'unenrollment') AS unenroll_count,
|
||||
COUNTIF(event_method = 'graduate') AS graduate_count,
|
||||
COUNTIF(event_method = 'update') AS update_count,
|
||||
COUNTIF(event_method = 'enrollFailed') AS enroll_failed_count,
|
||||
COUNTIF(event_method = 'unenrollFailed') AS unenroll_failed_count,
|
||||
COUNTIF(event_method = 'updateFailed') AS update_failed_count,
|
||||
COUNTIF(event_method = 'disqualification') AS disqualification_count,
|
||||
COUNTIF(event_method = 'expose' OR event_method = 'exposure') AS exposure_count,
|
||||
COUNTIF(event_method = 'validationFailed') AS validation_failed_count
|
||||
FROM
|
||||
experiment_events
|
||||
WHERE
|
||||
-- Limit the amount of data the materialized view is going to backfill when created.
|
||||
-- This date can be moved forward whenever new changes of the materialized views need to be deployed.
|
||||
timestamp > TIMESTAMP('2023-10-10')
|
||||
GROUP BY
|
||||
submission_date,
|
||||
`type`,
|
||||
experiment,
|
||||
branch,
|
||||
window_start,
|
||||
window_end
|
|
@ -1,8 +0,0 @@
|
|||
friendly_name: Experiment Events Live
|
||||
description: |-
|
||||
Materialized view of experimentation related events
|
||||
coming from org_mozilla_focus_nightly.
|
||||
owners:
|
||||
- ascholtz@mozilla.com
|
||||
labels:
|
||||
materialized_view: true
|
|
@ -1,54 +0,0 @@
|
|||
-- Generated via ./bqetl generate experiment_monitoring
|
||||
CREATE MATERIALIZED VIEW
|
||||
IF
|
||||
NOT EXISTS `moz-fx-data-shared-prod.org_mozilla_focus_nightly_derived.experiment_search_events_live_v1`
|
||||
OPTIONS
|
||||
(enable_refresh = TRUE, refresh_interval_minutes = 5)
|
||||
AS
|
||||
SELECT
|
||||
DATE(submission_timestamp) AS submission_date,
|
||||
experiment.key AS experiment,
|
||||
experiment.value.branch AS branch,
|
||||
TIMESTAMP_ADD(
|
||||
TIMESTAMP_TRUNC(submission_timestamp, HOUR),
|
||||
-- Aggregates event counts over 5-minute intervals
|
||||
INTERVAL(DIV(EXTRACT(MINUTE FROM submission_timestamp), 5) * 5) MINUTE
|
||||
) AS window_start,
|
||||
TIMESTAMP_ADD(
|
||||
TIMESTAMP_TRUNC(submission_timestamp, HOUR),
|
||||
INTERVAL((DIV(EXTRACT(MINUTE FROM submission_timestamp), 5) + 1) * 5) MINUTE
|
||||
) AS window_end,
|
||||
-- Concatenating an element with value = 0 ensures that the count values are not null even if the array is empty
|
||||
-- Materialized views don't support COALESCE or IFNULL
|
||||
SUM(
|
||||
CAST(
|
||||
ARRAY_CONCAT(metrics.labeled_counter.browser_search_ad_clicks, [('', 0)])[
|
||||
SAFE_OFFSET(i)
|
||||
].value AS INT64
|
||||
)
|
||||
) AS ad_clicks_count,
|
||||
SUM(
|
||||
CAST(
|
||||
ARRAY_CONCAT(metrics.labeled_counter.browser_search_with_ads, [('', 0)])[
|
||||
SAFE_OFFSET(i)
|
||||
].value AS INT64
|
||||
)
|
||||
) AS search_with_ads_count,
|
||||
SUM(0) AS search_count,
|
||||
FROM
|
||||
`moz-fx-data-shared-prod.org_mozilla_focus_nightly_live.metrics_v1`
|
||||
LEFT JOIN
|
||||
UNNEST(ping_info.experiments) AS experiment
|
||||
CROSS JOIN
|
||||
-- Max. number of entries is around 10
|
||||
UNNEST(GENERATE_ARRAY(0, 50)) AS i
|
||||
WHERE
|
||||
-- Limit the amount of data the materialized view is going to backfill when created.
|
||||
-- This date can be moved forward whenever new changes of the materialized views need to be deployed.
|
||||
DATE(submission_timestamp) > '2023-10-10'
|
||||
GROUP BY
|
||||
submission_date,
|
||||
experiment,
|
||||
branch,
|
||||
window_start,
|
||||
window_end
|
|
@ -1,8 +0,0 @@
|
|||
friendly_name: Experiment Search Events Live
|
||||
description: |-
|
||||
Materialized view of experimentation related search events
|
||||
coming from org_mozilla_focus_nightly clients.
|
||||
owners:
|
||||
- ascholtz@mozilla.com
|
||||
labels:
|
||||
materialized_view: true
|
|
@ -1,72 +0,0 @@
|
|||
-- Generated via ./bqetl generate experiment_monitoring
|
||||
CREATE MATERIALIZED VIEW
|
||||
IF
|
||||
NOT EXISTS org_mozilla_ios_fennec_derived.experiment_events_live_v1
|
||||
OPTIONS
|
||||
(enable_refresh = TRUE, refresh_interval_minutes = 5)
|
||||
AS
|
||||
-- Glean apps use Nimbus for experimentation
|
||||
WITH all_events AS (
|
||||
SELECT
|
||||
submission_timestamp,
|
||||
events
|
||||
FROM
|
||||
`moz-fx-data-shared-prod.org_mozilla_ios_fennec_live.events_v1`
|
||||
),
|
||||
experiment_events AS (
|
||||
SELECT
|
||||
submission_timestamp AS `timestamp`,
|
||||
event.category AS `type`,
|
||||
CAST(event.extra[SAFE_OFFSET(i)].value AS STRING) AS branch,
|
||||
CAST(event.extra[SAFE_OFFSET(j)].value AS STRING) AS experiment,
|
||||
event.name AS event_method
|
||||
FROM
|
||||
all_events,
|
||||
UNNEST(events) AS event,
|
||||
-- Workaround for https://issuetracker.google.com/issues/182829918
|
||||
-- To prevent having the branch name set to the experiment slug,
|
||||
-- the number of generated array indices needs to be different.
|
||||
UNNEST(GENERATE_ARRAY(0, 50)) AS i,
|
||||
UNNEST(GENERATE_ARRAY(0, 51)) AS j
|
||||
WHERE
|
||||
event.category = 'nimbus_events'
|
||||
AND CAST(event.extra[SAFE_OFFSET(i)].key AS STRING) = 'branch'
|
||||
AND CAST(event.extra[SAFE_OFFSET(j)].key AS STRING) = 'experiment'
|
||||
)
|
||||
SELECT
|
||||
DATE(`timestamp`) AS submission_date,
|
||||
`type`,
|
||||
experiment,
|
||||
branch,
|
||||
TIMESTAMP_ADD(
|
||||
TIMESTAMP_TRUNC(`timestamp`, HOUR),
|
||||
-- Aggregates event counts over 5-minute intervals
|
||||
INTERVAL(DIV(EXTRACT(MINUTE FROM `timestamp`), 5) * 5) MINUTE
|
||||
) AS window_start,
|
||||
TIMESTAMP_ADD(
|
||||
TIMESTAMP_TRUNC(`timestamp`, HOUR),
|
||||
INTERVAL((DIV(EXTRACT(MINUTE FROM `timestamp`), 5) + 1) * 5) MINUTE
|
||||
) AS window_end,
|
||||
COUNTIF(event_method = 'enroll' OR event_method = 'enrollment') AS enroll_count,
|
||||
COUNTIF(event_method = 'unenroll' OR event_method = 'unenrollment') AS unenroll_count,
|
||||
COUNTIF(event_method = 'graduate') AS graduate_count,
|
||||
COUNTIF(event_method = 'update') AS update_count,
|
||||
COUNTIF(event_method = 'enrollFailed') AS enroll_failed_count,
|
||||
COUNTIF(event_method = 'unenrollFailed') AS unenroll_failed_count,
|
||||
COUNTIF(event_method = 'updateFailed') AS update_failed_count,
|
||||
COUNTIF(event_method = 'disqualification') AS disqualification_count,
|
||||
COUNTIF(event_method = 'expose' OR event_method = 'exposure') AS exposure_count,
|
||||
COUNTIF(event_method = 'validationFailed') AS validation_failed_count
|
||||
FROM
|
||||
experiment_events
|
||||
WHERE
|
||||
-- Limit the amount of data the materialized view is going to backfill when created.
|
||||
-- This date can be moved forward whenever new changes of the materialized views need to be deployed.
|
||||
timestamp > TIMESTAMP('2023-10-10')
|
||||
GROUP BY
|
||||
submission_date,
|
||||
`type`,
|
||||
experiment,
|
||||
branch,
|
||||
window_start,
|
||||
window_end
|
|
@ -1,8 +0,0 @@
|
|||
friendly_name: Experiment Events Live
|
||||
description: |-
|
||||
Materialized view of experimentation related events
|
||||
coming from org_mozilla_ios_fennec.
|
||||
owners:
|
||||
- ascholtz@mozilla.com
|
||||
labels:
|
||||
materialized_view: true
|
|
@ -1,48 +0,0 @@
|
|||
-- Generated via ./bqetl generate experiment_monitoring
|
||||
CREATE MATERIALIZED VIEW
|
||||
IF
|
||||
NOT EXISTS `moz-fx-data-shared-prod.org_mozilla_ios_fennec_derived.experiment_search_events_live_v1`
|
||||
OPTIONS
|
||||
(enable_refresh = TRUE, refresh_interval_minutes = 5)
|
||||
AS
|
||||
SELECT
|
||||
DATE(submission_timestamp) AS submission_date,
|
||||
experiment.key AS experiment,
|
||||
experiment.value.branch AS branch,
|
||||
TIMESTAMP_ADD(
|
||||
TIMESTAMP_TRUNC(submission_timestamp, HOUR),
|
||||
-- Aggregates event counts over 5-minute intervals
|
||||
INTERVAL(DIV(EXTRACT(MINUTE FROM submission_timestamp), 5) * 5) MINUTE
|
||||
) AS window_start,
|
||||
TIMESTAMP_ADD(
|
||||
TIMESTAMP_TRUNC(submission_timestamp, HOUR),
|
||||
INTERVAL((DIV(EXTRACT(MINUTE FROM submission_timestamp), 5) + 1) * 5) MINUTE
|
||||
) AS window_end,
|
||||
-- Concatenating an element with value = 0 ensures that the count values are not null even if the array is empty
|
||||
-- Materialized views don't support COALESCE or IFNULL
|
||||
SUM(0) AS ad_clicks_count,
|
||||
SUM(0) AS search_with_ads_count,
|
||||
SUM(
|
||||
CAST(
|
||||
ARRAY_CONCAT(metrics.labeled_counter.search_counts, [('', 0)])[
|
||||
SAFE_OFFSET(i)
|
||||
].value AS INT64
|
||||
)
|
||||
) AS search_count,
|
||||
FROM
|
||||
`moz-fx-data-shared-prod.org_mozilla_ios_fennec_live.metrics_v1`
|
||||
LEFT JOIN
|
||||
UNNEST(ping_info.experiments) AS experiment
|
||||
CROSS JOIN
|
||||
-- Max. number of entries is around 10
|
||||
UNNEST(GENERATE_ARRAY(0, 50)) AS i
|
||||
WHERE
|
||||
-- Limit the amount of data the materialized view is going to backfill when created.
|
||||
-- This date can be moved forward whenever new changes of the materialized views need to be deployed.
|
||||
DATE(submission_timestamp) > '2023-10-10'
|
||||
GROUP BY
|
||||
submission_date,
|
||||
experiment,
|
||||
branch,
|
||||
window_start,
|
||||
window_end
|
|
@ -1,8 +0,0 @@
|
|||
friendly_name: Experiment Search Events Live
|
||||
description: |-
|
||||
Materialized view of experimentation related search events
|
||||
coming from org_mozilla_ios_fennec clients.
|
||||
owners:
|
||||
- ascholtz@mozilla.com
|
||||
labels:
|
||||
materialized_view: true
|
|
@ -1,72 +0,0 @@
|
|||
-- Generated via ./bqetl generate experiment_monitoring
|
||||
CREATE MATERIALIZED VIEW
|
||||
IF
|
||||
NOT EXISTS org_mozilla_ios_firefox_derived.experiment_events_live_v1
|
||||
OPTIONS
|
||||
(enable_refresh = TRUE, refresh_interval_minutes = 5)
|
||||
AS
|
||||
-- Glean apps use Nimbus for experimentation
|
||||
WITH all_events AS (
|
||||
SELECT
|
||||
submission_timestamp,
|
||||
events
|
||||
FROM
|
||||
`moz-fx-data-shared-prod.org_mozilla_ios_firefox_live.events_v1`
|
||||
),
|
||||
experiment_events AS (
|
||||
SELECT
|
||||
submission_timestamp AS `timestamp`,
|
||||
event.category AS `type`,
|
||||
CAST(event.extra[SAFE_OFFSET(i)].value AS STRING) AS branch,
|
||||
CAST(event.extra[SAFE_OFFSET(j)].value AS STRING) AS experiment,
|
||||
event.name AS event_method
|
||||
FROM
|
||||
all_events,
|
||||
UNNEST(events) AS event,
|
||||
-- Workaround for https://issuetracker.google.com/issues/182829918
|
||||
-- To prevent having the branch name set to the experiment slug,
|
||||
-- the number of generated array indices needs to be different.
|
||||
UNNEST(GENERATE_ARRAY(0, 50)) AS i,
|
||||
UNNEST(GENERATE_ARRAY(0, 51)) AS j
|
||||
WHERE
|
||||
event.category = 'nimbus_events'
|
||||
AND CAST(event.extra[SAFE_OFFSET(i)].key AS STRING) = 'branch'
|
||||
AND CAST(event.extra[SAFE_OFFSET(j)].key AS STRING) = 'experiment'
|
||||
)
|
||||
SELECT
|
||||
DATE(`timestamp`) AS submission_date,
|
||||
`type`,
|
||||
experiment,
|
||||
branch,
|
||||
TIMESTAMP_ADD(
|
||||
TIMESTAMP_TRUNC(`timestamp`, HOUR),
|
||||
-- Aggregates event counts over 5-minute intervals
|
||||
INTERVAL(DIV(EXTRACT(MINUTE FROM `timestamp`), 5) * 5) MINUTE
|
||||
) AS window_start,
|
||||
TIMESTAMP_ADD(
|
||||
TIMESTAMP_TRUNC(`timestamp`, HOUR),
|
||||
INTERVAL((DIV(EXTRACT(MINUTE FROM `timestamp`), 5) + 1) * 5) MINUTE
|
||||
) AS window_end,
|
||||
COUNTIF(event_method = 'enroll' OR event_method = 'enrollment') AS enroll_count,
|
||||
COUNTIF(event_method = 'unenroll' OR event_method = 'unenrollment') AS unenroll_count,
|
||||
COUNTIF(event_method = 'graduate') AS graduate_count,
|
||||
COUNTIF(event_method = 'update') AS update_count,
|
||||
COUNTIF(event_method = 'enrollFailed') AS enroll_failed_count,
|
||||
COUNTIF(event_method = 'unenrollFailed') AS unenroll_failed_count,
|
||||
COUNTIF(event_method = 'updateFailed') AS update_failed_count,
|
||||
COUNTIF(event_method = 'disqualification') AS disqualification_count,
|
||||
COUNTIF(event_method = 'expose' OR event_method = 'exposure') AS exposure_count,
|
||||
COUNTIF(event_method = 'validationFailed') AS validation_failed_count
|
||||
FROM
|
||||
experiment_events
|
||||
WHERE
|
||||
-- Limit the amount of data the materialized view is going to backfill when created.
|
||||
-- This date can be moved forward whenever new changes of the materialized views need to be deployed.
|
||||
timestamp > TIMESTAMP('2023-10-10')
|
||||
GROUP BY
|
||||
submission_date,
|
||||
`type`,
|
||||
experiment,
|
||||
branch,
|
||||
window_start,
|
||||
window_end
|
|
@ -1,8 +0,0 @@
|
|||
friendly_name: Experiment Events Live
|
||||
description: |-
|
||||
Materialized view of experimentation related events
|
||||
coming from org_mozilla_ios_firefox.
|
||||
owners:
|
||||
- ascholtz@mozilla.com
|
||||
labels:
|
||||
materialized_view: true
|
|
@ -1,48 +0,0 @@
|
|||
-- Generated via ./bqetl generate experiment_monitoring
|
||||
CREATE MATERIALIZED VIEW
|
||||
IF
|
||||
NOT EXISTS `moz-fx-data-shared-prod.org_mozilla_ios_firefox_derived.experiment_search_events_live_v1`
|
||||
OPTIONS
|
||||
(enable_refresh = TRUE, refresh_interval_minutes = 5)
|
||||
AS
|
||||
SELECT
|
||||
DATE(submission_timestamp) AS submission_date,
|
||||
experiment.key AS experiment,
|
||||
experiment.value.branch AS branch,
|
||||
TIMESTAMP_ADD(
|
||||
TIMESTAMP_TRUNC(submission_timestamp, HOUR),
|
||||
-- Aggregates event counts over 5-minute intervals
|
||||
INTERVAL(DIV(EXTRACT(MINUTE FROM submission_timestamp), 5) * 5) MINUTE
|
||||
) AS window_start,
|
||||
TIMESTAMP_ADD(
|
||||
TIMESTAMP_TRUNC(submission_timestamp, HOUR),
|
||||
INTERVAL((DIV(EXTRACT(MINUTE FROM submission_timestamp), 5) + 1) * 5) MINUTE
|
||||
) AS window_end,
|
||||
-- Concatenating an element with value = 0 ensures that the count values are not null even if the array is empty
|
||||
-- Materialized views don't support COALESCE or IFNULL
|
||||
SUM(0) AS ad_clicks_count,
|
||||
SUM(0) AS search_with_ads_count,
|
||||
SUM(
|
||||
CAST(
|
||||
ARRAY_CONCAT(metrics.labeled_counter.search_counts, [('', 0)])[
|
||||
SAFE_OFFSET(i)
|
||||
].value AS INT64
|
||||
)
|
||||
) AS search_count,
|
||||
FROM
|
||||
`moz-fx-data-shared-prod.org_mozilla_ios_firefox_live.metrics_v1`
|
||||
LEFT JOIN
|
||||
UNNEST(ping_info.experiments) AS experiment
|
||||
CROSS JOIN
|
||||
-- Max. number of entries is around 10
|
||||
UNNEST(GENERATE_ARRAY(0, 50)) AS i
|
||||
WHERE
|
||||
-- Limit the amount of data the materialized view is going to backfill when created.
|
||||
-- This date can be moved forward whenever new changes of the materialized views need to be deployed.
|
||||
DATE(submission_timestamp) > '2023-10-10'
|
||||
GROUP BY
|
||||
submission_date,
|
||||
experiment,
|
||||
branch,
|
||||
window_start,
|
||||
window_end
|
|
@ -1,8 +0,0 @@
|
|||
friendly_name: Experiment Search Events Live
|
||||
description: |-
|
||||
Materialized view of experimentation related search events
|
||||
coming from org_mozilla_ios_firefox clients.
|
||||
owners:
|
||||
- ascholtz@mozilla.com
|
||||
labels:
|
||||
materialized_view: true
|
|
@ -1,72 +0,0 @@
|
|||
-- Generated via ./bqetl generate experiment_monitoring
|
||||
CREATE MATERIALIZED VIEW
|
||||
IF
|
||||
NOT EXISTS org_mozilla_ios_firefoxbeta_derived.experiment_events_live_v1
|
||||
OPTIONS
|
||||
(enable_refresh = TRUE, refresh_interval_minutes = 5)
|
||||
AS
|
||||
-- Glean apps use Nimbus for experimentation
|
||||
WITH all_events AS (
|
||||
SELECT
|
||||
submission_timestamp,
|
||||
events
|
||||
FROM
|
||||
`moz-fx-data-shared-prod.org_mozilla_ios_firefoxbeta_live.events_v1`
|
||||
),
|
||||
experiment_events AS (
|
||||
SELECT
|
||||
submission_timestamp AS `timestamp`,
|
||||
event.category AS `type`,
|
||||
CAST(event.extra[SAFE_OFFSET(i)].value AS STRING) AS branch,
|
||||
CAST(event.extra[SAFE_OFFSET(j)].value AS STRING) AS experiment,
|
||||
event.name AS event_method
|
||||
FROM
|
||||
all_events,
|
||||
UNNEST(events) AS event,
|
||||
-- Workaround for https://issuetracker.google.com/issues/182829918
|
||||
-- To prevent having the branch name set to the experiment slug,
|
||||
-- the number of generated array indices needs to be different.
|
||||
UNNEST(GENERATE_ARRAY(0, 50)) AS i,
|
||||
UNNEST(GENERATE_ARRAY(0, 51)) AS j
|
||||
WHERE
|
||||
event.category = 'nimbus_events'
|
||||
AND CAST(event.extra[SAFE_OFFSET(i)].key AS STRING) = 'branch'
|
||||
AND CAST(event.extra[SAFE_OFFSET(j)].key AS STRING) = 'experiment'
|
||||
)
|
||||
SELECT
|
||||
DATE(`timestamp`) AS submission_date,
|
||||
`type`,
|
||||
experiment,
|
||||
branch,
|
||||
TIMESTAMP_ADD(
|
||||
TIMESTAMP_TRUNC(`timestamp`, HOUR),
|
||||
-- Aggregates event counts over 5-minute intervals
|
||||
INTERVAL(DIV(EXTRACT(MINUTE FROM `timestamp`), 5) * 5) MINUTE
|
||||
) AS window_start,
|
||||
TIMESTAMP_ADD(
|
||||
TIMESTAMP_TRUNC(`timestamp`, HOUR),
|
||||
INTERVAL((DIV(EXTRACT(MINUTE FROM `timestamp`), 5) + 1) * 5) MINUTE
|
||||
) AS window_end,
|
||||
COUNTIF(event_method = 'enroll' OR event_method = 'enrollment') AS enroll_count,
|
||||
COUNTIF(event_method = 'unenroll' OR event_method = 'unenrollment') AS unenroll_count,
|
||||
COUNTIF(event_method = 'graduate') AS graduate_count,
|
||||
COUNTIF(event_method = 'update') AS update_count,
|
||||
COUNTIF(event_method = 'enrollFailed') AS enroll_failed_count,
|
||||
COUNTIF(event_method = 'unenrollFailed') AS unenroll_failed_count,
|
||||
COUNTIF(event_method = 'updateFailed') AS update_failed_count,
|
||||
COUNTIF(event_method = 'disqualification') AS disqualification_count,
|
||||
COUNTIF(event_method = 'expose' OR event_method = 'exposure') AS exposure_count,
|
||||
COUNTIF(event_method = 'validationFailed') AS validation_failed_count
|
||||
FROM
|
||||
experiment_events
|
||||
WHERE
|
||||
-- Limit the amount of data the materialized view is going to backfill when created.
|
||||
-- This date can be moved forward whenever new changes of the materialized views need to be deployed.
|
||||
timestamp > TIMESTAMP('2023-10-10')
|
||||
GROUP BY
|
||||
submission_date,
|
||||
`type`,
|
||||
experiment,
|
||||
branch,
|
||||
window_start,
|
||||
window_end
|
|
@ -1,8 +0,0 @@
|
|||
friendly_name: Experiment Events Live
|
||||
description: |-
|
||||
Materialized view of experimentation related events
|
||||
coming from org_mozilla_ios_firefoxbeta.
|
||||
owners:
|
||||
- ascholtz@mozilla.com
|
||||
labels:
|
||||
materialized_view: true
|
|
@ -1,48 +0,0 @@
|
|||
-- Generated via ./bqetl generate experiment_monitoring
|
||||
CREATE MATERIALIZED VIEW
|
||||
IF
|
||||
NOT EXISTS `moz-fx-data-shared-prod.org_mozilla_ios_firefoxbeta_derived.experiment_search_events_live_v1`
|
||||
OPTIONS
|
||||
(enable_refresh = TRUE, refresh_interval_minutes = 5)
|
||||
AS
|
||||
SELECT
|
||||
DATE(submission_timestamp) AS submission_date,
|
||||
experiment.key AS experiment,
|
||||
experiment.value.branch AS branch,
|
||||
TIMESTAMP_ADD(
|
||||
TIMESTAMP_TRUNC(submission_timestamp, HOUR),
|
||||
-- Aggregates event counts over 5-minute intervals
|
||||
INTERVAL(DIV(EXTRACT(MINUTE FROM submission_timestamp), 5) * 5) MINUTE
|
||||
) AS window_start,
|
||||
TIMESTAMP_ADD(
|
||||
TIMESTAMP_TRUNC(submission_timestamp, HOUR),
|
||||
INTERVAL((DIV(EXTRACT(MINUTE FROM submission_timestamp), 5) + 1) * 5) MINUTE
|
||||
) AS window_end,
|
||||
-- Concatenating an element with value = 0 ensures that the count values are not null even if the array is empty
|
||||
-- Materialized views don't support COALESCE or IFNULL
|
||||
SUM(0) AS ad_clicks_count,
|
||||
SUM(0) AS search_with_ads_count,
|
||||
SUM(
|
||||
CAST(
|
||||
ARRAY_CONCAT(metrics.labeled_counter.search_counts, [('', 0)])[
|
||||
SAFE_OFFSET(i)
|
||||
].value AS INT64
|
||||
)
|
||||
) AS search_count,
|
||||
FROM
|
||||
`moz-fx-data-shared-prod.org_mozilla_ios_firefoxbeta_live.metrics_v1`
|
||||
LEFT JOIN
|
||||
UNNEST(ping_info.experiments) AS experiment
|
||||
CROSS JOIN
|
||||
-- Max. number of entries is around 10
|
||||
UNNEST(GENERATE_ARRAY(0, 50)) AS i
|
||||
WHERE
|
||||
-- Limit the amount of data the materialized view is going to backfill when created.
|
||||
-- This date can be moved forward whenever new changes of the materialized views need to be deployed.
|
||||
DATE(submission_timestamp) > '2023-10-10'
|
||||
GROUP BY
|
||||
submission_date,
|
||||
experiment,
|
||||
branch,
|
||||
window_start,
|
||||
window_end
|
|
@ -1,8 +0,0 @@
|
|||
friendly_name: Experiment Search Events Live
|
||||
description: |-
|
||||
Materialized view of experimentation related search events
|
||||
coming from org_mozilla_ios_firefoxbeta clients.
|
||||
owners:
|
||||
- ascholtz@mozilla.com
|
||||
labels:
|
||||
materialized_view: true
|
|
@ -1,72 +0,0 @@
|
|||
-- Generated via ./bqetl generate experiment_monitoring
|
||||
CREATE MATERIALIZED VIEW
|
||||
IF
|
||||
NOT EXISTS org_mozilla_ios_focus_derived.experiment_events_live_v1
|
||||
OPTIONS
|
||||
(enable_refresh = TRUE, refresh_interval_minutes = 5)
|
||||
AS
|
||||
-- Glean apps use Nimbus for experimentation
|
||||
WITH all_events AS (
|
||||
SELECT
|
||||
submission_timestamp,
|
||||
events
|
||||
FROM
|
||||
`moz-fx-data-shared-prod.org_mozilla_ios_focus_live.events_v1`
|
||||
),
|
||||
experiment_events AS (
|
||||
SELECT
|
||||
submission_timestamp AS `timestamp`,
|
||||
event.category AS `type`,
|
||||
CAST(event.extra[SAFE_OFFSET(i)].value AS STRING) AS branch,
|
||||
CAST(event.extra[SAFE_OFFSET(j)].value AS STRING) AS experiment,
|
||||
event.name AS event_method
|
||||
FROM
|
||||
all_events,
|
||||
UNNEST(events) AS event,
|
||||
-- Workaround for https://issuetracker.google.com/issues/182829918
|
||||
-- To prevent having the branch name set to the experiment slug,
|
||||
-- the number of generated array indices needs to be different.
|
||||
UNNEST(GENERATE_ARRAY(0, 50)) AS i,
|
||||
UNNEST(GENERATE_ARRAY(0, 51)) AS j
|
||||
WHERE
|
||||
event.category = 'nimbus_events'
|
||||
AND CAST(event.extra[SAFE_OFFSET(i)].key AS STRING) = 'branch'
|
||||
AND CAST(event.extra[SAFE_OFFSET(j)].key AS STRING) = 'experiment'
|
||||
)
|
||||
SELECT
|
||||
DATE(`timestamp`) AS submission_date,
|
||||
`type`,
|
||||
experiment,
|
||||
branch,
|
||||
TIMESTAMP_ADD(
|
||||
TIMESTAMP_TRUNC(`timestamp`, HOUR),
|
||||
-- Aggregates event counts over 5-minute intervals
|
||||
INTERVAL(DIV(EXTRACT(MINUTE FROM `timestamp`), 5) * 5) MINUTE
|
||||
) AS window_start,
|
||||
TIMESTAMP_ADD(
|
||||
TIMESTAMP_TRUNC(`timestamp`, HOUR),
|
||||
INTERVAL((DIV(EXTRACT(MINUTE FROM `timestamp`), 5) + 1) * 5) MINUTE
|
||||
) AS window_end,
|
||||
COUNTIF(event_method = 'enroll' OR event_method = 'enrollment') AS enroll_count,
|
||||
COUNTIF(event_method = 'unenroll' OR event_method = 'unenrollment') AS unenroll_count,
|
||||
COUNTIF(event_method = 'graduate') AS graduate_count,
|
||||
COUNTIF(event_method = 'update') AS update_count,
|
||||
COUNTIF(event_method = 'enrollFailed') AS enroll_failed_count,
|
||||
COUNTIF(event_method = 'unenrollFailed') AS unenroll_failed_count,
|
||||
COUNTIF(event_method = 'updateFailed') AS update_failed_count,
|
||||
COUNTIF(event_method = 'disqualification') AS disqualification_count,
|
||||
COUNTIF(event_method = 'expose' OR event_method = 'exposure') AS exposure_count,
|
||||
COUNTIF(event_method = 'validationFailed') AS validation_failed_count
|
||||
FROM
|
||||
experiment_events
|
||||
WHERE
|
||||
-- Limit the amount of data the materialized view is going to backfill when created.
|
||||
-- This date can be moved forward whenever new changes of the materialized views need to be deployed.
|
||||
timestamp > TIMESTAMP('2023-10-10')
|
||||
GROUP BY
|
||||
submission_date,
|
||||
`type`,
|
||||
experiment,
|
||||
branch,
|
||||
window_start,
|
||||
window_end
|
|
@ -1,8 +0,0 @@
|
|||
friendly_name: Experiment Events Live
|
||||
description: |-
|
||||
Materialized view of experimentation related events
|
||||
coming from org_mozilla_ios_focus.
|
||||
owners:
|
||||
- ascholtz@mozilla.com
|
||||
labels:
|
||||
materialized_view: true
|
|
@ -1,42 +0,0 @@
|
|||
-- Generated via ./bqetl generate experiment_monitoring
|
||||
CREATE MATERIALIZED VIEW
|
||||
IF
|
||||
NOT EXISTS `moz-fx-data-shared-prod.org_mozilla_ios_focus_derived.experiment_search_events_live_v1`
|
||||
OPTIONS
|
||||
(enable_refresh = TRUE, refresh_interval_minutes = 5)
|
||||
AS
|
||||
SELECT
|
||||
DATE(submission_timestamp) AS submission_date,
|
||||
experiment.key AS experiment,
|
||||
experiment.value.branch AS branch,
|
||||
TIMESTAMP_ADD(
|
||||
TIMESTAMP_TRUNC(submission_timestamp, HOUR),
|
||||
-- Aggregates event counts over 5-minute intervals
|
||||
INTERVAL(DIV(EXTRACT(MINUTE FROM submission_timestamp), 5) * 5) MINUTE
|
||||
) AS window_start,
|
||||
TIMESTAMP_ADD(
|
||||
TIMESTAMP_TRUNC(submission_timestamp, HOUR),
|
||||
INTERVAL((DIV(EXTRACT(MINUTE FROM submission_timestamp), 5) + 1) * 5) MINUTE
|
||||
) AS window_end,
|
||||
-- Concatenating an element with value = 0 ensures that the count values are not null even if the array is empty
|
||||
-- Materialized views don't support COALESCE or IFNULL
|
||||
SUM(0) AS ad_clicks_count,
|
||||
SUM(0) AS search_with_ads_count,
|
||||
SUM(0) AS search_count,
|
||||
FROM
|
||||
`moz-fx-data-shared-prod.org_mozilla_ios_focus_live.metrics_v1`
|
||||
LEFT JOIN
|
||||
UNNEST(ping_info.experiments) AS experiment
|
||||
CROSS JOIN
|
||||
-- Max. number of entries is around 10
|
||||
UNNEST(GENERATE_ARRAY(0, 50)) AS i
|
||||
WHERE
|
||||
-- Limit the amount of data the materialized view is going to backfill when created.
|
||||
-- This date can be moved forward whenever new changes of the materialized views need to be deployed.
|
||||
DATE(submission_timestamp) > '2023-10-10'
|
||||
GROUP BY
|
||||
submission_date,
|
||||
experiment,
|
||||
branch,
|
||||
window_start,
|
||||
window_end
|
|
@ -1,8 +0,0 @@
|
|||
friendly_name: Experiment Search Events Live
|
||||
description: |-
|
||||
Materialized view of experimentation related search events
|
||||
coming from org_mozilla_ios_focus clients.
|
||||
owners:
|
||||
- ascholtz@mozilla.com
|
||||
labels:
|
||||
materialized_view: true
|
|
@ -1,72 +0,0 @@
|
|||
-- Generated via ./bqetl generate experiment_monitoring
|
||||
CREATE MATERIALIZED VIEW
|
||||
IF
|
||||
NOT EXISTS org_mozilla_ios_klar_derived.experiment_events_live_v1
|
||||
OPTIONS
|
||||
(enable_refresh = TRUE, refresh_interval_minutes = 5)
|
||||
AS
|
||||
-- Glean apps use Nimbus for experimentation
|
||||
WITH all_events AS (
|
||||
SELECT
|
||||
submission_timestamp,
|
||||
events
|
||||
FROM
|
||||
`moz-fx-data-shared-prod.org_mozilla_ios_klar_live.events_v1`
|
||||
),
|
||||
experiment_events AS (
|
||||
SELECT
|
||||
submission_timestamp AS `timestamp`,
|
||||
event.category AS `type`,
|
||||
CAST(event.extra[SAFE_OFFSET(i)].value AS STRING) AS branch,
|
||||
CAST(event.extra[SAFE_OFFSET(j)].value AS STRING) AS experiment,
|
||||
event.name AS event_method
|
||||
FROM
|
||||
all_events,
|
||||
UNNEST(events) AS event,
|
||||
-- Workaround for https://issuetracker.google.com/issues/182829918
|
||||
-- To prevent having the branch name set to the experiment slug,
|
||||
-- the number of generated array indices needs to be different.
|
||||
UNNEST(GENERATE_ARRAY(0, 50)) AS i,
|
||||
UNNEST(GENERATE_ARRAY(0, 51)) AS j
|
||||
WHERE
|
||||
event.category = 'nimbus_events'
|
||||
AND CAST(event.extra[SAFE_OFFSET(i)].key AS STRING) = 'branch'
|
||||
AND CAST(event.extra[SAFE_OFFSET(j)].key AS STRING) = 'experiment'
|
||||
)
|
||||
SELECT
|
||||
DATE(`timestamp`) AS submission_date,
|
||||
`type`,
|
||||
experiment,
|
||||
branch,
|
||||
TIMESTAMP_ADD(
|
||||
TIMESTAMP_TRUNC(`timestamp`, HOUR),
|
||||
-- Aggregates event counts over 5-minute intervals
|
||||
INTERVAL(DIV(EXTRACT(MINUTE FROM `timestamp`), 5) * 5) MINUTE
|
||||
) AS window_start,
|
||||
TIMESTAMP_ADD(
|
||||
TIMESTAMP_TRUNC(`timestamp`, HOUR),
|
||||
INTERVAL((DIV(EXTRACT(MINUTE FROM `timestamp`), 5) + 1) * 5) MINUTE
|
||||
) AS window_end,
|
||||
COUNTIF(event_method = 'enroll' OR event_method = 'enrollment') AS enroll_count,
|
||||
COUNTIF(event_method = 'unenroll' OR event_method = 'unenrollment') AS unenroll_count,
|
||||
COUNTIF(event_method = 'graduate') AS graduate_count,
|
||||
COUNTIF(event_method = 'update') AS update_count,
|
||||
COUNTIF(event_method = 'enrollFailed') AS enroll_failed_count,
|
||||
COUNTIF(event_method = 'unenrollFailed') AS unenroll_failed_count,
|
||||
COUNTIF(event_method = 'updateFailed') AS update_failed_count,
|
||||
COUNTIF(event_method = 'disqualification') AS disqualification_count,
|
||||
COUNTIF(event_method = 'expose' OR event_method = 'exposure') AS exposure_count,
|
||||
COUNTIF(event_method = 'validationFailed') AS validation_failed_count
|
||||
FROM
|
||||
experiment_events
|
||||
WHERE
|
||||
-- Limit the amount of data the materialized view is going to backfill when created.
|
||||
-- This date can be moved forward whenever new changes of the materialized views need to be deployed.
|
||||
timestamp > TIMESTAMP('2023-10-10')
|
||||
GROUP BY
|
||||
submission_date,
|
||||
`type`,
|
||||
experiment,
|
||||
branch,
|
||||
window_start,
|
||||
window_end
|
|
@ -1,8 +0,0 @@
|
|||
friendly_name: Experiment Events Live
|
||||
description: |-
|
||||
Materialized view of experimentation related events
|
||||
coming from org_mozilla_ios_klar.
|
||||
owners:
|
||||
- ascholtz@mozilla.com
|
||||
labels:
|
||||
materialized_view: true
|
|
@ -1,42 +0,0 @@
|
|||
-- Generated via ./bqetl generate experiment_monitoring
|
||||
CREATE MATERIALIZED VIEW
|
||||
IF
|
||||
NOT EXISTS `moz-fx-data-shared-prod.org_mozilla_ios_klar_derived.experiment_search_events_live_v1`
|
||||
OPTIONS
|
||||
(enable_refresh = TRUE, refresh_interval_minutes = 5)
|
||||
AS
|
||||
SELECT
|
||||
DATE(submission_timestamp) AS submission_date,
|
||||
experiment.key AS experiment,
|
||||
experiment.value.branch AS branch,
|
||||
TIMESTAMP_ADD(
|
||||
TIMESTAMP_TRUNC(submission_timestamp, HOUR),
|
||||
-- Aggregates event counts over 5-minute intervals
|
||||
INTERVAL(DIV(EXTRACT(MINUTE FROM submission_timestamp), 5) * 5) MINUTE
|
||||
) AS window_start,
|
||||
TIMESTAMP_ADD(
|
||||
TIMESTAMP_TRUNC(submission_timestamp, HOUR),
|
||||
INTERVAL((DIV(EXTRACT(MINUTE FROM submission_timestamp), 5) + 1) * 5) MINUTE
|
||||
) AS window_end,
|
||||
-- Concatenating an element with value = 0 ensures that the count values are not null even if the array is empty
|
||||
-- Materialized views don't support COALESCE or IFNULL
|
||||
SUM(0) AS ad_clicks_count,
|
||||
SUM(0) AS search_with_ads_count,
|
||||
SUM(0) AS search_count,
|
||||
FROM
|
||||
`moz-fx-data-shared-prod.org_mozilla_ios_klar_live.metrics_v1`
|
||||
LEFT JOIN
|
||||
UNNEST(ping_info.experiments) AS experiment
|
||||
CROSS JOIN
|
||||
-- Max. number of entries is around 10
|
||||
UNNEST(GENERATE_ARRAY(0, 50)) AS i
|
||||
WHERE
|
||||
-- Limit the amount of data the materialized view is going to backfill when created.
|
||||
-- This date can be moved forward whenever new changes of the materialized views need to be deployed.
|
||||
DATE(submission_timestamp) > '2023-10-10'
|
||||
GROUP BY
|
||||
submission_date,
|
||||
experiment,
|
||||
branch,
|
||||
window_start,
|
||||
window_end
|
|
@ -1,8 +0,0 @@
|
|||
friendly_name: Experiment Search Events Live
|
||||
description: |-
|
||||
Materialized view of experimentation related search events
|
||||
coming from org_mozilla_ios_klar clients.
|
||||
owners:
|
||||
- ascholtz@mozilla.com
|
||||
labels:
|
||||
materialized_view: true
|
Некоторые файлы не были показаны из-за слишком большого количества измененных файлов Показать больше
Загрузка…
Ссылка в новой задаче