Don't use submission_month in the init case

This commit is contained in:
Curtis Morales 2024-09-12 16:42:59 -04:00
Родитель 7b3c9c6fe0
Коммит 11f5409867
1 изменённых файлов: 6 добавлений и 3 удалений

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

@ -13,11 +13,12 @@ WITH cs_impressions AS (
AND (
{% if is_init() %}
submission_date >= DATE_TRUNC(PARSE_DATE('%Y-%m-%d', '2023-11-01'), MONTH)
AND submission_date < DATE_TRUNC(CURRENT_DATE(), INTERVAL 1 MONTH)
{% else %}
submission_date >= DATE_TRUNC(DATE_SUB(@submission_month, INTERVAL 1 MONTH), MONTH)
AND submission_date < @submission_month
{% endif %}
)
AND submission_date < @submission_month
AND country IN ('US', 'DE', 'FR', 'AU', 'CA', 'IT', 'ES', 'MX', 'BR', 'IN', 'GB', 'JP')
GROUP BY
country_code,
@ -37,11 +38,12 @@ users_table AS (
AND (
{% if is_init() %}
submission_date >= DATE_TRUNC(PARSE_DATE('%Y-%m-%d', '2023-11-01'), MONTH)
AND submission_date < DATE_TRUNC(CURRENT_DATE(), INTERVAL 1 MONTH)
{% else %}
submission_date >= DATE_TRUNC(DATE_SUB(@submission_month, INTERVAL 1 MONTH), MONTH)
AND submission_date < @submission_month
{% endif %}
)
AND submission_date < @submission_month
AND country IN ('US', 'DE', 'FR', 'AU', 'CA', 'IT', 'ES', 'MX', 'BR', 'IN', 'GB', 'JP')
AND normalized_app_name = 'Firefox Desktop'
GROUP BY
@ -68,11 +70,12 @@ nt_visits AS (
AND (
{% if is_init() %}
submission_date >= DATE_TRUNC(PARSE_DATE('%Y-%m-%d', '2023-11-01'), MONTH)
AND submission_date < DATE_TRUNC(CURRENT_DATE(), INTERVAL 1 MONTH)
{% else %}
submission_date >= DATE_TRUNC(DATE_SUB(@submission_month, INTERVAL 1 MONTH), MONTH)
AND submission_date < @submission_month
{% endif %}
)
AND submission_date < @submission_month
AND n.country_code IN ('US', 'DE', 'FR', 'AU', 'CA', 'IT', 'ES', 'MX', 'BR', 'IN', 'GB', 'JP')
GROUP BY
submission_month,