DENG-2975 active_users (#5478)
This commit is contained in:
Родитель
431ec68319
Коммит
22f53bc78b
|
@ -0,0 +1,38 @@
|
|||
CREATE OR REPLACE VIEW
|
||||
`moz-fx-data-shared-prod.telemetry.active_users`
|
||||
AS
|
||||
SELECT
|
||||
submission_date,
|
||||
client_id,
|
||||
sample_id,
|
||||
app_name,
|
||||
days_seen_bits,
|
||||
days_active_bits,
|
||||
is_dau,
|
||||
is_wau,
|
||||
is_mau,
|
||||
is_daily_user,
|
||||
is_weekly_user,
|
||||
is_monthly_user,
|
||||
is_desktop,
|
||||
FALSE AS is_mobile
|
||||
FROM
|
||||
`moz-fx-data-shared-prod.telemetry.desktop_active_users`
|
||||
UNION ALL
|
||||
SELECT
|
||||
submission_date,
|
||||
client_id,
|
||||
sample_id,
|
||||
app_name,
|
||||
days_seen_bits,
|
||||
days_active_bits,
|
||||
is_dau,
|
||||
is_wau,
|
||||
is_mau,
|
||||
is_daily_user,
|
||||
is_weekly_user,
|
||||
is_monthly_user,
|
||||
FALSE AS is_desktop,
|
||||
is_mobile
|
||||
FROM
|
||||
`moz-fx-data-shared-prod.telemetry.mobile_active_users`
|
|
@ -23,26 +23,7 @@ WITH days_since AS (
|
|||
mozfun.bits28.days_since_seen(
|
||||
days_visited_1_uri_private_mode_bits
|
||||
) AS days_since_visited_1_uri_private_mode,
|
||||
cls.* EXCEPT (app_name),
|
||||
CASE
|
||||
WHEN cls.isp_name = 'BrowserStack'
|
||||
THEN CONCAT(cls.app_name, ' ', cls.isp_name)
|
||||
WHEN distribution_id = 'MozillaOnline'
|
||||
THEN CONCAT(cls.app_name, ' ', cls.distribution_id)
|
||||
ELSE cls.app_name
|
||||
END AS app_name,
|
||||
IFNULL(mozfun.bits28.days_since_seen(cls.days_active_bits) = 0, FALSE) AS is_dau,
|
||||
IFNULL(mozfun.bits28.days_since_seen(cls.days_active_bits) < 7, FALSE) AS is_wau,
|
||||
IFNULL(mozfun.bits28.days_since_seen(cls.days_active_bits) < 28, FALSE) AS is_mau,
|
||||
IFNULL(mozfun.bits28.days_since_seen(cls.days_seen_bits) = 0, FALSE) AS is_daily_user,
|
||||
IFNULL(mozfun.bits28.days_since_seen(cls.days_seen_bits) < 7, FALSE) AS is_weekly_user,
|
||||
IFNULL(mozfun.bits28.days_since_seen(cls.days_seen_bits) < 28, FALSE) AS is_monthly_user,
|
||||
IF(
|
||||
LOWER(IFNULL(cls.isp_name, '')) <> "browserstack"
|
||||
AND LOWER(IFNULL(cls.distribution_id, '')) <> "mozillaonline",
|
||||
TRUE,
|
||||
FALSE
|
||||
) AS is_desktop
|
||||
cls.*
|
||||
FROM
|
||||
`moz-fx-data-shared-prod.telemetry_derived.clients_last_seen_v2` cls
|
||||
)
|
||||
|
|
|
@ -0,0 +1,30 @@
|
|||
CREATE OR REPLACE VIEW
|
||||
`moz-fx-data-shared-prod.telemetry.desktop_active_users`
|
||||
AS
|
||||
SELECT
|
||||
submission_date,
|
||||
client_id,
|
||||
sample_id,
|
||||
days_seen_bits,
|
||||
days_active_bits,
|
||||
CASE
|
||||
WHEN isp_name = 'BrowserStack'
|
||||
THEN CONCAT(app_name, ' ', isp_name)
|
||||
WHEN distribution_id = 'MozillaOnline'
|
||||
THEN CONCAT(app_name, ' ', distribution_id)
|
||||
ELSE app_name
|
||||
END AS app_name,
|
||||
IFNULL(mozfun.bits28.days_since_seen(days_active_bits) = 0, FALSE) AS is_dau,
|
||||
IFNULL(mozfun.bits28.days_since_seen(days_active_bits) < 7, FALSE) AS is_wau,
|
||||
IFNULL(mozfun.bits28.days_since_seen(days_active_bits) < 28, FALSE) AS is_mau,
|
||||
IFNULL(mozfun.bits28.days_since_seen(days_seen_bits) = 0, FALSE) AS is_daily_user,
|
||||
IFNULL(mozfun.bits28.days_since_seen(days_seen_bits) < 7, FALSE) AS is_weekly_user,
|
||||
IFNULL(mozfun.bits28.days_since_seen(days_seen_bits) < 28, FALSE) AS is_monthly_user,
|
||||
IF(
|
||||
LOWER(IFNULL(isp_name, '')) <> "browserstack"
|
||||
AND LOWER(IFNULL(distribution_id, '')) <> "mozillaonline",
|
||||
TRUE,
|
||||
FALSE
|
||||
) AS is_desktop
|
||||
FROM
|
||||
`moz-fx-data-shared-prod.telemetry_derived.clients_last_seen_v2`
|
|
@ -22,13 +22,17 @@ SELECT
|
|||
) AS normalized_os_version,
|
||||
cls.startup_profile_selection_reason_first AS startup_profile_selection_reason,
|
||||
cls.country,
|
||||
cls.is_dau,
|
||||
cls.is_wau,
|
||||
cls.is_mau
|
||||
aud.is_dau,
|
||||
aud.is_wau,
|
||||
aud.is_mau
|
||||
FROM
|
||||
`moz-fx-data-shared-prod.telemetry.clients_last_seen_v2` cls
|
||||
LEFT JOIN
|
||||
`moz-fx-data-shared-prod.telemetry.clients_first_seen` cfs
|
||||
ON cls.client_id = cfs.client_id
|
||||
LEFT JOIN
|
||||
`moz-fx-data-shared-prod.telemetry.desktop_active_users` aud
|
||||
ON cls.client_id = aud.client_id
|
||||
AND cls.submission_date = aud.submission_date
|
||||
WHERE
|
||||
cls.submission_date = @submission_date
|
||||
|
|
Загрузка…
Ссылка в новой задаче