DENG-7330 Fix search counts in clients_daily_v6 table (#6888)
This commit is contained in:
Родитель
f520e16b6c
Коммит
c9dc7961b7
|
@ -362,14 +362,24 @@ clients_summary AS (
|
||||||
) AS places_pages_count,
|
) AS places_pages_count,
|
||||||
ARRAY(
|
ARRAY(
|
||||||
SELECT AS STRUCT
|
SELECT AS STRUCT
|
||||||
SUBSTR(_key, 0, pos - 2) AS engine,
|
CASE
|
||||||
SUBSTR(_key, pos) AS source,
|
WHEN REGEXP_CONTAINS(_key, r'\.')
|
||||||
`moz-fx-data-shared-prod.udf.extract_histogram_sum`(value) AS `count`
|
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
|
FROM
|
||||||
UNNEST(payload.keyed_histograms.search_counts),
|
UNNEST(payload.keyed_histograms.search_counts) AS hist,
|
||||||
-- Bug 1481671 - probe was briefly implemented with '.' rather than ':'
|
UNNEST([REPLACE(hist.key, 'in-content.', 'in-content:')]) AS _key
|
||||||
UNNEST([REPLACE(key, 'in-content.', 'in-content:')]) AS _key,
|
|
||||||
UNNEST([LENGTH(REGEXP_EXTRACT(_key, '.+?[.].'))]) AS pos
|
|
||||||
) AS search_counts,
|
) AS search_counts,
|
||||||
-- A fixed list of fields is selected to maintain compatibility with the udf as fields are added
|
-- 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`(
|
`moz-fx-data-shared-prod.udf_js.main_summary_active_addons`(
|
||||||
|
|
Загрузка…
Ссылка в новой задаче