Skip to content

Commit

Permalink
feat(DENG-6890): Update mobile kpi support metric aggregates to suppo…
Browse files Browse the repository at this point in the history
…rt dma analysis (#6783)

* feat: add device_type and device_manufacturer to KPI support metrics datasets

* feat: ensure all mobile kpi support metric aggregated dataset have device_type and device_manufacturer dimensions

* feat: add device_type and device_manfacturer to the mobile kpi support metric aggregate queries

* feat: tweak active_users view device_type value setting logic

* feat: lower case device_manufacturer for some cases where the same manufacturer value has different casing

* feat: bucket device_manufacturers into "other" bucket in case when they have a lower occurance to prevent from exploding the aggregate tables

* fix: retention_clients some selection fields being ambiguous

* feat: Use dense rank instead of count for bucketing all device_manufacturers into other bucket if they are rank 151 or more

* fix: using incorrect source table for ranking device_manufacturers

* feat: make sure that device_manufacturer is lowered prior to joining
  • Loading branch information
kik-kik authored Jan 15, 2025
1 parent 6c7055d commit b81a7a0
Show file tree
Hide file tree
Showing 10 changed files with 138 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,10 @@ CREATE OR REPLACE VIEW
`{{ project_id }}.{{ dataset }}.{{ name }}`
AS
SELECT
* EXCEPT (isp),
* EXCEPT (isp) REPLACE(
-- Lower device_manufacturer as in some cases the same manufacturer value has different casing.
LOWER(device_manufacturer) AS device_manufacturer
),
CASE
WHEN LOWER(isp) = "browserstack"
THEN CONCAT("{{ friendly_name }}", " ", isp)
Expand Down Expand Up @@ -47,5 +50,15 @@ SELECT
-- Adding isp at the end because it's in different column index in baseline table for some products.
-- This is to make sure downstream union works as intended.
isp,
CASE
WHEN normalized_os = "iOS" AND STARTS_WITH(device_model, "iPad")
THEN "iPad"
WHEN normalized_os = "iOS" AND STARTS_WITH(device_model, "iPhone")
THEN "iPhone"
WHEN normalized_os = "Android"
THEN "Android"
ELSE
CAST(NULL AS STRING)
END AS device_type,
FROM
`{{ project_id }}.{{ dataset }}.baseline_clients_last_seen`
Original file line number Diff line number Diff line change
@@ -1,4 +1,24 @@
{{ header }}
WITH device_manufacturer_counts AS (
SELECT
submission_date,
device_manufacturer,
RANK() OVER(PARTITION BY submission_date ORDER BY COUNT(*) DESC) AS manufacturer_rank,
FROM
`{{ project_id }}.{{ dataset }}.engagement_clients`
WHERE
{% raw %}
{% if is_init() %}
submission_date < CURRENT_DATE
{% else %}
submission_date = @submission_date
{% endif %}
{% endraw %}
GROUP BY
submission_date,
device_manufacturer
)

SELECT
submission_date,
first_seen_date,
Expand All @@ -14,8 +34,14 @@ SELECT
COUNTIF(is_dau) AS dau,
COUNTIF(is_wau) AS wau,
COUNTIF(is_mau) AS mau,
device_type,
-- Bucket device manufacturers with low count prior to aggregation
IF(manufacturer_rank <= 150, device_manufacturer, "other") AS device_manufacturer,
FROM
`{{ project_id }}.{{ dataset }}.engagement_clients`
LEFT JOIN
device_manufacturer_counts
USING(submission_date, device_manufacturer)
WHERE
{% raw %}
{% if is_init() %}
Expand All @@ -32,6 +58,8 @@ GROUP BY
app_version,
country,
locale,
device_type,
device_manufacturer,
is_mobile
{% for field in product_attribution_fields.values() if not field.client_only %}
{% if loop.first %},{% endif %}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -58,3 +58,15 @@ fields:
type: INTEGER
mode: NULLABLE
description: MAU - Monthly Active Users

- name: device_type
type: STRING
mode: NULLABLE
description: |
On Apple devices allows us to differentiate between iPhone and iPad. On Android devices the value is always "Android".
- name: device_manufacturer
type: STRING
mode: NULLABLE
description: |
Manufacturer of the device where the client is installed.
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,8 @@ WITH active_users AS (
is_wau,
is_mau,
is_mobile,
device_type,
device_manufacturer,
FROM
`{{ project_id }}.{{ dataset }}.active_users`
),
Expand Down Expand Up @@ -62,6 +64,8 @@ SELECT
THEN 'existing_user'
ELSE 'Unknown'
END AS lifecycle_stage,
device_type,
device_manufacturer,
FROM
active_users
LEFT JOIN
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ SELECT
attribution.{{ attribution_field }},
{% endfor %}
attribution.paid_vs_organic,
device_type,
FROM
`{{ project_id }}.{{ dataset }}.active_users` AS active_users
LEFT JOIN
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,24 @@
{{ header }}
WITH device_manufacturer_counts AS (
SELECT
first_seen_date,
device_manufacturer,
RANK() OVER(PARTITION BY first_seen_date ORDER BY COUNT(*) DESC) AS manufacturer_rank,
FROM
`{{ project_id }}.{{ dataset }}.new_profile_clients`
WHERE
{% raw %}
{% if is_init() %}
first_seen_date < CURRENT_DATE
{% else %}
first_seen_date = @submission_date
{% endif %}
{% endraw %}
GROUP BY
first_seen_date,
device_manufacturer
)

SELECT
first_seen_date,
normalized_channel,
Expand All @@ -8,14 +28,19 @@ SELECT
locale,
os,
os_version,
device_manufacturer,
-- Bucket device manufacturers with low count prior to aggregation
IF(manufacturer_rank <= 150, device_manufacturer, "other") AS device_manufacturer,
is_mobile,
{% for field in product_attribution_fields.values() if not field.client_only %}
{{ field.name }},
{% endfor %}
COUNT(*) AS new_profiles,
device_type,
FROM
`{{ project_id }}.{{ dataset }}.new_profile_clients`
LEFT JOIN
device_manufacturer_counts
USING(first_seen_date, device_manufacturer)
WHERE
{% raw %}
{% if is_init() %}
Expand All @@ -33,6 +58,7 @@ GROUP BY
locale,
os,
os_version,
device_type,
device_manufacturer,
is_mobile
{% for field in product_attribution_fields.values() if not field.client_only %}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -58,3 +58,9 @@ fields:
type: INTEGER
mode: NULLABLE
description: Number of new profiles recorded for the first seen date.

- name: device_type
type: STRING
mode: NULLABLE
description: |
On Apple devices allows us to differentiate between iPhone and iPad. On Android devices the value is always "Android".
Original file line number Diff line number Diff line change
@@ -1,4 +1,26 @@
{{ header }}
WITH device_manufacturer_counts AS (
SELECT
submission_date,
device_manufacturer,
RANK() OVER(PARTITION BY submission_date ORDER BY COUNT(*) DESC) AS manufacturer_rank,
FROM
`{{ project_id }}.{{ dataset }}.retention_clients`
WHERE
{% raw %}
{% if is_init() %}
metric_date < DATE_SUB(CURRENT_DATE, INTERVAL 27 DAY)
AND submission_date < CURRENT_DATE
{% else %}
metric_date = DATE_SUB(@submission_date, INTERVAL 27 DAY)
AND submission_date = @submission_date
{% endif %}
{% endraw %}
GROUP BY
submission_date,
device_manufacturer
)

SELECT
metric_date,
first_seen_date,
Expand All @@ -18,8 +40,14 @@ SELECT
COUNTIF(retained_week_4_new_profile) AS retained_week_4_new_profiles,
COUNTIF(new_profile_metric_date) AS new_profiles_metric_date,
COUNTIF(repeat_profile) AS repeat_profiles,
device_type,
-- Bucket device manufacturers with low count prior to aggregation
IF(manufacturer_rank <= 150, device_manufacturer, "other") AS device_manufacturer,
FROM
`{{ project_id }}.{{ dataset }}.retention_clients`
LEFT JOIN
device_manufacturer_counts
USING(submission_date, device_manufacturer)
WHERE
{% raw %}
{% if is_init() %}
Expand All @@ -38,6 +66,8 @@ GROUP BY
country,
app_version,
locale,
device_type,
device_manufacturer,
is_mobile
{% for field in product_attribution_fields.values() if not field.client_only %}
{% if loop.first %},{% endif %}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -78,3 +78,15 @@ fields:
type: INTEGER
mode: NULLABLE
description: Number of new profiles on the metric date that were DAU at least twice in the next 28 days.

- name: device_type
type: STRING
mode: NULLABLE
description: |
On Apple devices allows us to differentiate between iPhone and iPad. On Android devices the value is always "Android".
- name: device_manufacturer
type: STRING
mode: NULLABLE
description: |
Manufacturer of the device where the client is installed.
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,8 @@ WITH active_users AS (
days_seen_bits,
days_active_bits,
is_mobile,
device_type,
device_manufacturer,
FROM
`{{ project_id }}.{{ dataset }}.active_users`
),
Expand Down Expand Up @@ -81,6 +83,8 @@ SELECT
THEN 'existing_user'
ELSE 'Unknown'
END AS lifecycle_stage,
active_users.device_type,
active_users.device_manufacturer,
FROM
`{{ project_id }}.{{ dataset }}.baseline_clients_daily` AS clients_daily
INNER JOIN
Expand Down

1 comment on commit b81a7a0

@dataops-ci-bot
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Integration report for "feat(DENG-6890): Update mobile kpi support metric aggregates to support dma analysis (#6783)"

sql.diff

Click to expand!
Only in /tmp/workspace/main-generated-sql/sql/moz-fx-data-shared-prod/fenix/engagement_clients: schema.yaml
Only in /tmp/workspace/main-generated-sql/sql/moz-fx-data-shared-prod/fenix/new_profile_clients: schema.yaml
Only in /tmp/workspace/main-generated-sql/sql/moz-fx-data-shared-prod/fenix/retention_clients: schema.yaml
Only in /tmp/workspace/main-generated-sql/sql/moz-fx-data-shared-prod/firefox_ios/engagement_clients: schema.yaml
Only in /tmp/workspace/main-generated-sql/sql/moz-fx-data-shared-prod/firefox_ios/new_profile_clients: schema.yaml
Only in /tmp/workspace/main-generated-sql/sql/moz-fx-data-shared-prod/firefox_ios/retention_clients: schema.yaml
Only in /tmp/workspace/main-generated-sql/sql/moz-fx-data-shared-prod/focus_android/engagement_clients: schema.yaml
Only in /tmp/workspace/main-generated-sql/sql/moz-fx-data-shared-prod/focus_android/new_profile_clients: schema.yaml
Only in /tmp/workspace/main-generated-sql/sql/moz-fx-data-shared-prod/focus_android/retention_clients: schema.yaml
Only in /tmp/workspace/main-generated-sql/sql/moz-fx-data-shared-prod/focus_ios/engagement_clients: schema.yaml
Only in /tmp/workspace/main-generated-sql/sql/moz-fx-data-shared-prod/focus_ios/new_profile_clients: schema.yaml
Only in /tmp/workspace/main-generated-sql/sql/moz-fx-data-shared-prod/focus_ios/retention_clients: schema.yaml
Only in /tmp/workspace/main-generated-sql/sql/moz-fx-data-shared-prod/klar_android/engagement_clients: schema.yaml
Only in /tmp/workspace/main-generated-sql/sql/moz-fx-data-shared-prod/klar_android/new_profile_clients: schema.yaml
Only in /tmp/workspace/main-generated-sql/sql/moz-fx-data-shared-prod/klar_android/retention_clients: schema.yaml
Only in /tmp/workspace/main-generated-sql/sql/moz-fx-data-shared-prod/klar_ios/engagement_clients: schema.yaml
Only in /tmp/workspace/main-generated-sql/sql/moz-fx-data-shared-prod/klar_ios/new_profile_clients: schema.yaml
Only in /tmp/workspace/main-generated-sql/sql/moz-fx-data-shared-prod/klar_ios/retention_clients: schema.yaml
diff -bur --no-dereference --new-file /tmp/workspace/main-generated-sql/sql/moz-fx-data-shared-prod/accounts_backend_derived/event_monitoring_live_v1/materialized_view.sql /tmp/workspace/generated-sql/sql/moz-fx-data-shared-prod/accounts_backend_derived/event_monitoring_live_v1/materialized_view.sql
--- /tmp/workspace/main-generated-sql/sql/moz-fx-data-shared-prod/accounts_backend_derived/event_monitoring_live_v1/materialized_view.sql	2025-01-15 10:39:24.000000000 +0000
+++ /tmp/workspace/generated-sql/sql/moz-fx-data-shared-prod/accounts_backend_derived/event_monitoring_live_v1/materialized_view.sql	2025-01-15 10:43:04.000000000 +0000
@@ -67,7 +67,7 @@
   LEFT JOIN
     UNNEST(event.extra) AS event_extra
   WHERE
-    DATE(submission_timestamp) >= "2025-01-14"
+    DATE(submission_timestamp) >= "2025-01-15"
   GROUP BY
     submission_date,
     window_start,
diff -bur --no-dereference --new-file /tmp/workspace/main-generated-sql/sql/moz-fx-data-shared-prod/accounts_cirrus_derived/event_monitoring_live_v1/materialized_view.sql /tmp/workspace/generated-sql/sql/moz-fx-data-shared-prod/accounts_cirrus_derived/event_monitoring_live_v1/materialized_view.sql
--- /tmp/workspace/main-generated-sql/sql/moz-fx-data-shared-prod/accounts_cirrus_derived/event_monitoring_live_v1/materialized_view.sql	2025-01-15 10:39:23.000000000 +0000
+++ /tmp/workspace/generated-sql/sql/moz-fx-data-shared-prod/accounts_cirrus_derived/event_monitoring_live_v1/materialized_view.sql	2025-01-15 10:43:04.000000000 +0000
@@ -67,7 +67,7 @@
   LEFT JOIN
     UNNEST(event.extra) AS event_extra
   WHERE
-    DATE(submission_timestamp) >= "2025-01-14"
+    DATE(submission_timestamp) >= "2025-01-15"
   GROUP BY
     submission_date,
     window_start,
diff -bur --no-dereference --new-file /tmp/workspace/main-generated-sql/sql/moz-fx-data-shared-prod/accounts_frontend_derived/event_monitoring_live_v1/materialized_view.sql /tmp/workspace/generated-sql/sql/moz-fx-data-shared-prod/accounts_frontend_derived/event_monitoring_live_v1/materialized_view.sql
--- /tmp/workspace/main-generated-sql/sql/moz-fx-data-shared-prod/accounts_frontend_derived/event_monitoring_live_v1/materialized_view.sql	2025-01-15 10:39:23.000000000 +0000
+++ /tmp/workspace/generated-sql/sql/moz-fx-data-shared-prod/accounts_frontend_derived/event_monitoring_live_v1/materialized_view.sql	2025-01-15 10:43:04.000000000 +0000
@@ -67,7 +67,7 @@
   LEFT JOIN
     UNNEST(event.extra) AS event_extra
   WHERE
-    DATE(submission_timestamp) >= "2025-01-14"
+    DATE(submission_timestamp) >= "2025-01-15"
   GROUP BY
     submission_date,
     window_start,
diff -bur --no-dereference --new-file /tmp/workspace/main-generated-sql/sql/moz-fx-data-shared-prod/bedrock_derived/event_monitoring_live_v1/materialized_view.sql /tmp/workspace/generated-sql/sql/moz-fx-data-shared-prod/bedrock_derived/event_monitoring_live_v1/materialized_view.sql
--- /tmp/workspace/main-generated-sql/sql/moz-fx-data-shared-prod/bedrock_derived/event_monitoring_live_v1/materialized_view.sql	2025-01-15 10:39:23.000000000 +0000
+++ /tmp/workspace/generated-sql/sql/moz-fx-data-shared-prod/bedrock_derived/event_monitoring_live_v1/materialized_view.sql	2025-01-15 10:43:04.000000000 +0000
@@ -87,7 +87,7 @@
   LEFT JOIN
     UNNEST(event.extra) AS event_extra
   WHERE
-    DATE(submission_timestamp) >= "2025-01-14"
+    DATE(submission_timestamp) >= "2025-01-15"
   GROUP BY
     submission_date,
     window_start,
diff -bur --no-dereference --new-file /tmp/workspace/main-generated-sql/sql/moz-fx-data-shared-prod/burnham_derived/event_monitoring_live_v1/materialized_view.sql /tmp/workspace/generated-sql/sql/moz-fx-data-shared-prod/burnham_derived/event_monitoring_live_v1/materialized_view.sql
--- /tmp/workspace/main-generated-sql/sql/moz-fx-data-shared-prod/burnham_derived/event_monitoring_live_v1/materialized_view.sql	2025-01-15 10:39:24.000000000 +0000
+++ /tmp/workspace/generated-sql/sql/moz-fx-data-shared-prod/burnham_derived/event_monitoring_live_v1/materialized_view.sql	2025-01-15 10:43:05.000000000 +0000
@@ -67,7 +67,7 @@
   LEFT JOIN
     UNNEST(event.extra) AS event_extra
   WHERE
-    DATE(submission_timestamp) >= "2025-01-14"
+    DATE(submission_timestamp) >= "2025-01-15"
   GROUP BY
     submission_date,
     window_start,
diff -bur --no-dereference --new-file /tmp/workspace/main-generated-sql/sql/moz-fx-data-shared-prod/contextual_services/event_aggregates/schema.yaml /tmp/workspace/generated-sql/sql/moz-fx-data-shared-prod/contextual_services/event_aggregates/schema.yaml
--- /tmp/workspace/main-generated-sql/sql/moz-fx-data-shared-prod/contextual_services/event_aggregates/schema.yaml	2025-01-15 10:38:45.000000000 +0000
+++ /tmp/workspace/generated-sql/sql/moz-fx-data-shared-prod/contextual_services/event_aggregates/schema.yaml	2025-01-15 10:48:11.000000000 +0000
@@ -1,49 +1,49 @@
 fields:
-- mode: NULLABLE
-  name: submission_date
+- name: submission_date
   type: DATE
-- mode: NULLABLE
-  name: source
+  mode: NULLABLE
+- name: source
   type: STRING
-- mode: NULLABLE
-  name: event_type
+  mode: NULLABLE
+- name: event_type
   type: STRING
-- mode: NULLABLE
-  name: form_factor
+  mode: NULLABLE
+- name: form_factor
   type: STRING
-- mode: NULLABLE
-  name: country
+  mode: NULLABLE
+- name: country
   type: STRING
-- mode: NULLABLE
-  name: subdivision1
+  mode: NULLABLE
+- name: subdivision1
   type: STRING
-- mode: NULLABLE
-  name: advertiser
+  mode: NULLABLE
+- name: advertiser
   type: STRING
-- mode: NULLABLE
-  name: release_channel
+  mode: NULLABLE
+- name: release_channel
   type: STRING
-- mode: NULLABLE
-  name: position
+  mode: NULLABLE
+- name: position
   type: INTEGER
-- mode: NULLABLE
-  name: provider
+  mode: NULLABLE
+- name: provider
   type: STRING
-- mode: NULLABLE
-  name: match_type
+  mode: NULLABLE
+- name: match_type
   type: STRING
-- mode: NULLABLE
-  name: normalized_os
+  mode: NULLABLE
+- name: normalized_os
   type: STRING
-- mode: NULLABLE
-  name: suggest_data_sharing_enabled
+  mode: NULLABLE
+- name: suggest_data_sharing_enabled
   type: BOOLEAN
-- mode: NULLABLE
-  name: event_count
+  mode: NULLABLE
+- name: event_count
   type: INTEGER
-- mode: NULLABLE
-  name: user_count
+  mode: NULLABLE
+- name: user_count
   type: INTEGER
-- mode: NULLABLE
-  name: query_type
+  mode: NULLABLE
+- name: query_type
   type: STRING
+  mode: NULLABLE
diff -bur --no-dereference --new-file /tmp/workspace/main-generated-sql/sql/moz-fx-data-shared-prod/contextual_services/event_aggregates_suggest/schema.yaml /tmp/workspace/generated-sql/sql/moz-fx-data-shared-prod/contextual_services/event_aggregates_suggest/schema.yaml
--- /tmp/workspace/main-generated-sql/sql/moz-fx-data-shared-prod/contextual_services/event_aggregates_suggest/schema.yaml	2025-01-15 10:38:45.000000000 +0000
+++ /tmp/workspace/generated-sql/sql/moz-fx-data-shared-prod/contextual_services/event_aggregates_suggest/schema.yaml	2025-01-15 10:48:21.000000000 +0000
@@ -1,40 +1,40 @@
 fields:
-- mode: NULLABLE
-  name: submission_date
+- name: submission_date
   type: DATE
-- mode: NULLABLE
-  name: form_factor
+  mode: NULLABLE
+- name: form_factor
   type: STRING
-- mode: NULLABLE
-  name: country
+  mode: NULLABLE
+- name: country
   type: STRING
-- mode: NULLABLE
-  name: advertiser
+  mode: NULLABLE
+- name: advertiser
   type: STRING
-- mode: NULLABLE
-  name: normalized_os
+  mode: NULLABLE
+- name: normalized_os
   type: STRING
-- mode: NULLABLE
-  name: release_channel
+  mode: NULLABLE
+- name: release_channel
   type: STRING
-- mode: NULLABLE
-  name: position
+  mode: NULLABLE
+- name: position
   type: INTEGER
-- mode: NULLABLE
-  name: provider
+  mode: NULLABLE
+- name: provider
   type: STRING
-- mode: NULLABLE
-  name: match_type
+  mode: NULLABLE
+- name: match_type
   type: STRING
-- mode: NULLABLE
-  name: suggest_data_sharing_enabled
+  mode: NULLABLE
+- name: suggest_data_sharing_enabled
   type: BOOLEAN
-- mode: NULLABLE
-  name: impression_count
+  mode: NULLABLE
+- name: impression_count
   type: INTEGER
-- mode: NULLABLE
-  name: click_count
+  mode: NULLABLE
+- name: click_count
   type: INTEGER
-- mode: NULLABLE
-  name: query_type
+  mode: NULLABLE
+- name: query_type
   type: STRING
+  mode: NULLABLE
diff -bur --no-dereference --new-file /tmp/workspace/main-generated-sql/sql/moz-fx-data-shared-prod/debug_ping_view_derived/event_monitoring_live_v1/materialized_view.sql /tmp/workspace/generated-sql/sql/moz-fx-data-shared-prod/debug_ping_view_derived/event_monitoring_live_v1/materialized_view.sql
--- /tmp/workspace/main-generated-sql/sql/moz-fx-data-shared-prod/debug_ping_view_derived/event_monitoring_live_v1/materialized_view.sql	2025-01-15 10:39:23.000000000 +0000
+++ /tmp/workspace/generated-sql/sql/moz-fx-data-shared-prod/debug_ping_view_derived/event_monitoring_live_v1/materialized_view.sql	2025-01-15 10:43:05.000000000 +0000
@@ -67,7 +67,7 @@
   LEFT JOIN
     UNNEST(event.extra) AS event_extra
   WHERE
-    DATE(submission_timestamp) >= "2025-01-14"
+    DATE(submission_timestamp) >= "2025-01-15"
   GROUP BY
     submission_date,
     window_start,
diff -bur --no-dereference --new-file /tmp/workspace/main-generated-sql/sql/moz-fx-data-shared-prod/fenix/active_users/schema.yaml /tmp/workspace/generated-sql/sql/moz-fx-data-shared-prod/fenix/active_users/schema.yaml
--- /tmp/workspace/main-generated-sql/sql/moz-fx-data-shared-prod/fenix/active_users/schema.yaml	2025-01-15 10:39:23.000000000 +0000
+++ /tmp/workspace/generated-sql/sql/moz-fx-data-shared-prod/fenix/active_users/schema.yaml	2025-01-15 10:48:47.000000000 +0000
@@ -137,3 +137,6 @@
 - name: isp
   type: STRING
   mode: NULLABLE
+- name: device_type
+  type: STRING
+  mode: NULLABLE
diff -bur --no-dereference --new-file /tmp/workspace/main-generated-sql/sql/moz-fx-data-shared-prod/fenix/active_users/view.sql /tmp/workspace/generated-sql/sql/moz-fx-data-shared-prod/fenix/active_users/view.sql
--- /tmp/workspace/main-generated-sql/sql/moz-fx-data-shared-prod/fenix/active_users/view.sql	2025-01-15 10:39:23.000000000 +0000
+++ /tmp/workspace/generated-sql/sql/moz-fx-data-shared-prod/fenix/active_users/view.sql	2025-01-15 10:48:03.000000000 +0000
@@ -3,7 +3,10 @@
   `moz-fx-data-shared-prod.fenix.active_users`
 AS
 SELECT
-  * EXCEPT (isp),
+  * EXCEPT (isp) REPLACE(
+    -- Lower device_manufacturer as in some cases the same manufacturer value has different casing.
+    LOWER(device_manufacturer) AS device_manufacturer
+  ),
   CASE
     WHEN LOWER(isp) = "browserstack"
       THEN CONCAT("Fenix", " ", isp)
@@ -43,5 +46,16 @@
   -- Adding isp at the end because it's in different column index in baseline table for some products.
   -- This is to make sure downstream union works as intended.
   isp,
+  CASE
+    WHEN normalized_os = "iOS"
+      AND STARTS_WITH(device_model, "iPad")
+      THEN "iPad"
+    WHEN normalized_os = "iOS"
+      AND STARTS_WITH(device_model, "iPhone")
+      THEN "iPhone"
+    WHEN normalized_os = "Android"
+      THEN "Android"
+    ELSE CAST(NULL AS STRING)
+  END AS device_type,
 FROM
   `moz-fx-data-shared-prod.fenix.baseline_clients_last_seen`
diff -bur --no-dereference --new-file /tmp/workspace/main-generated-sql/sql/moz-fx-data-shared-prod/fenix/engagement_clients/schema.yaml /tmp/workspace/generated-sql/sql/moz-fx-data-shared-prod/fenix/engagement_clients/schema.yaml
--- /tmp/workspace/main-generated-sql/sql/moz-fx-data-shared-prod/fenix/engagement_clients/schema.yaml	2025-01-15 10:39:23.000000000 +0000
+++ /tmp/workspace/generated-sql/sql/moz-fx-data-shared-prod/fenix/engagement_clients/schema.yaml	1970-01-01 00:00:00.000000000 +0000
@@ -1,97 +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: first_seen_date
-  type: DATE
-  mode: NULLABLE
-- name: app_name
-  type: STRING
-  mode: NULLABLE
-- name: normalized_channel
-  type: STRING
-  mode: NULLABLE
-- name: app_version
-  type: STRING
-  mode: NULLABLE
-- name: locale
-  type: STRING
-  mode: NULLABLE
-- name: country
-  type: STRING
-  mode: NULLABLE
-- name: isp
-  type: STRING
-  mode: NULLABLE
-- name: is_dau
-  type: BOOLEAN
-  mode: NULLABLE
-- name: is_wau
-  type: BOOLEAN
-  mode: NULLABLE
-- name: is_mau
-  type: BOOLEAN
-  mode: NULLABLE
-- name: is_mobile
-  type: BOOLEAN
-  mode: NULLABLE
-- name: play_store_attribution_campaign
-  type: STRING
-  mode: NULLABLE
-- name: play_store_attribution_medium
-  type: STRING
-  mode: NULLABLE
-- name: play_store_attribution_source
-  type: STRING
-  mode: NULLABLE
-- name: play_store_attribution_timestamp
-  type: TIMESTAMP
-  mode: NULLABLE
-- name: play_store_attribution_content
-  type: STRING
-  mode: NULLABLE
-- name: play_store_attribution_term
-  type: STRING
-  mode: NULLABLE
-- name: play_store_attribution_install_referrer_response
-  type: STRING
-  mode: NULLABLE
-- name: meta_attribution_app
-  type: STRING
-  mode: NULLABLE
-- name: meta_attribution_timestamp
-  type: TIMESTAMP
-  mode: NULLABLE
-- name: install_source
-  type: STRING
-  mode: NULLABLE
-- name: adjust_ad_group
-  type: STRING
-  mode: NULLABLE
-- name: adjust_campaign
-  type: STRING
-  mode: NULLABLE
-- name: adjust_creative
-  type: STRING
-  mode: NULLABLE
-- name: adjust_network
-  type: STRING
-  mode: NULLABLE
-- name: adjust_attribution_timestamp
-  type: TIMESTAMP
-  mode: NULLABLE
-- name: distribution_id
-  type: STRING
-  mode: NULLABLE
-- name: paid_vs_organic
-  type: STRING
-  mode: NULLABLE
-- name: lifecycle_stage
-  type: STRING
-  mode: NULLABLE
diff -bur --no-dereference --new-file /tmp/workspace/main-generated-sql/sql/moz-fx-data-shared-prod/fenix/engagement_clients/view.sql /tmp/workspace/generated-sql/sql/moz-fx-data-shared-prod/fenix/engagement_clients/view.sql
--- /tmp/workspace/main-generated-sql/sql/moz-fx-data-shared-prod/fenix/engagement_clients/view.sql	2025-01-15 10:39:23.000000000 +0000
+++ /tmp/workspace/generated-sql/sql/moz-fx-data-shared-prod/fenix/engagement_clients/view.sql	2025-01-15 10:48:03.000000000 +0000
@@ -18,6 +18,8 @@
     is_wau,
     is_mau,
     is_mobile,
+    device_type,
+    device_manufacturer,
   FROM
     `moz-fx-data-shared-prod.fenix.active_users`
 ),
