DENG-2095 Fix accounts_backend.users_services_daily_v1 (#5124)

This commit is contained in:
akkomar 2024-02-28 12:36:50 +01:00 коммит произвёл GitHub
Родитель bde2c50acd
Коммит c3fe99cb10
Не найден ключ, соответствующий данной подписи
Идентификатор ключа GPG: B5690EEEBB952194
3 изменённых файлов: 2 добавлений и 28 удалений

Просмотреть файл

@ -56,13 +56,10 @@ windowed AS (
udf.mode_last(ARRAY_AGG(country) OVER w1) AS country,
udf_contains_tier1_country(ARRAY_AGG(country) OVER w1) AS seen_in_tier1_country,
LOGICAL_OR(event_name = 'reg_complete') OVER w1 AS registered,
ARRAY_AGG(event_name) OVER w1 AS service_events,
FROM
fxa_events
WHERE
DATE(submission_timestamp) = @submission_date
AND user_id_sha256 != ''
AND service != ''
QUALIFY
ROW_NUMBER() OVER (
PARTITION BY
@ -88,16 +85,9 @@ windowed AS (
SELECT
DATE(@submission_date) AS submission_date,
windowed.user_id_sha256,
oa.name AS service,
windowed.service,
windowed.country,
windowed.seen_in_tier1_country,
windowed.registered,
windowed.service_events,
FROM
windowed
JOIN
`accounts_db.fxa_oauth_clients` AS oa
ON windowed.service = oa.id
WHERE
user_id_sha256 IS NOT NULL
AND service IS NOT NULL

Просмотреть файл

@ -17,6 +17,3 @@ fields:
- name: registered
type: BOOLEAN
mode: NULLABLE
- name: service_events
type: STRING
mode: REPEATED

Просмотреть файл

@ -1,18 +1,6 @@
CREATE TEMP FUNCTION contains_qualified_fxa_activity_event(events ANY TYPE) AS (
EXISTS(
SELECT
event_type
FROM
UNNEST(events) AS event_type
WHERE
event_type IN ('login_complete', 'reg_complete')
OR (event_type LIKE r'access\_token%')
)
);
WITH _current AS (
SELECT
* EXCEPT (submission_date, registered, seen_in_tier1_country, service_events),
* EXCEPT (submission_date, registered, seen_in_tier1_country),
-- In this raw table, we capture the history of activity over the past
-- 28 days for each usage criterion as a single 64-bit integer. The
-- rightmost bit represents whether the user was active in the current day.
@ -27,7 +15,6 @@ WITH _current AS (
accounts_backend_derived.users_services_daily_v1
WHERE
submission_date = @submission_date
AND contains_qualified_fxa_activity_event(service_events)
),
_previous AS (
SELECT