-
Notifications
You must be signed in to change notification settings - Fork 105
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Create new aggregate table for Firefox Health Indicators dashboard (#…
…6678) * Create new aggregate table for Firefox Health Indicators dashboard * Add aggregate table label and update table description * Do not require partition filter
- Loading branch information
Showing
4 changed files
with
142 additions
and
0 deletions.
There are no files selected for viewing
7 changes: 7 additions & 0 deletions
7
sql/moz-fx-data-shared-prod/telemetry/fx_health_ind_clients_daily_by_country/view.sql
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
CREATE OR REPLACE VIEW | ||
`moz-fx-data-shared-prod.telemetry.fx_health_ind_clients_daily_by_country` | ||
AS | ||
SELECT | ||
* | ||
FROM | ||
`moz-fx-data-shared-prod.telemetry_derived.fx_health_ind_clients_daily_by_country_v1` |
22 changes: 22 additions & 0 deletions
22
...ata-shared-prod/telemetry_derived/fx_health_ind_clients_daily_by_country_v1/metadata.yaml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
friendly_name: Fx Health Ind Clients Daily By Country | ||
description: |- | ||
Calculates active hrs, subsession hrs, and searches per user by country on a 1% client sample | ||
owners: | ||
- kwindau@mozilla.com | ||
labels: | ||
incremental: true | ||
owner1: kwindau@mozilla.com | ||
table_type: aggregate | ||
scheduling: | ||
dag_name: bqetl_fx_health_ind_dashboard | ||
bigquery: | ||
time_partitioning: | ||
type: day | ||
field: submission_date | ||
require_partition_filter: false | ||
expiration_days: null | ||
range_partitioning: null | ||
clustering: | ||
fields: | ||
- country | ||
references: {} |
92 changes: 92 additions & 0 deletions
92
...fx-data-shared-prod/telemetry_derived/fx_health_ind_clients_daily_by_country_v1/query.sql
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,92 @@ | ||
WITH searches_per_user_by_country_and_date_staging AS ( | ||
SELECT | ||
submission_date_s3, | ||
country, | ||
SUM(search_count_all) AS searches, | ||
COUNT(DISTINCT client_id) AS users, | ||
FROM | ||
`moz-fx-data-shared-prod.telemetry.clients_daily` | ||
WHERE | ||
submission_date_s3 = @submission_date | ||
AND app_name = 'Firefox' | ||
AND sample_id = 42 | ||
AND search_count_all < 10000 | ||
GROUP BY | ||
submission_date_s3, | ||
country | ||
), | ||
searches_per_user_by_country_and_date AS ( | ||
SELECT | ||
submission_date_s3, | ||
country, | ||
searches / users AS searches_per_user_ratio, | ||
FROM | ||
searches_per_user_by_country_and_date_staging | ||
), | ||
subsession_hours_per_user_staging AS ( | ||
SELECT | ||
submission_date_s3, | ||
country, | ||
SUM(subsession_hours_sum) AS `hours`, | ||
COUNT(DISTINCT client_id) AS users, | ||
FROM | ||
`moz-fx-data-shared-prod.telemetry.clients_daily` | ||
WHERE | ||
submission_date_s3 = @submission_date | ||
AND app_name = 'Firefox' | ||
AND sample_id = 42 | ||
AND subsession_hours_sum < 24 | ||
GROUP BY | ||
submission_date_s3, | ||
country | ||
), | ||
subsession_hours_per_user AS ( | ||
SELECT | ||
submission_date_s3, | ||
country, | ||
`hours` / users AS subsession_hours_per_user_ratio | ||
FROM | ||
subsession_hours_per_user_staging | ||
), | ||
active_hours_per_user_staging AS ( | ||
SELECT | ||
submission_date_s3, | ||
country, | ||
SUM(active_hours_sum) AS `hours`, | ||
COUNT(DISTINCT(client_id)) AS users, | ||
FROM | ||
`moz-fx-data-shared-prod.telemetry.clients_daily` | ||
WHERE | ||
submission_date_s3 = @submission_date | ||
AND app_name = 'Firefox' | ||
AND sample_id = 42 | ||
AND active_hours_sum < 24 | ||
GROUP BY | ||
submission_date_s3, | ||
country | ||
), | ||
active_hours_per_user AS ( | ||
SELECT | ||
submission_date_s3, | ||
country, | ||
`hours` / users AS active_hours_per_user_ratio | ||
FROM | ||
active_hours_per_user_staging | ||
) | ||
SELECT | ||
COALESCE( | ||
COALESCE(spu.submission_date_s3, sshpu.submission_date_s3), | ||
ahpu.submission_date_s3 | ||
) AS submission_date, | ||
COALESCE(COALESCE(spu.country, sshpu.country), ahpu.country) AS country, | ||
spu.searches_per_user_ratio, | ||
sshpu.subsession_hours_per_user_ratio, | ||
ahpu.active_hours_per_user_ratio | ||
FROM | ||
searches_per_user_by_country_and_date AS spu | ||
FULL OUTER JOIN | ||
subsession_hours_per_user AS sshpu | ||
ON spu.country = sshpu.country | ||
FULL OUTER JOIN | ||
active_hours_per_user AS ahpu | ||
ON COALESCE(spu.country, sshpu.country) = ahpu.country |
21 changes: 21 additions & 0 deletions
21
...-data-shared-prod/telemetry_derived/fx_health_ind_clients_daily_by_country_v1/schema.yaml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
fields: | ||
- mode: NULLABLE | ||
name: submission_date | ||
type: DATE | ||
description: Submission Date | ||
- mode: NULLABLE | ||
name: country | ||
type: STRING | ||
description: Country | ||
- mode: NULLABLE | ||
name: searches_per_user_ratio | ||
type: FLOAT | ||
description: Ratio of Searches per User | ||
- mode: NULLABLE | ||
name: subsession_hours_per_user_ratio | ||
type: NUMERIC | ||
description: Ratio of Subsession Hours per User | ||
- mode: NULLABLE | ||
name: active_hours_per_user_ratio | ||
type: FLOAT | ||
description: Ratio of Active Hours per User |
cfd1a67
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Integration report for "Create new aggregate table for Firefox Health Indicators dashboard (#6678)"
sql.diff
Click to expand!
Link to full diff
cfd1a67
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Integration report for "Create new aggregate table for Firefox Health Indicators dashboard (#6678)"
sql.diff
No content detected.