@@ -88,6 +90,8 @@
       THEN 'existing_user'
     ELSE 'Unknown'
   END AS lifecycle_stage,
+  device_type,
+  device_manufacturer,
 FROM
   active_users
 LEFT JOIN
diff -bur --no-dereference --new-file /tmp/workspace/main-generated-sql/sql/moz-fx-data-shared-prod/fenix/funnel_retention_clients/schema.yaml /tmp/workspace/generated-sql/sql/moz-fx-data-shared-prod/fenix/funnel_retention_clients/schema.yaml
--- /tmp/workspace/main-generated-sql/sql/moz-fx-data-shared-prod/fenix/funnel_retention_clients/schema.yaml	2025-01-15 10:38:45.000000000 +0000
+++ /tmp/workspace/generated-sql/sql/moz-fx-data-shared-prod/fenix/funnel_retention_clients/schema.yaml	2025-01-15 10:48:37.000000000 +0000
@@ -26,6 +26,9 @@
 - name: adjust_network
   type: STRING
   mode: NULLABLE
+- name: install_source
+  type: STRING
+  mode: NULLABLE
 - name: retained_week_2
   type: BOOLEAN
   mode: NULLABLE
diff -bur --no-dereference --new-file /tmp/workspace/main-generated-sql/sql/moz-fx-data-shared-prod/fenix/funnel_retention_week_4/schema.yaml /tmp/workspace/generated-sql/sql/moz-fx-data-shared-prod/fenix/funnel_retention_week_4/schema.yaml
--- /tmp/workspace/main-generated-sql/sql/moz-fx-data-shared-prod/fenix/funnel_retention_week_4/schema.yaml	2025-01-15 10:38:45.000000000 +0000
+++ /tmp/workspace/generated-sql/sql/moz-fx-data-shared-prod/fenix/funnel_retention_week_4/schema.yaml	2025-01-15 10:48:44.000000000 +0000
@@ -48,6 +48,10 @@
   description: 'The type of source of a client installation.
 
     '
