DENG-7330 Fix search counts in clients_daily_v6 table (#6888)

This commit is contained in:
Alekhya 2025-01-29 16:24:22 -05:00 коммит произвёл GitHub
Родитель f520e16b6c
Коммит c9dc7961b7
Не найден ключ, соответствующий данной подписи
Идентификатор ключа GPG: B5690EEEBB952194
1 изменённых файлов: 17 добавлений и 7 удалений

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

@ -362,14 +362,24 @@ clients_summary AS (
) AS places_pages_count,
ARRAY(
SELECT AS STRUCT
SUBSTR(_key, 0, pos - 2) AS engine,
SUBSTR(_key, pos) AS source,
`moz-fx-data-shared-prod.udf.extract_histogram_sum`(value) AS `count`
CASE
WHEN REGEXP_CONTAINS(_key, r'\.')
THEN
-- Capture everything (greedily) until the last '.'
-- but do NOT include the '.' or anything after it in the capture
REGEXP_EXTRACT(_key, r'^(.*)\.[^.]+$')
ELSE _key
END AS engine,
CASE
-- Everything after the last period
WHEN REGEXP_CONTAINS(_key, r'\.')
THEN REGEXP_EXTRACT(_key, r'\.([^.]+)$')
ELSE NULL
END AS source,
`moz-fx-data-shared-prod.udf.extract_histogram_sum`(value) AS count
FROM
UNNEST(payload.keyed_histograms.search_counts),
-- Bug 1481671 - probe was briefly implemented with '.' rather than ':'
UNNEST([REPLACE(key, 'in-content.', 'in-content:')]) AS _key,
UNNEST([LENGTH(REGEXP_EXTRACT(_key, '.+?[.].'))]) AS pos
UNNEST(payload.keyed_histograms.search_counts) AS hist,
UNNEST([REPLACE(hist.key, 'in-content.', 'in-content:')]) AS _key
) AS search_counts,
-- A fixed list of fields is selected to maintain compatibility with the udf as fields are added
`moz-fx-data-shared-prod.udf_js.main_summary_active_addons`(