Escape underscores in `LIKE` patterns.

In `LIKE` patterns unescaped underscores will match any single character.
This commit is contained in:
Sean Rose 2024-01-10 15:22:06 -08:00
Родитель 7c6f593357
Коммит e7f5ac0035
Не найден ключ, соответствующий данной подписи
Идентификатор ключа GPG: 45767F2044BD75C3
5 изменённых файлов: 8 добавлений и 8 удалений

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

@ -7,7 +7,7 @@ view: surveys {
`moz-fx-data-shared-prod.telemetry.heartbeat`
WHERE
date(submission_timestamp) >= '2021-05-18' -- change this to real release date
and SPLIT(payload.survey_id, '::')[OFFSET(0)] like '%visual_perception_89%'
and SPLIT(payload.survey_id, '::')[OFFSET(0)] like r'%visual\_perception\_89%'
and normalized_channel = 'release'
;;
}

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

@ -24,7 +24,7 @@ view: ctd_uac {
submission_date >= '2023-06-26'
AND first_seen_date >= '2023-06-27' --and "2023-07-31"
AND adjust_network = 'Google Ads ACI'
AND adjust_campaign like "%Mozilla_FF_UAC_EU_DE_DE_AllGroups_Event7%"
AND adjust_campaign like r"%Mozilla\_FF\_UAC\_EU\_DE\_DE\_AllGroups\_Event7%"
--AND adjust_adgroup <> "DE Ad Group (150957842358)"
GROUP BY 1, 2 order by 1
)

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

@ -27,7 +27,7 @@ view: google_uac_android_activation {
submission_date >= '2022-12-01'
AND first_seen_date >= '2022-12-01'
AND adjust_network = 'Google Ads ACI'
AND adjust_campaign LIKE 'Mozilla_%'
AND adjust_campaign LIKE r'Mozilla\_%'
GROUP BY
date,
campaign,
@ -37,7 +37,7 @@ view: google_uac_android_activation {
date,
campaign,
ad_group,
CASE WHEN campaign LIKE '%_US_%' OR campaign LIKE '%_CA_%' OR campaign LIKE '%NA%' THEN 'NA'
CASE WHEN campaign LIKE r'%\_US\_%' OR campaign LIKE r'%\_CA\_%' OR campaign LIKE '%NA%' THEN 'NA'
WHEN campaign LIKE '%MGFQ3%' THEN 'Expansion'
ELSE 'EU' END AS region,
REGEXP_EXTRACT(campaign, '.*(Event\\d).*') as event,

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

@ -11,7 +11,7 @@ view: fxa_multi_service_dau {
FROM
`mozdata.firefox_accounts.fxa_all_events`
WHERE service IN ('sync', 'mdn-plus', 'guardian-vpn', 'fx-monitor', 'fx-private-relay', 'pocket-web', 'amo-web', 'thunderbird-addons', 'mozilla-iam', 'moz-social', 'mozilla-support', 'pontoon', 'mozilla-hubs-dev')
AND event_type like 'fxa_activity%'
AND event_type like r'fxa\_activity%'
GROUP BY
1, 2
HAVING ARRAY_LENGTH(services) > 1;;

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

@ -5,13 +5,13 @@ view: fx_view_customization {
clients AS (
SELECT
client_id,
MAX(CASE WHEN c.key LIKE 'firefox-view-button_remove%' THEN submission_timestamp END) AS latest_remove,
MAX(CASE WHEN c.key LIKE 'firefox-view-button_add%' THEN submission_timestamp END) AS latest_add,
MAX(CASE WHEN c.key LIKE r'firefox-view-button\_remove%' THEN submission_timestamp END) AS latest_remove,
MAX(CASE WHEN c.key LIKE r'firefox-view-button\_add%' THEN submission_timestamp END) AS latest_add,
FROM telemetry.main_1pct
CROSS JOIN UNNEST(payload.processes.parent.keyed_scalars.browser_ui_customized_widgets) c
WHERE DATE(submission_timestamp) >= DATE(2022, 9, 20)
AND ARRAY_LENGTH(payload.processes.parent.keyed_scalars.browser_ui_customized_widgets) != 0
AND (c.key LIKE 'firefox-view-button_remove%' OR c.key LIKE 'firefox-view-button_add%')
AND (c.key LIKE r'firefox-view-button\_remove%' OR c.key LIKE r'firefox-view-button\_add%')
AND SAFE_CAST(SUBSTR(application.display_version, 1, 3) AS float64) >= 106
GROUP BY 1
)