+- name: install_source
+  type: STRING
+  mode: NULLABLE
+  description: null
 - name: new_profiles
   type: INTEGER
   mode: NULLABLE
diff -bur --no-dereference --new-file /tmp/workspace/main-generated-sql/sql/moz-fx-data-shared-prod/fenix/metrics/schema.yaml /tmp/workspace/generated-sql/sql/moz-fx-data-shared-prod/fenix/metrics/schema.yaml
--- /tmp/workspace/main-generated-sql/sql/moz-fx-data-shared-prod/fenix/metrics/schema.yaml	2025-01-15 10:39:23.000000000 +0000
+++ /tmp/workspace/generated-sql/sql/moz-fx-data-shared-prod/fenix/metrics/schema.yaml	2025-01-15 10:53:00.000000000 +0000
@@ -1,11 +1,11 @@
 fields:
 - name: normalized_app_id
-  type: STRING
   mode: NULLABLE
+  type: STRING
   description: App ID of the channel data was received from
 - name: normalized_channel
-  type: STRING
   mode: NULLABLE
+  type: STRING
   description: Normalized channel name
 - name: additional_properties
   type: STRING
diff -bur --no-dereference --new-file /tmp/workspace/main-generated-sql/sql/moz-fx-data-shared-prod/fenix/new_profile_clients/schema.yaml /tmp/workspace/generated-sql/sql/moz-fx-data-shared-prod/fenix/new_profile_clients/schema.yaml
--- /tmp/workspace/main-generated-sql/sql/moz-fx-data-shared-prod/fenix/new_profile_clients/schema.yaml	2025-01-15 10:39:23.000000000 +0000
+++ /tmp/workspace/generated-sql/sql/moz-fx-data-shared-prod/fenix/new_profile_clients/schema.yaml	1970-01-01 00:00:00.000000000 +0000
@@ -1,91 +0,0 @@
-fields:
-- name: client_id
-  type: STRING
-  mode: NULLABLE
-- name: first_seen_date
-  type: DATE
-  mode: NULLABLE
-- name: normalized_channel
-  type: STRING
-  mode: NULLABLE
-- name: app_name
-  type: STRING
-  mode: NULLABLE
-- name: app_version
-  type: STRING
-  mode: NULLABLE
-- name: country
-  type: STRING
-  mode: NULLABLE
-- name: locale
-  type: STRING
-  mode: NULLABLE
-- name: isp
-  type: STRING
-  mode: NULLABLE
-- name: os
-  type: STRING
-  mode: NULLABLE
-- name: os_version
-  type: STRING
-  mode: NULLABLE
-- name: device_model
-  type: STRING
-  mode: NULLABLE
-- name: device_manufacturer
-  type: STRING
-  mode: NULLABLE
-- name: is_mobile
-  type: BOOLEAN
-  mode: NULLABLE
-- name: play_store_attribution_campaign
-  type: STRING
-  mode: NULLABLE
-- name: play_store_attribution_medium
-  type: STRING
-  mode: NULLABLE
-- name: play_store_attribution_source
-  type: STRING
-  mode: NULLABLE
-- name: play_store_attribution_timestamp
-  type: TIMESTAMP
-  mode: NULLABLE
-- name: play_store_attribution_content
-  type: STRING
-  mode: NULLABLE
-- name: play_store_attribution_term
-  type: STRING
-  mode: NULLABLE
-- name: play_store_attribution_install_referrer_response
-  type: STRING
-  mode: NULLABLE
-- name: meta_attribution_app
-  type: STRING
-  mode: NULLABLE
-- name: meta_attribution_timestamp
-  type: TIMESTAMP
-  mode: NULLABLE
-- name: install_source
-  type: STRING
-  mode: NULLABLE
-- name: adjust_ad_group
-  type: STRING
-  mode: NULLABLE
-- name: adjust_campaign
-  type: STRING
-  mode: NULLABLE
-- name: adjust_creative
-  type: STRING
-  mode: NULLABLE
-- name: adjust_network
-  type: STRING
-  mode: NULLABLE
-- name: adjust_attribution_timestamp
-  type: TIMESTAMP
-  mode: NULLABLE
-- name: distribution_id
-  type: STRING
-  mode: NULLABLE
-- name: paid_vs_organic
-  type: STRING
-  mode: NULLABLE
diff -bur --no-dereference --new-file /tmp/workspace/main-generated-sql/sql/moz-fx-data-shared-prod/fenix/new_profile_clients/view.sql /tmp/workspace/generated-sql/sql/moz-fx-data-shared-prod/fenix/new_profile_clients/view.sql
--- /tmp/workspace/main-generated-sql/sql/moz-fx-data-shared-prod/fenix/new_profile_clients/view.sql	2025-01-15 10:39:23.000000000 +0000
+++ /tmp/workspace/generated-sql/sql/moz-fx-data-shared-prod/fenix/new_profile_clients/view.sql	2025-01-15 10:48:03.000000000 +0000
@@ -33,6 +33,7 @@
   attribution.adjust_attribution_timestamp,
   attribution.distribution_id,
   attribution.paid_vs_organic,
