feat: remove fields we do not need for kpi reporting
This commit is contained in:
Родитель
b22f43685d
Коммит
a1956dce7a
|
@ -1,32 +1,19 @@
|
|||
{{ header }}
|
||||
SELECT
|
||||
submission_date,
|
||||
-- client_id,
|
||||
app_name,
|
||||
normalized_channel,
|
||||
EXTRACT(YEAR FROM first_seen_date) AS first_seen_year,
|
||||
submission_date = first_seen_date AS is_new_profile,
|
||||
IFNULL(country, '??') country,
|
||||
city,
|
||||
COALESCE(REGEXP_EXTRACT(locale, r'^(.+?)-'), locale, NULL) AS locale,
|
||||
normalized_os,
|
||||
-- normalized_os_version,
|
||||
COALESCE(
|
||||
SAFE_CAST(NULLIF(SPLIT(normalized_os_version, ".")[SAFE_OFFSET(0)], "") AS INTEGER),
|
||||
0
|
||||
) AS os_version_major,
|
||||
COALESCE(
|
||||
SAFE_CAST(NULLIF(SPLIT(normalized_os_version, ".")[SAFE_OFFSET(1)], "") AS INTEGER),
|
||||
0
|
||||
) AS os_version_minor,
|
||||
COALESCE(
|
||||
SAFE_CAST(NULLIF(SPLIT(normalized_os_version, ".")[SAFE_OFFSET(2)], "") AS INTEGER),
|
||||
0
|
||||
) AS os_version_patch,
|
||||
app_display_version AS app_version,
|
||||
device_model,
|
||||
first_seen_year,
|
||||
is_new_profile,
|
||||
country,
|
||||
locale,
|
||||
-- normalized_os,
|
||||
os_version_major,
|
||||
os_version_minor,
|
||||
os_version_patch,
|
||||
app_version,
|
||||
distribution_id,
|
||||
activity_segment AS segment,
|
||||
segment,
|
||||
COUNTIF(is_daily_user) AS daily_users,
|
||||
COUNTIF(is_weekly_user) AS weekly_users,
|
||||
COUNTIF(is_monthly_user) AS monthly_users,
|
||||
|
@ -46,13 +33,10 @@ GROUP BY
|
|||
first_seen_year,
|
||||
is_new_profile,
|
||||
country,
|
||||
city,
|
||||
locale,
|
||||
normalized_os,
|
||||
os_version_major,
|
||||
os_version_minor,
|
||||
os_version_patch,
|
||||
app_version,
|
||||
device_model,
|
||||
distribution_id,
|
||||
segment
|
||||
|
|
|
@ -3,7 +3,11 @@ CREATE OR REPLACE VIEW
|
|||
`{{ project_id }}.{{ dataset }}.{{ name }}`
|
||||
AS
|
||||
SELECT
|
||||
* EXCEPT (isp),
|
||||
* EXCEPT (isp, normalized_os_version, app_display_version)
|
||||
REPLACE(
|
||||
COALESCE(REGEXP_EXTRACT(locale, r'^(.+?)-'), locale, NULL) AS locale,
|
||||
IFNULL(country, '??') AS country
|
||||
),
|
||||
CASE
|
||||
WHEN LOWER(isp) = "browserstack"
|
||||
THEN CONCAT("{{ friendly_name }}", " ", isp)
|
||||
|
@ -28,7 +32,22 @@ SELECT
|
|||
WHEN BIT_COUNT(days_active_bits) >= 21
|
||||
THEN "core_user"
|
||||
ELSE "other"
|
||||
END AS activity_segment,
|
||||
END AS segment,
|
||||
COALESCE(
|
||||
SAFE_CAST(NULLIF(SPLIT(normalized_os_version, ".")[SAFE_OFFSET(0)], "") AS INTEGER),
|
||||
0
|
||||
) AS os_version_major,
|
||||
COALESCE(
|
||||
SAFE_CAST(NULLIF(SPLIT(normalized_os_version, ".")[SAFE_OFFSET(1)], "") AS INTEGER),
|
||||
0
|
||||
) AS os_version_minor,
|
||||
COALESCE(
|
||||
SAFE_CAST(NULLIF(SPLIT(normalized_os_version, ".")[SAFE_OFFSET(2)], "") AS INTEGER),
|
||||
0
|
||||
) AS os_version_patch,
|
||||
app_display_version AS app_version,
|
||||
EXTRACT(YEAR FROM first_seen_date) AS first_seen_year,
|
||||
submission_date = first_seen_date AS is_new_profile,
|
||||
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,
|
||||
|
|
Загрузка…
Ссылка в новой задаче