From 11f540986771b54aaf2130e24fb9ca543a5874fd Mon Sep 17 00:00:00 2001 From: Curtis Morales Date: Thu, 12 Sep 2024 16:42:59 -0400 Subject: [PATCH] Don't use submission_month in the init case --- .../desktop_tiles_forecast_inputs_v1/query.sql | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/sql/moz-fx-data-shared-prod/ads_derived/desktop_tiles_forecast_inputs_v1/query.sql b/sql/moz-fx-data-shared-prod/ads_derived/desktop_tiles_forecast_inputs_v1/query.sql index c350a1734e..a1fa5e4e69 100644 --- a/sql/moz-fx-data-shared-prod/ads_derived/desktop_tiles_forecast_inputs_v1/query.sql +++ b/sql/moz-fx-data-shared-prod/ads_derived/desktop_tiles_forecast_inputs_v1/query.sql @@ -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,