+  device_type,
 FROM
   `moz-fx-data-shared-prod.fenix.active_users` AS active_users
 LEFT JOIN
diff -bur --no-dereference --new-file /tmp/workspace/main-generated-sql/sql/moz-fx-data-shared-prod/fenix/retention_clients/schema.yaml /tmp/workspace/generated-sql/sql/moz-fx-data-shared-prod/fenix/retention_clients/schema.yaml
--- /tmp/workspace/main-generated-sql/sql/moz-fx-data-shared-prod/fenix/retention_clients/schema.yaml	2025-01-15 10:39:23.000000000 +0000
+++ /tmp/workspace/generated-sql/sql/moz-fx-data-shared-prod/fenix/retention_clients/schema.yaml	1970-01-01 00:00:00.000000000 +0000
@@ -1,118 +0,0 @@
-fields:
-- name: submission_date
-  type: DATE
-  mode: NULLABLE
-- name: metric_date
-  type: DATE
-  mode: NULLABLE
-- name: first_seen_date
-  type: DATE
-  mode: NULLABLE
-- name: client_id
-  type: STRING
-  mode: NULLABLE
-- name: sample_id
-  type: INTEGER
-  mode: NULLABLE
-- name: app_name
-  type: STRING
-  mode: NULLABLE
-- name: normalized_channel
-  type: STRING
-  mode: NULLABLE
-- name: country
-  type: STRING
-  mode: NULLABLE
-- name: app_version
-  type: STRING
-  mode: NULLABLE
-- name: locale
-  type: STRING
-  mode: NULLABLE
-- name: isp
-  type: STRING
-  mode: NULLABLE
-- name: is_mobile
-  type: BOOLEAN
-  mode: NULLABLE
-- name: play_store_attribution_campaign
-  type: STRING
-  mode: NULLABLE
-- name: play_store_attribution_medium
-  type: STRING
-  mode: NULLABLE
-- name: play_store_attribution_source
-  type: STRING
-  mode: NULLABLE
-- name: play_store_attribution_timestamp
-  type: TIMESTAMP
-  mode: NULLABLE
-- name: play_store_attribution_content
-  type: STRING
-  mode: NULLABLE
-- name: play_store_attribution_term
-  type: STRING
-  mode: NULLABLE
-- name: play_store_attribution_install_referrer_response
-  type: STRING
-  mode: NULLABLE
-- name: meta_attribution_app
-  type: STRING
-  mode: NULLABLE
-- name: meta_attribution_timestamp
-  type: TIMESTAMP
-  mode: NULLABLE
-- name: install_source
-  type: STRING
-  mode: NULLABLE
-- name: adjust_ad_group
-  type: STRING
-  mode: NULLABLE
-- name: adjust_campaign
-  type: STRING
-  mode: NULLABLE
-- name: adjust_creative
-  type: STRING
-  mode: NULLABLE
-- name: adjust_network
-  type: STRING
-  mode: NULLABLE
-- name: adjust_attribution_timestamp
-  type: TIMESTAMP
-  mode: NULLABLE
-- name: distribution_id
-  type: STRING
-  mode: NULLABLE
-- name: paid_vs_organic
-  type: STRING
-  mode: NULLABLE
-- name: ping_sent_metric_date
-  type: BOOLEAN
-  mode: NULLABLE
-- name: ping_sent_week_4
-  type: BOOLEAN
-  mode: NULLABLE
-- name: active_metric_date
-  type: BOOLEAN
-  mode: NULLABLE
-- name: retained_week_4
-  type: BOOLEAN
-  mode: NULLABLE
-- name: new_profile_metric_date
-  type: BOOLEAN
-  mode: NULLABLE
-- name: retained_week_4_new_profile
-  type: BOOLEAN
-  mode: NULLABLE
-- name: repeat_profile
-  type: BOOLEAN
-  mode: NULLABLE
-- name: days_seen_bits
-  type: INTEGER
-  mode: NULLABLE
-- name: days_active_bits
-  type: INTEGER
-  mode: NULLABLE
-- name: lifecycle_stage
-  type: STRING
-  mode: NULLABLE
diff -bur --no-dereference --new-file /tmp/workspace/main-generated-sql/sql/moz-fx-data-shared-prod/fenix/retention_clients/view.sql /tmp/workspace/generated-sql/sql/moz-fx-data-shared-prod/fenix/retention_clients/view.sql
--- /tmp/workspace/main-generated-sql/sql/moz-fx-data-shared-prod/fenix/retention_clients/view.sql	2025-01-15 10:39:23.000000000 +0000
+++ /tmp/workspace/generated-sql/sql/moz-fx-data-shared-prod/fenix/retention_clients/view.sql	2025-01-15 10:48:03.000000000 +0000
@@ -14,6 +14,8 @@
     days_seen_bits,
     days_active_bits,
     is_mobile,
+    device_type,
+    device_manufacturer,
   FROM
     `moz-fx-data-shared-prod.fenix.active_users`
 ),
@@ -107,6 +109,8 @@
       THEN 'existing_user'
     ELSE 'Unknown'
   END AS lifecycle_stage,
+  active_users.device_type,
+  active_users.device_manufacturer,
 FROM
   `moz-fx-data-shared-prod.fenix.baseline_clients_daily` AS clients_daily
 INNER JOIN
diff -bur --no-dereference --new-file /tmp/workspace/main-generated-sql/sql/moz-fx-data-shared-prod/fenix_derived/engagement_v1/query.sql /tmp/workspace/generated-sql/sql/moz-fx-data-shared-prod/fenix_derived/engagement_v1/query.sql
--- /tmp/workspace/main-generated-sql/sql/moz-fx-data-shared-prod/fenix_derived/engagement_v1/query.sql	2025-01-15 10:39:24.000000000 +0000
+++ /tmp/workspace/generated-sql/sql/moz-fx-data-shared-prod/fenix_derived/engagement_v1/query.sql	2025-01-15 10:48:03.000000000 +0000
@@ -1,4 +1,21 @@
 -- Query generated via `mobile_kpi_support_metrics` SQL generator.
+WITH device_manufacturer_counts AS (
+  SELECT
+    submission_date,
+    device_manufacturer,
+    RANK() OVER (PARTITION BY submission_date ORDER BY COUNT(*) DESC) AS manufacturer_rank,
+  FROM
+    `moz-fx-data-shared-prod.fenix.engagement_clients`
+  WHERE
+    {% if is_init() %}
+      submission_date < CURRENT_DATE
+    {% else %}
+      submission_date = @submission_date
+    {% endif %}
+  GROUP BY
+    submission_date,
+    device_manufacturer
+)
 SELECT
   submission_date,
   first_seen_date,
@@ -21,8 +38,14 @@
   COUNTIF(is_dau) AS dau,
   COUNTIF(is_wau) AS wau,
   COUNTIF(is_mau) AS mau,
+  device_type,
+  -- Bucket device manufacturers with low count prior to aggregation
+  IF(manufacturer_rank <= 150, device_manufacturer, "other") AS device_manufacturer,
 FROM
   `moz-fx-data-shared-prod.fenix.engagement_clients`
+LEFT JOIN
+  device_manufacturer_counts
+  USING (submission_date, device_manufacturer)
 WHERE
   {% if is_init() %}
     submission_date < CURRENT_DATE
@@ -37,6 +60,8 @@
   app_version,
   country,
   locale,
+  device_type,
+  device_manufacturer,
   is_mobile,
   play_store_attribution_campaign,
   play_store_attribution_medium,
diff -bur --no-dereference --new-file /tmp/workspace/main-generated-sql/sql/moz-fx-data-shared-prod/fenix_derived/engagement_v1/schema.yaml /tmp/workspace/generated-sql/sql/moz-fx-data-shared-prod/fenix_derived/engagement_v1/schema.yaml
--- /tmp/workspace/main-generated-sql/sql/moz-fx-data-shared-prod/fenix_derived/engagement_v1/schema.yaml	2025-01-15 10:39:24.000000000 +0000
+++ /tmp/workspace/generated-sql/sql/moz-fx-data-shared-prod/fenix_derived/engagement_v1/schema.yaml	2025-01-15 10:48:03.000000000 +0000
@@ -103,3 +103,15 @@
   type: INTEGER
   mode: NULLABLE
   description: MAU - Monthly Active Users
+
+- name: device_type
+  type: STRING
+  mode: NULLABLE
+  description: |
+    On Apple devices allows us to differentiate between iPhone and iPad. On Android devices the value is always "Android".
+
+- name: device_manufacturer
+  type: STRING
+  mode: NULLABLE
+  description: |
+    Manufacturer of the device where the client is installed.
diff -bur --no-dereference --new-file /tmp/workspace/main-generated-sql/sql/moz-fx-data-shared-prod/fenix_derived/new_profiles_v1/query.sql /tmp/workspace/generated-sql/sql/moz-fx-data-shared-prod/fenix_derived/new_profiles_v1/query.sql
--- /tmp/workspace/main-generated-sql/sql/moz-fx-data-shared-prod/fenix_derived/new_profiles_v1/query.sql	2025-01-15 10:39:24.000000000 +0000
+++ /tmp/workspace/generated-sql/sql/moz-fx-data-shared-prod/fenix_derived/new_profiles_v1/query.sql	2025-01-15 10:48:03.000000000 +0000
@@ -1,4 +1,21 @@
 -- Query generated via `mobile_kpi_support_metrics` SQL generator.
+WITH device_manufacturer_counts AS (
+  SELECT
+    first_seen_date,
+    device_manufacturer,
+    RANK() OVER (PARTITION BY first_seen_date ORDER BY COUNT(*) DESC) AS manufacturer_rank,
+  FROM
+    `moz-fx-data-shared-prod.fenix.new_profile_clients`
+  WHERE
+    {% if is_init() %}
+      first_seen_date < CURRENT_DATE
+    {% else %}
+      first_seen_date = @submission_date
+    {% endif %}
+  GROUP BY
+    first_seen_date,
+    device_manufacturer
+)
 SELECT
   first_seen_date,
   normalized_channel,
@@ -8,7 +25,8 @@
   locale,
   os,
   os_version,
-  device_manufacturer,
+  -- Bucket device manufacturers with low count prior to aggregation
+  IF(manufacturer_rank <= 150, device_manufacturer, "other") AS device_manufacturer,
   is_mobile,
   play_store_attribution_campaign,
   play_store_attribution_medium,
@@ -21,8 +39,12 @@
   adjust_network,
   distribution_id,
   COUNT(*) AS new_profiles,
+  device_type,
 FROM
   `moz-fx-data-shared-prod.fenix.new_profile_clients`
+LEFT JOIN
+  device_manufacturer_counts
+  USING (first_seen_date, device_manufacturer)
 WHERE
   {% if is_init() %}
     first_seen_date < CURRENT_DATE
@@ -38,6 +60,7 @@
   locale,
   os,
   os_version,
+  device_type,
   device_manufacturer,
   is_mobile,
   play_store_attribution_campaign,
diff -bur --no-dereference --new-file /tmp/workspace/main-generated-sql/sql/moz-fx-data-shared-prod/fenix_derived/new_profiles_v1/schema.yaml /tmp/workspace/generated-sql/sql/moz-fx-data-shared-prod/fenix_derived/new_profiles_v1/schema.yaml
--- /tmp/workspace/main-generated-sql/sql/moz-fx-data-shared-prod/fenix_derived/new_profiles_v1/schema.yaml	2025-01-15 10:39:24.000000000 +0000
+++ /tmp/workspace/generated-sql/sql/moz-fx-data-shared-prod/fenix_derived/new_profiles_v1/schema.yaml	2025-01-15 10:48:03.000000000 +0000
@@ -103,3 +103,9 @@
   type: INTEGER
   mode: NULLABLE
   description: Number of new profiles recorded for the first seen date.
+
+- name: device_type
+  type: STRING
+  mode: NULLABLE
+  description: |
+    On Apple devices allows us to differentiate between iPhone and iPad. On Android devices the value is always "Android".
diff -bur --no-dereference --new-file /tmp/workspace/main-generated-sql/sql/moz-fx-data-shared-prod/fenix_derived/retention_v1/query.sql /tmp/workspace/generated-sql/sql/moz-fx-data-shared-prod/fenix_derived/retention_v1/query.sql
--- /tmp/workspace/main-generated-sql/sql/moz-fx-data-shared-prod/fenix_derived/retention_v1/query.sql	2025-01-15 10:39:24.000000000 +0000
+++ /tmp/workspace/generated-sql/sql/moz-fx-data-shared-prod/fenix_derived/retention_v1/query.sql	2025-01-15 10:48:03.000000000 +0000
@@ -1,4 +1,23 @@
 -- Query generated via `mobile_kpi_support_metrics` SQL generator.
+WITH device_manufacturer_counts AS (
+  SELECT
+    submission_date,
+    device_manufacturer,
+    RANK() OVER (PARTITION BY submission_date ORDER BY COUNT(*) DESC) AS manufacturer_rank,
+  FROM
+    `moz-fx-data-shared-prod.fenix.retention_clients`
+  WHERE
+    {% if is_init() %}
+      metric_date < DATE_SUB(CURRENT_DATE, INTERVAL 27 DAY)
+      AND submission_date < CURRENT_DATE
+    {% else %}
+      metric_date = DATE_SUB(@submission_date, INTERVAL 27 DAY)
+      AND submission_date = @submission_date
+    {% endif %}
+  GROUP BY
+    submission_date,
+    device_manufacturer
+)
 SELECT
   metric_date,
   first_seen_date,
@@ -25,8 +44,14 @@
   COUNTIF(retained_week_4_new_profile) AS retained_week_4_new_profiles,
   COUNTIF(new_profile_metric_date) AS new_profiles_metric_date,
   COUNTIF(repeat_profile) AS repeat_profiles,
+  device_type,
+  -- Bucket device manufacturers with low count prior to aggregation
+  IF(manufacturer_rank <= 150, device_manufacturer, "other") AS device_manufacturer,
 FROM
   `moz-fx-data-shared-prod.fenix.retention_clients`
+LEFT JOIN
+  device_manufacturer_counts
+  USING (submission_date, device_manufacturer)
 WHERE
   {% if is_init() %}
     metric_date < DATE_SUB(CURRENT_DATE, INTERVAL 27 DAY)
@@ -43,6 +68,8 @@
   country,
   app_version,
   locale,
+  device_type,
+  device_manufacturer,
   is_mobile,
   play_store_attribution_campaign,
   play_store_attribution_medium,
diff -bur --no-dereference --new-file /tmp/workspace/main-generated-sql/sql/moz-fx-data-shared-prod/fenix_derived/retention_v1/schema.yaml /tmp/workspace/generated-sql/sql/moz-fx-data-shared-prod/fenix_derived/retention_v1/schema.yaml
--- /tmp/workspace/main-generated-sql/sql/moz-fx-data-shared-prod/fenix_derived/retention_v1/schema.yaml	2025-01-15 10:39:24.000000000 +0000
+++ /tmp/workspace/generated-sql/sql/moz-fx-data-shared-prod/fenix_derived/retention_v1/schema.yaml	2025-01-15 10:48:03.000000000 +0000
@@ -123,3 +123,15 @@
   type: INTEGER
   mode: NULLABLE
   description: Number of new profiles on the metric date that were DAU at least twice in the next 28 days.
+
+- name: device_type
+  type: STRING
+  mode: NULLABLE
+  description: |
+    On Apple devices allows us to differentiate between iPhone and iPad. On Android devices the value is always "Android".
+
+- name: device_manufacturer
+  type: STRING
+  mode: NULLABLE
+  description: |
+    Manufacturer of the device where the client is installed.
diff -bur --no-dereference --new-file /tmp/workspace/main-generated-sql/sql/moz-fx-data-shared-prod/firefox_crashreporter_derived/event_monitoring_live_v1/materialized_view.sql /tmp/workspace/generated-sql/sql/moz-fx-data-shared-prod/firefox_crashreporter_derived/event_monitoring_live_v1/materialized_view.sql
--- /tmp/workspace/main-generated-sql/sql/moz-fx-data-shared-prod/firefox_crashreporter_derived/event_monitoring_live_v1/materialized_view.sql	2025-01-15 10:39:23.000000000 +0000
+++ /tmp/workspace/generated-sql/sql/moz-fx-data-shared-prod/firefox_crashreporter_derived/event_monitoring_live_v1/materialized_view.sql	2025-01-15 10:43:05.000000000 +0000
@@ -67,7 +67,7 @@
   LEFT JOIN
     UNNEST(event.extra) AS event_extra
   WHERE
-    DATE(submission_timestamp) >= "2025-01-14"
+    DATE(submission_timestamp) >= "2025-01-15"
   GROUP BY
     submission_date,
     window_start,
diff -bur --no-dereference --new-file /tmp/workspace/main-generated-sql/sql/moz-fx-data-shared-prod/firefox_desktop/ltv_states/schema.yaml /tmp/workspace/generated-sql/sql/moz-fx-data-shared-prod/firefox_desktop/ltv_states/schema.yaml
--- /tmp/workspace/main-generated-sql/sql/moz-fx-data-shared-prod/firefox_desktop/ltv_states/schema.yaml	2025-01-15 10:38:45.000000000 +0000
+++ /tmp/workspace/generated-sql/sql/moz-fx-data-shared-prod/firefox_desktop/ltv_states/schema.yaml	2025-01-15 10:48:37.000000000 +0000
@@ -1,64 +1,66 @@
 fields:
-- description: Unique ID for the client installation.
-  mode: NULLABLE
-  name: client_id
+- name: client_id
   type: STRING
-- description: Sample ID - A number ranging from 0 - 99 based on client ID; used to pull a small sample of data related to a subset of clients over time
   mode: NULLABLE
-  name: sample_id
-  type: INT64
-- description: Submission Date
+  description: Unique ID for the client installation.
+- name: sample_id
+  type: INTEGER
   mode: NULLABLE
-  name: submission_date
+  description: Sample ID - A number ranging from 0 - 99 based on client ID; used to
+    pull a small sample of data related to a subset of clients over time
+- name: submission_date
   type: DATE
-- description: First Seen Date - The date this client was first seen
   mode: NULLABLE
-  name: first_seen_date
+  description: Submission Date
+- name: first_seen_date
   type: DATE
-- description: Days Since First Seen - The number of days since the client was first seen
   mode: NULLABLE
-  name: days_since_first_seen
-  type: INT64
-- description: Days Since Active
+  description: First Seen Date - The date this client was first seen
+- name: days_since_first_seen
+  type: INTEGER
   mode: NULLABLE
-  name: days_since_active
-  type: INT64
-- description: First Reported Country - The country this client ID was first reported from
+  description: Days Since First Seen - The number of days since the client was first
+    seen
+- name: days_since_active
+  type: INTEGER
   mode: NULLABLE
-  name: first_reported_country
+  description: Days Since Active
+- name: first_reported_country
   type: STRING
-- description: Attribution
   mode: NULLABLE
-  name: attribution
+  description: First Reported Country - The country this client ID was first reported
+    from
+- name: attribution
   type: RECORD
+  mode: NULLABLE
   fields:
-  - mode: NULLABLE
-    name: source
+  - name: source
     type: STRING
+    mode: NULLABLE
     description: Attribution Source
-  - mode: NULLABLE
-    name: medium
+  - name: medium
     type: STRING
+    mode: NULLABLE
     description: Attribution Medium
-  - mode: NULLABLE
-    name: campaign
+  - name: campaign
     type: STRING
+    mode: NULLABLE
     description: Attribution Campaign
-  - mode: NULLABLE
-    name: content
+  - name: content
     type: STRING
+    mode: NULLABLE
     description: Attribution Content
-  - mode: NULLABLE
-    name: experiment
+  - name: experiment
     type: STRING
+    mode: NULLABLE
     description: Attribution Experiment
-  - mode: NULLABLE
-    name: variation
+  - name: variation
     type: STRING
+    mode: NULLABLE
     description: Attribution Variation
-  - mode: NULLABLE
-    name: dltoken
+  - name: dltoken
     type: STRING
+    mode: NULLABLE
     description: Attribution Download Token
   - name: dlsource
     type: STRING
@@ -68,40 +70,43 @@
     type: STRING
     mode: NULLABLE
     description: Attribution UA
-- description: Active
-  mode: NULLABLE
-  name: active
-  type: INT64
-- description: Ad Clicks - The number of ad clicks from this client on the submission date
+  description: Attribution
+- name: active
+  type: INTEGER
   mode: NULLABLE
-  name: ad_clicks
-  type: INT64
-- description: Total Historic Ad Clicks - The number of ad clicks from this client on or before the submission date
+  description: Active
+- name: ad_clicks
+  type: INTEGER
   mode: NULLABLE
-  name: total_historic_ad_clicks
-  type: INT64
-- description: Days Seen Bytes
+  description: Ad Clicks - The number of ad clicks from this client on the submission
+    date
+- name: total_historic_ad_clicks
+  type: INTEGER
   mode: NULLABLE
-  name: days_seen_bytes
+  description: Total Historic Ad Clicks - The number of ad clicks from this client
+    on or before the submission date
+- name: days_seen_bytes
   type: BYTES
-- description: Pattern
   mode: NULLABLE
-  name: pattern
+  description: Days Seen Bytes
+- name: pattern
   type: INTEGER
-- description: Death Time
   mode: NULLABLE
-  name: death_time
+  description: Pattern
+- name: death_time
   type: INTEGER
-- description: Max Days
   mode: NULLABLE
-  name: max_days
+  description: Death Time
+- name: max_days
   type: INTEGER
-- description: Markov States
   mode: NULLABLE
-  name: markov_states
+  description: Max Days
+- name: markov_states
   type: RECORD
-  fields:
-  - description: Desktop States V1
     mode: NULLABLE
-    name: desktop_states_v1
+  fields:
+  - name: desktop_states_v1
     type: STRING
+    mode: NULLABLE
+    description: Desktop States V1
+  description: Markov States
diff -bur --no-dereference --new-file /tmp/workspace/main-generated-sql/sql/moz-fx-data-shared-prod/firefox_desktop/newtab_live/schema.yaml /tmp/workspace/generated-sql/sql/moz-fx-data-shared-prod/firefox_desktop/newtab_live/schema.yaml
--- /tmp/workspace/main-generated-sql/sql/moz-fx-data-shared-prod/firefox_desktop/newtab_live/schema.yaml	2025-01-15 10:38:45.000000000 +0000
+++ /tmp/workspace/generated-sql/sql/moz-fx-data-shared-prod/firefox_desktop/newtab_live/schema.yaml	2025-01-15 10:48:44.000000000 +0000
@@ -1,48 +1,47 @@
 fields:
-- description: Submission Timestamp
-  mode: NULLABLE
-  name: submission_timestamp
+- name: submission_timestamp
   type: TIMESTAMP
-- description: Normalized Country Code, Examples - US, AR, BR, etc.
   mode: NULLABLE
-  name: normalized_country_code
+  description: Submission Timestamp
+- name: normalized_country_code
   type: STRING
-- description: Normalized Channel, Examples - release, nightly, aurora, esr, beta
   mode: NULLABLE
-  name: normalized_channel
+  description: Normalized Country Code, Examples - US, AR, BR, etc.
+- name: normalized_channel
   type: STRING
-- description: Document ID
   mode: NULLABLE
-  name: document_id
+  description: Normalized Channel, Examples - release, nightly, aurora, esr, beta
+- name: document_id
   type: STRING
-- description: Pocket Enabled
   mode: NULLABLE
-  name: pocket_enabled
+  description: Document ID
+- name: pocket_enabled
   type: BOOLEAN
-- description: Pocket Sponsored Stories Enabled
   mode: NULLABLE
-  name: pocket_sponsored_stories_enabled
+  description: Pocket Enabled
+- name: pocket_sponsored_stories_enabled
   type: BOOLEAN
-- description: Newtab Locale
   mode: NULLABLE
-  name: newtab_locale
+  description: Pocket Sponsored Stories Enabled
+- name: newtab_locale
   type: STRING
-- description: App Build
   mode: NULLABLE
-  name: app_build
+  description: Newtab Locale
+- name: app_build
   type: STRING
-- description: App Display Version
   mode: NULLABLE
-  name: app_display_version
+  description: App Build
+- name: app_display_version
   type: STRING
-- description: Client ID
   mode: NULLABLE
-  name: client_id
+  description: App Display Version
+- name: client_id
   type: STRING
+  mode: NULLABLE
+  description: Client ID
 - name: events
   type: RECORD
   mode: REPEATED
-  description: Events
   fields:
   - name: category
     type: STRING
@@ -51,7 +50,6 @@
   - name: extra
     type: RECORD
     mode: REPEATED
-    description: Extras
     fields:
     - name: key
       type: STRING
@@ -61,6 +59,7 @@
       type: STRING
       mode: NULLABLE
       description: Value
+    description: Extras
   - name: name
     type: STRING
     mode: NULLABLE
@@ -69,3 +68,4 @@
     type: INTEGER
     mode: NULLABLE
     description: Event Timestamp
+  description: Events
diff -bur --no-dereference --new-file /tmp/workspace/main-generated-sql/sql/moz-fx-data-shared-prod/firefox_desktop_background_defaultagent_derived/event_monitoring_live_v1/materialized_view.sql /tmp/workspace/generated-sql/sql/moz-fx-data-shared-prod/firefox_desktop_background_defaultagent_derived/event_monitoring_live_v1/materialized_view.sql
--- /tmp/workspace/main-generated-sql/sql/moz-fx-data-shared-prod/firefox_desktop_background_defaultagent_derived/event_monitoring_live_v1/materialized_view.sql	2025-01-15 10:39:24.000000000 +0000
+++ /tmp/workspace/generated-sql/sql/moz-fx-data-shared-prod/firefox_desktop_background_defaultagent_derived/event_monitoring_live_v1/materialized_view.sql	2025-01-15 10:43:05.000000000 +0000
@@ -67,7 +67,7 @@
   LEFT JOIN
     UNNEST(event.extra) AS event_extra
   WHERE
-    DATE(submission_timestamp) >= "2025-01-14"
+    DATE(submission_timestamp) >= "2025-01-15"
   GROUP BY
     submission_date,
     window_start,
diff -bur --no-dereference --new-file /tmp/workspace/main-generated-sql/sql/moz-fx-data-shared-prod/firefox_desktop_background_tasks_derived/event_monitoring_live_v1/materialized_view.sql /tmp/workspace/generated-sql/sql/moz-fx-data-shared-prod/firefox_desktop_background_tasks_derived/event_monitoring_live_v1/materialized_view.sql
--- /tmp/workspace/main-generated-sql/sql/moz-fx-data-shared-prod/firefox_desktop_background_tasks_derived/event_monitoring_live_v1/materialized_view.sql	2025-01-15 10:39:23.000000000 +0000
+++ /tmp/workspace/generated-sql/sql/moz-fx-data-shared-prod/firefox_desktop_background_tasks_derived/event_monitoring_live_v1/materialized_view.sql	2025-01-15 10:43:05.000000000 +0000
@@ -77,7 +77,7 @@
   LEFT JOIN
     UNNEST(event.extra) AS event_extra
   WHERE
-    DATE(submission_timestamp) >= "2025-01-14"
+    DATE(submission_timestamp) >= "2025-01-15"
   GROUP BY
     submission_date,
     window_start,
diff -bur --no-dereference --new-file /tmp/workspace/main-generated-sql/sql/moz-fx-data-shared-prod/firefox_desktop_background_update_derived/event_monitoring_live_v1/materialized_view.sql /tmp/workspace/generated-sql/sql/moz-fx-data-shared-prod/firefox_desktop_background_update_derived/event_monitoring_live_v1/materialized_view.sql
--- /tmp/workspace/main-generated-sql/sql/moz-fx-data-shared-prod/firefox_desktop_background_update_derived/event_monitoring_live_v1/materialized_view.sql	2025-01-15 10:39:23.000000000 +0000
+++ /tmp/workspace/generated-sql/sql/moz-fx-data-shared-prod/firefox_desktop_background_update_derived/event_monitoring_live_v1/materialized_view.sql	2025-01-15 10:43:05.000000000 +0000
@@ -67,7 +67,7 @@
   LEFT JOIN
     UNNEST(event.extra) AS event_extra
   WHERE
-    DATE(submission_timestamp) >= "2025-01-14"
+    DATE(submission_timestamp) >= "2025-01-15"
   GROUP BY
     submission_date,
     window_start,
diff -bur --no-dereference --new-file /tmp/workspace/main-generated-sql/sql/moz-fx-data-shared-prod/firefox_desktop_derived/event_monitoring_live_v1/materialized_view.sql /tmp/workspace/generated-sql/sql/moz-fx-data-shared-prod/firefox_desktop_derived/event_monitoring_live_v1/materialized_view.sql
--- /tmp/workspace/main-generated-sql/sql/moz-fx-data-shared-prod/firefox_desktop_derived/event_monitoring_live_v1/materialized_view.sql	2025-01-15 10:39:23.000000000 +0000
+++ /tmp/workspace/generated-sql/sql/moz-fx-data-shared-prod/firefox_desktop_derived/event_monitoring_live_v1/materialized_view.sql	2025-01-15 10:43:05.000000000 +0000
@@ -107,7 +107,7 @@
   LEFT JOIN
     UNNEST(event.extra) AS event_extra
   WHERE
-    DATE(submission_timestamp) >= "2025-01-14"
+    DATE(submission_timestamp) >= "2025-01-15"
   GROUP BY
     submission_date,
     window_start,
diff -bur --no-dereference --new-file /tmp/workspace/main-generated-sql/sql/moz-fx-data-shared-prod/firefox_ios/active_users/schema.yaml /tmp/workspace/generated-sql/sql/moz-fx-data-shared-prod/firefox_ios/active_users/schema.yaml
--- /tmp/workspace/main-generated-sql/sql/moz-fx-data-shared-prod/firefox_ios/active_users/schema.yaml	2025-01-15 10:39:24.000000000 +0000
+++ /tmp/workspace/generated-sql/sql/moz-fx-data-shared-prod/firefox_ios/active_users/schema.yaml	2025-01-15 10:48:36.000000000 +0000
@@ -137,3 +137,6 @@
 - name: isp
   type: STRING
   mode: NULLABLE
+- name: device_type
+  type: STRING
+  mode: NULLABLE
diff -bur --no-dereference --new-file /tmp/workspace/main-generated-sql/sql/moz-fx-data-shared-prod/firefox_ios/active_users/view.sql /tmp/workspace/generated-sql/sql/moz-fx-data-shared-prod/firefox_ios/active_users/view.sql
--- /tmp/workspace/main-generated-sql/sql/moz-fx-data-shared-prod/firefox_ios/active_users/view.sql	2025-01-15 10:39:24.000000000 +0000
+++ /tmp/workspace/generated-sql/sql/moz-fx-data-shared-prod/firefox_ios/active_users/view.sql	2025-01-15 10:48:03.000000000 +0000
@@ -3,7 +3,10 @@
   `moz-fx-data-shared-prod.firefox_ios.active_users`
 AS
 SELECT
-  * EXCEPT (isp),
+  * EXCEPT (isp) REPLACE(
+    -- Lower device_manufacturer as in some cases the same manufacturer value has different casing.
+    LOWER(device_manufacturer) AS device_manufacturer
+  ),
   CASE
     WHEN LOWER(isp) = "browserstack"
       THEN CONCAT("Firefox iOS", " ", isp)
@@ -43,5 +46,16 @@
   -- Adding isp at the end because it's in different column index in baseline table for some products.
   -- This is to make sure downstream union works as intended.
   isp,
+  CASE
+    WHEN normalized_os = "iOS"
+      AND STARTS_WITH(device_model, "iPad")
+      THEN "iPad"
+    WHEN normalized_os = "iOS"
+      AND STARTS_WITH(device_model, "iPhone")
+      THEN "iPhone"
+    WHEN normalized_os = "Android"
+      THEN "Android"
+    ELSE CAST(NULL AS STRING)
+  END AS device_type,
 FROM
   `moz-fx-data-shared-prod.firefox_ios.baseline_clients_last_seen`
diff -bur --no-dereference --new-file /tmp/workspace/main-generated-sql/sql/moz-fx-data-shared-prod/firefox_ios/engagement_clients/schema.yaml /tmp/workspace/generated-sql/sql/moz-fx-data-shared-prod/firefox_ios/engagement_clients/schema.yaml
--- /tmp/workspace/main-generated-sql/sql/moz-fx-data-shared-prod/firefox_ios/engagement_clients/schema.yaml	2025-01-15 10:39:24.000000000 +0000
+++ /tmp/workspace/generated-sql/sql/moz-fx-data-shared-prod/firefox_ios/engagement_clients/schema.yaml	1970-01-01 00:00:00.000000000 +0000
@@ -1,67 +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: first_seen_date
-  type: DATE
-  mode: NULLABLE
-- name: app_name
-  type: STRING
-  mode: NULLABLE
-- name: normalized_channel
-  type: STRING
-  mode: NULLABLE
-- name: app_version
-  type: STRING
-  mode: NULLABLE
-- name: locale
-  type: STRING
-  mode: NULLABLE
-- name: country
-  type: STRING
-  mode: NULLABLE
-- name: isp
-  type: STRING
-  mode: NULLABLE
-- name: is_dau
-  type: BOOLEAN
-  mode: NULLABLE
-- name: is_wau
-  type: BOOLEAN
-  mode: NULLABLE
-- name: is_mau
-  type: BOOLEAN
-  mode: NULLABLE
-- name: is_mobile
-  type: BOOLEAN
-  mode: NULLABLE
-- name: is_suspicious_device_client
-  type: BOOLEAN
-  mode: NULLABLE
-- name: adjust_ad_group
-  type: STRING
-  mode: NULLABLE
-- name: adjust_campaign
-  type: STRING
-  mode: NULLABLE
-- name: adjust_creative
-  type: STRING
-  mode: NULLABLE
-- name: adjust_network
-  type: STRING
-  mode: NULLABLE
-- name: adjust_attribution_timestamp
-  type: TIMESTAMP
-  mode: NULLABLE
-- name: paid_vs_organic
-  type: STRING
-  mode: NULLABLE
-- name: lifecycle_stage
-  type: STRING
-  mode: NULLABLE
diff -bur --no-dereference --new-file /tmp/workspace/main-generated-sql/sql/moz-fx-data-shared-prod/firefox_ios/engagement_clients/view.sql /tmp/workspace/generated-sql/sql/moz-fx-data-shared-prod/firefox_ios/engagement_clients/view.sql
--- /tmp/workspace/main-generated-sql/sql/moz-fx-data-shared-prod/firefox_ios/engagement_clients/view.sql	2025-01-15 10:39:24.000000000 +0000
+++ /tmp/workspace/generated-sql/sql/moz-fx-data-shared-prod/firefox_ios/engagement_clients/view.sql	2025-01-15 10:48:03.000000000 +0000
@@ -18,6 +18,8 @@
     is_wau,
     is_mau,
     is_mobile,
+    device_type,
+    device_manufacturer,
   FROM
     `moz-fx-data-shared-prod.firefox_ios.active_users`
 ),
@@ -68,6 +70,8 @@
       THEN 'existing_user'
     ELSE 'Unknown'
   END AS lifecycle_stage,
+  device_type,
+  device_manufacturer,
 FROM
   active_users
 LEFT JOIN
diff -bur --no-dereference --new-file /tmp/workspace/main-generated-sql/sql/moz-fx-data-shared-prod/firefox_ios/new_profile_clients/schema.yaml /tmp/workspace/generated-sql/sql/moz-fx-data-shared-prod/firefox_ios/new_profile_clients/schema.yaml
--- /tmp/workspace/main-generated-sql/sql/moz-fx-data-shared-prod/firefox_ios/new_profile_clients/schema.yaml	2025-01-15 10:39:24.000000000 +0000
+++ /tmp/workspace/generated-sql/sql/moz-fx-data-shared-prod/firefox_ios/new_profile_clients/schema.yaml	1970-01-01 00:00:00.000000000 +0000
@@ -1,61 +0,0 @@
-fields:
-- name: client_id
-  type: STRING
-  mode: NULLABLE
-- name: first_seen_date
-  type: DATE
-  mode: NULLABLE
-- name: normalized_channel
-  type: STRING
-  mode: NULLABLE
-- name: app_name
-  type: STRING
-  mode: NULLABLE
-- name: app_version
-  type: STRING
-  mode: NULLABLE
-- name: country
-  type: STRING
-  mode: NULLABLE
-- name: locale
-  type: STRING
-  mode: NULLABLE
-- name: isp
-  type: STRING
-  mode: NULLABLE
-- name: os
-  type: STRING
-  mode: NULLABLE
-- name: os_version
-  type: STRING
-  mode: NULLABLE
-- name: device_model
-  type: STRING
-  mode: NULLABLE
-- name: device_manufacturer
-  type: STRING
-  mode: NULLABLE
-- name: is_mobile
-  type: BOOLEAN
-  mode: NULLABLE
-- name: is_suspicious_device_client
-  type: BOOLEAN
-  mode: NULLABLE
-- name: adjust_ad_group
-  type: STRING
-  mode: NULLABLE
-- name: adjust_campaign
-  type: STRING
-  mode: NULLABLE
-- name: adjust_creative
-  type: STRING
-  mode: NULLABLE
-- name: adjust_network
-  type: STRING
-  mode: NULLABLE
-- name: adjust_attribution_timestamp
-  type: TIMESTAMP
-  mode: NULLABLE
-- name: paid_vs_organic
-  type: STRING
-  mode: NULLABLE
diff -bur --no-dereference --new-file /tmp/workspace/main-generated-sql/sql/moz-fx-data-shared-prod/firefox_ios/new_profile_clients/view.sql /tmp/workspace/generated-sql/sql/moz-fx-data-shared-prod/firefox_ios/new_profile_clients/view.sql
--- /tmp/workspace/main-generated-sql/sql/moz-fx-data-shared-prod/firefox_ios/new_profile_clients/view.sql	2025-01-15 10:39:24.000000000 +0000
+++ /tmp/workspace/generated-sql/sql/moz-fx-data-shared-prod/firefox_ios/new_profile_clients/view.sql	2025-01-15 10:48:03.000000000 +0000
@@ -23,6 +23,7 @@
   attribution.adjust_network,
   attribution.adjust_attribution_timestamp,
   attribution.paid_vs_organic,
+  device_type,
 FROM
   `moz-fx-data-shared-prod.firefox_ios.active_users` AS active_users
 LEFT JOIN
diff -bur --no-dereference --new-file /tmp/workspace/main-generated-sql/sql/moz-fx-data-shared-prod/firefox_ios/retention_clients/schema.yaml /tmp/workspace/generated-sql/sql/moz-fx-data-shared-prod/firefox_ios/retention_clients/schema.yaml
--- /tmp/workspace/main-generated-sql/sql/moz-fx-data-shared-prod/firefox_ios/retention_clients/schema.yaml	2025-01-15 10:39:24.000000000 +0000
+++ /tmp/workspace/generated-sql/sql/moz-fx-data-shared-prod/firefox_ios/retention_clients/schema.yaml	1970-01-01 00:00:00.000000000 +0000
@@ -1,88 +0,0 @@
-fields:
-- name: submission_date
-  type: DATE
-  mode: NULLABLE
-- name: metric_date
-  type: DATE
-  mode: NULLABLE
-- name: first_seen_date
-  type: DATE
-  mode: NULLABLE
-- name: client_id
-  type: STRING
-  mode: NULLABLE
-- name: sample_id
-  type: INTEGER
-  mode: NULLABLE
-- name: app_name
-  type: STRING
-  mode: NULLABLE
-- name: normalized_channel
-  type: STRING
-  mode: NULLABLE
-- name: country
-  type: STRING
-  mode: NULLABLE
-- name: app_version
-  type: STRING
-  mode: NULLABLE
-- name: locale
-  type: STRING
-  mode: NULLABLE
-- name: isp
-  type: STRING
-  mode: NULLABLE
-- name: is_mobile
-  type: BOOLEAN
-  mode: NULLABLE
-- name: is_suspicious_device_client
-  type: BOOLEAN
-  mode: NULLABLE
-- name: adjust_ad_group
-  type: STRING
-  mode: NULLABLE
-- name: adjust_campaign
-  type: STRING
-  mode: NULLABLE
-- name: adjust_creative
-  type: STRING
-  mode: NULLABLE
-- name: adjust_network
-  type: STRING
-  mode: NULLABLE
-- name: adjust_attribution_timestamp
-  type: TIMESTAMP
-  mode: NULLABLE
-- name: paid_vs_organic
-  type: STRING
-  mode: NULLABLE
-- name: ping_sent_metric_date
-  type: BOOLEAN
-  mode: NULLABLE
-- name: ping_sent_week_4
-  type: BOOLEAN
-  mode: NULLABLE
-- name: active_metric_date
-  type: BOOLEAN
-  mode: NULLABLE
-- name: retained_week_4
-  type: BOOLEAN
-  mode: NULLABLE
-- name: new_profile_metric_date
-  type: BOOLEAN
-  mode: NULLABLE
-- name: retained_week_4_new_profile
-  type: BOOLEAN
-  mode: NULLABLE
-- name: repeat_profile
-  type: BOOLEAN
-  mode: NULLABLE
-- name: days_seen_bits
-  type: INTEGER
-  mode: NULLABLE
-- name: days_active_bits
-  type: INTEGER
-  mode: NULLABLE
-- name: lifecycle_stage
-  type: STRING
-  mode: NULLABLE
diff -bur --no-dereference --new-file /tmp/workspace/main-generated-sql/sql/moz-fx-data-shared-prod/firefox_ios/retention_clients/view.sql /tmp/workspace/generated-sql/sql/moz-fx-data-shared-prod/firefox_ios/retention_clients/view.sql
--- /tmp/workspace/main-generated-sql/sql/moz-fx-data-shared-prod/firefox_ios/retention_clients/view.sql	2025-01-15 10:39:24.000000000 +0000
+++ /tmp/workspace/generated-sql/sql/moz-fx-data-shared-prod/firefox_ios/retention_clients/view.sql	2025-01-15 10:48:03.000000000 +0000
@@ -14,6 +14,8 @@
     days_seen_bits,
     days_active_bits,
     is_mobile,
+    device_type,
+    device_manufacturer,
   FROM
     `moz-fx-data-shared-prod.firefox_ios.active_users`
 ),
@@ -87,6 +89,8 @@
       THEN 'existing_user'
     ELSE 'Unknown'
   END AS lifecycle_stage,
+  active_users.device_type,
+  active_users.device_manufacturer,
 FROM
   `moz-fx-data-shared-prod.firefox_ios.baseline_clients_daily` AS clients_daily
 INNER JOIN
diff -bur --no-dereference --new-file /tmp/workspace/main-generated-sql/sql/moz-fx-data-shared-prod/firefox_ios/usage_reporting/schema.yaml /tmp/workspace/generated-sql/sql/moz-fx-data-shared-prod/firefox_ios/usage_reporting/schema.yaml
--- /tmp/workspace/main-generated-sql/sql/moz-fx-data-shared-prod/firefox_ios/usage_reporting/schema.yaml	2025-01-15 10:39:24.000000000 +0000
+++ /tmp/workspace/generated-sql/sql/moz-fx-data-shared-prod/firefox_ios/usage_reporting/schema.yaml	2025-01-15 10:48:37.000000000 +0000
@@ -184,6 +184,24 @@
     - name: glean_client_annotation_experimentation_id
       type: STRING
       mode: NULLABLE
+    - name: usage_app_build
+      type: STRING
+      mode: NULLABLE
+    - name: usage_app_channel
+      type: STRING
+      mode: NULLABLE
+    - name: usage_app_display_version
+      type: STRING
+      mode: NULLABLE
+    - name: usage_os
+      type: STRING
+      mode: NULLABLE
+    - name: usage_os_version
+      type: STRING
+      mode: NULLABLE
+    - name: usage_reason
+      type: STRING
+      mode: NULLABLE
   - name: uuid
     type: RECORD
     mode: NULLABLE
@@ -191,6 +209,55 @@
     - name: usage_profile_id
       type: STRING
       mode: NULLABLE
+  - name: datetime
+    type: RECORD
+    mode: NULLABLE
+    fields:
+    - name: usage_first_run_date
+      type: STRING
+      mode: NULLABLE
+  - name: timing_distribution
+    type: RECORD
+    mode: NULLABLE
+    fields:
+    - name: usage_duration
+      type: RECORD
+      mode: NULLABLE
+      fields:
+      - name: bucket_count
+        type: INTEGER
+        mode: NULLABLE
+      - name: count
+        type: INTEGER
+        mode: NULLABLE
+      - name: histogram_type
+        type: STRING
+        mode: NULLABLE
+      - name: overflow
+        type: INTEGER
+        mode: NULLABLE
+      - name: range
+        type: FLOAT
+        mode: REPEATED
+      - name: sum
+        type: INTEGER
+        mode: NULLABLE
+      - name: time_unit
+        type: STRING
+        mode: NULLABLE
+      - name: underflow
+        type: INTEGER
+        mode: NULLABLE
+      - name: values
+        type: RECORD
+        mode: REPEATED
+        fields:
+        - name: key
+          type: STRING
+          mode: NULLABLE
+        - name: value
+          type: INTEGER
+          mode: NULLABLE
 - name: normalized_app_name
   type: STRING
   mode: NULLABLE
diff -bur --no-dereference --new-file /tmp/workspace/main-generated-sql/sql/moz-fx-data-shared-prod/firefox_ios/usage_reporting/view.sql /tmp/workspace/generated-sql/sql/moz-fx-data-shared-prod/firefox_ios/usage_reporting/view.sql
--- /tmp/workspace/main-generated-sql/sql/moz-fx-data-shared-prod/firefox_ios/usage_reporting/view.sql	2025-01-15 10:39:24.000000000 +0000
+++ /tmp/workspace/generated-sql/sql/moz-fx-data-shared-prod/firefox_ios/usage_reporting/view.sql	2025-01-15 10:47:00.000000000 +0000
@@ -16,8 +16,18 @@
       metrics.labeled_counter.glean_error_invalid_state,
       metrics.labeled_counter.glean_error_invalid_value
     ) AS `labeled_counter`,
-    STRUCT(metrics.string.glean_client_annotation_experimentation_id) AS `string`,
-    STRUCT(metrics.uuid.usage_profile_id) AS `uuid`
+    STRUCT(
+      metrics.string.glean_client_annotation_experimentation_id,
+      metrics.string.usage_app_build,
+      metrics.string.usage_app_channel,
+      metrics.string.usage_app_display_version,
+      metrics.string.usage_os,
+      metrics.string.usage_os_version,
+      metrics.string.usage_reason
+    ) AS `string`,
+    STRUCT(metrics.uuid.usage_profile_id) AS `uuid`,
+    STRUCT(metrics.datetime.usage_first_run_date) AS `datetime`,
+    STRUCT(metrics.timing_distribution.usage_duration) AS `timing_distribution`
   ) AS `metrics`,
   normalized_app_name,
   normalized_country_code,
@@ -42,8 +52,18 @@
       metrics.labeled_counter.glean_error_invalid_state,
       metrics.labeled_counter.glean_error_invalid_value
     ) AS `labeled_counter`,
-    STRUCT(metrics.string.glean_client_annotation_experimentation_id) AS `string`,
-    STRUCT(metrics.uuid.usage_profile_id) AS `uuid`
+    STRUCT(
+      metrics.string.glean_client_annotation_experimentation_id,
+      metrics.string.usage_app_build,
+      metrics.string.usage_app_channel,
+      metrics.string.usage_app_display_version,
+      metrics.string.usage_os,
+      metrics.string.usage_os_version,
+      metrics.string.usage_reason
+    ) AS `string`,
+    STRUCT(metrics.uuid.usage_profile_id) AS `uuid`,
+    STRUCT(metrics.datetime.usage_first_run_date) AS `datetime`,
+    STRUCT(metrics.timing_distribution.usage_duration) AS `timing_distribution`
   ) AS `metrics`,
   normalized_app_name,
   normalized_country_code,
@@ -68,8 +88,18 @@
       metrics.labeled_counter.glean_error_invalid_state,
       metrics.labeled_counter.glean_error_invalid_value
     ) AS `labeled_counter`,
-    STRUCT(metrics.string.glean_client_annotation_experimentation_id) AS `string`,
-    STRUCT(metrics.uuid.usage_profile_id) AS `uuid`
+    STRUCT(
+      metrics.string.glean_client_annotation_experimentation_id,
+      metrics.string.usage_app_build,
+      metrics.string.usage_app_channel,
+      metrics.string.usage_app_display_version,
+      metrics.string.usage_os,
+      metrics.string.usage_os_version,
+      metrics.string.usage_reason
+    ) AS `string`,
+    STRUCT(metrics.uuid.usage_profile_id) AS `uuid`,
+    STRUCT(metrics.datetime.usage_first_run_date) AS `datetime`,
+    STRUCT(metrics.timing_distribution.usage_duration) AS `timing_distribution`
   ) AS `metrics`,
   normalized_app_name,
   normalized_country_code,
diff -bur --no-dereference --new-file /tmp/workspace/main-generated-sql/sql/moz-fx-data-shared-prod/firefox_ios_derived/engagement_v1/query.sql /tmp/workspace/generated-sql/sql/moz-fx-data-shared-prod/firefox_ios_derived/engagement_v1/query.sql
--- /tmp/workspace/main-generated-sql/sql/moz-fx-data-shared-prod/firefox_ios_derived/engagement_v1/query.sql	2025-01-15 10:39:23.000000000 +0000
+++ /tmp/workspace/generated-sql/sql/moz-fx-data-shared-prod/firefox_ios_derived/engagement_v1/query.sql	2025-01-15 10:48:03.000000000 +0000
@@ -1,4 +1,21 @@
 -- Query generated via `mobile_kpi_support_metrics` SQL generator.
+WITH device_manufacturer_counts AS (
+  SELECT
+    submission_date,
+    device_manufacturer,
+    RANK() OVER (PARTITION BY submission_date ORDER BY COUNT(*) DESC) AS manufacturer_rank,
+  FROM
+    `moz-fx-data-shared-prod.firefox_ios.engagement_clients`
+  WHERE
+    {% if is_init() %}
+      submission_date < CURRENT_DATE
+    {% else %}
+      submission_date = @submission_date
+    {% endif %}
+  GROUP BY
+    submission_date,
+    device_manufacturer
+)
 SELECT
   submission_date,
   first_seen_date,
@@ -16,8 +33,14 @@
   COUNTIF(is_dau) AS dau,
   COUNTIF(is_wau) AS wau,
   COUNTIF(is_mau) AS mau,
+  device_type,
+  -- Bucket device manufacturers with low count prior to aggregation
+  IF(manufacturer_rank <= 150, device_manufacturer, "other") AS device_manufacturer,
 FROM
   `moz-fx-data-shared-prod.firefox_ios.engagement_clients`
+LEFT JOIN
+  device_manufacturer_counts
+  USING (submission_date, device_manufacturer)
 WHERE
   {% if is_init() %}
     submission_date < CURRENT_DATE
@@ -32,6 +55,8 @@
   app_version,
   country,
   locale,
+  device_type,
+  device_manufacturer,
   is_mobile,
   is_suspicious_device_client,
   adjust_ad_group,
diff -bur --no-dereference --new-file /tmp/workspace/main-generated-sql/sql/moz-fx-data-shared-prod/firefox_ios_derived/engagement_v1/schema.yaml /tmp/workspace/generated-sql/sql/moz-fx-data-shared-prod/firefox_ios_derived/engagement_v1/schema.yaml
--- /tmp/workspace/main-generated-sql/sql/moz-fx-data-shared-prod/firefox_ios_derived/engagement_v1/schema.yaml	2025-01-15 10:39:2

⚠️ Only part of the diff is displayed.

Link to full diff

Please sign in to comment.