diff --git a/tests_metricflow/snapshots/test_conversion_metric_rendering.py/SqlQueryPlan/BigQuery/test_conversion_metric__plan0.sql b/tests_metricflow/snapshots/test_conversion_metric_rendering.py/SqlQueryPlan/BigQuery/test_conversion_metric__plan0.sql index f8475d5545..3d2de6a9dd 100644 --- a/tests_metricflow/snapshots/test_conversion_metric_rendering.py/SqlQueryPlan/BigQuery/test_conversion_metric__plan0.sql +++ b/tests_metricflow/snapshots/test_conversion_metric_rendering.py/SqlQueryPlan/BigQuery/test_conversion_metric__plan0.sql @@ -72,11 +72,11 @@ FROM ( SELECT 1 AS visits , visits_source_src_28000.user_id AS visitors - , DATE_TRUNC(visits_source_src_28000.ds, day) AS ds__day - , DATE_TRUNC(visits_source_src_28000.ds, isoweek) AS ds__week - , DATE_TRUNC(visits_source_src_28000.ds, month) AS ds__month - , DATE_TRUNC(visits_source_src_28000.ds, quarter) AS ds__quarter - , DATE_TRUNC(visits_source_src_28000.ds, year) AS ds__year + , DATETIME_TRUNC(visits_source_src_28000.ds, day) AS ds__day + , DATETIME_TRUNC(visits_source_src_28000.ds, isoweek) AS ds__week + , DATETIME_TRUNC(visits_source_src_28000.ds, month) AS ds__month + , DATETIME_TRUNC(visits_source_src_28000.ds, quarter) AS ds__quarter + , DATETIME_TRUNC(visits_source_src_28000.ds, year) AS ds__year , EXTRACT(year FROM visits_source_src_28000.ds) AS ds__extract_year , EXTRACT(quarter FROM visits_source_src_28000.ds) AS ds__extract_quarter , EXTRACT(month FROM visits_source_src_28000.ds) AS ds__extract_month @@ -84,11 +84,11 @@ FROM ( , IF(EXTRACT(dayofweek FROM visits_source_src_28000.ds) = 1, 7, EXTRACT(dayofweek FROM visits_source_src_28000.ds) - 1) AS ds__extract_dow , EXTRACT(dayofyear FROM visits_source_src_28000.ds) AS ds__extract_doy , visits_source_src_28000.referrer_id - , DATE_TRUNC(visits_source_src_28000.ds, day) AS visit__ds__day - , DATE_TRUNC(visits_source_src_28000.ds, isoweek) AS visit__ds__week - , DATE_TRUNC(visits_source_src_28000.ds, month) AS visit__ds__month - , DATE_TRUNC(visits_source_src_28000.ds, quarter) AS visit__ds__quarter - , DATE_TRUNC(visits_source_src_28000.ds, year) AS visit__ds__year + , DATETIME_TRUNC(visits_source_src_28000.ds, day) AS visit__ds__day + , DATETIME_TRUNC(visits_source_src_28000.ds, isoweek) AS visit__ds__week + , DATETIME_TRUNC(visits_source_src_28000.ds, month) AS visit__ds__month + , DATETIME_TRUNC(visits_source_src_28000.ds, quarter) AS visit__ds__quarter + , DATETIME_TRUNC(visits_source_src_28000.ds, year) AS visit__ds__year , EXTRACT(year FROM visits_source_src_28000.ds) AS visit__ds__extract_year , EXTRACT(quarter FROM visits_source_src_28000.ds) AS visit__ds__extract_quarter , EXTRACT(month FROM visits_source_src_28000.ds) AS visit__ds__extract_month @@ -220,11 +220,11 @@ FROM ( SELECT 1 AS visits , visits_source_src_28000.user_id AS visitors - , DATE_TRUNC(visits_source_src_28000.ds, day) AS ds__day - , DATE_TRUNC(visits_source_src_28000.ds, isoweek) AS ds__week - , DATE_TRUNC(visits_source_src_28000.ds, month) AS ds__month - , DATE_TRUNC(visits_source_src_28000.ds, quarter) AS ds__quarter - , DATE_TRUNC(visits_source_src_28000.ds, year) AS ds__year + , DATETIME_TRUNC(visits_source_src_28000.ds, day) AS ds__day + , DATETIME_TRUNC(visits_source_src_28000.ds, isoweek) AS ds__week + , DATETIME_TRUNC(visits_source_src_28000.ds, month) AS ds__month + , DATETIME_TRUNC(visits_source_src_28000.ds, quarter) AS ds__quarter + , DATETIME_TRUNC(visits_source_src_28000.ds, year) AS ds__year , EXTRACT(year FROM visits_source_src_28000.ds) AS ds__extract_year , EXTRACT(quarter FROM visits_source_src_28000.ds) AS ds__extract_quarter , EXTRACT(month FROM visits_source_src_28000.ds) AS ds__extract_month @@ -232,11 +232,11 @@ FROM ( , IF(EXTRACT(dayofweek FROM visits_source_src_28000.ds) = 1, 7, EXTRACT(dayofweek FROM visits_source_src_28000.ds) - 1) AS ds__extract_dow , EXTRACT(dayofyear FROM visits_source_src_28000.ds) AS ds__extract_doy , visits_source_src_28000.referrer_id - , DATE_TRUNC(visits_source_src_28000.ds, day) AS visit__ds__day - , DATE_TRUNC(visits_source_src_28000.ds, isoweek) AS visit__ds__week - , DATE_TRUNC(visits_source_src_28000.ds, month) AS visit__ds__month - , DATE_TRUNC(visits_source_src_28000.ds, quarter) AS visit__ds__quarter - , DATE_TRUNC(visits_source_src_28000.ds, year) AS visit__ds__year + , DATETIME_TRUNC(visits_source_src_28000.ds, day) AS visit__ds__day + , DATETIME_TRUNC(visits_source_src_28000.ds, isoweek) AS visit__ds__week + , DATETIME_TRUNC(visits_source_src_28000.ds, month) AS visit__ds__month + , DATETIME_TRUNC(visits_source_src_28000.ds, quarter) AS visit__ds__quarter + , DATETIME_TRUNC(visits_source_src_28000.ds, year) AS visit__ds__year , EXTRACT(year FROM visits_source_src_28000.ds) AS visit__ds__extract_year , EXTRACT(quarter FROM visits_source_src_28000.ds) AS visit__ds__extract_quarter , EXTRACT(month FROM visits_source_src_28000.ds) AS visit__ds__extract_month @@ -342,22 +342,22 @@ FROM ( SELECT 1 AS buys , buys_source_src_28000.user_id AS buyers - , DATE_TRUNC(buys_source_src_28000.ds, day) AS ds__day - , DATE_TRUNC(buys_source_src_28000.ds, isoweek) AS ds__week - , DATE_TRUNC(buys_source_src_28000.ds, month) AS ds__month - , DATE_TRUNC(buys_source_src_28000.ds, quarter) AS ds__quarter - , DATE_TRUNC(buys_source_src_28000.ds, year) AS ds__year + , DATETIME_TRUNC(buys_source_src_28000.ds, day) AS ds__day + , DATETIME_TRUNC(buys_source_src_28000.ds, isoweek) AS ds__week + , DATETIME_TRUNC(buys_source_src_28000.ds, month) AS ds__month + , DATETIME_TRUNC(buys_source_src_28000.ds, quarter) AS ds__quarter + , DATETIME_TRUNC(buys_source_src_28000.ds, year) AS ds__year , EXTRACT(year FROM buys_source_src_28000.ds) AS ds__extract_year , EXTRACT(quarter FROM buys_source_src_28000.ds) AS ds__extract_quarter , EXTRACT(month FROM buys_source_src_28000.ds) AS ds__extract_month , EXTRACT(day FROM buys_source_src_28000.ds) AS ds__extract_day , IF(EXTRACT(dayofweek FROM buys_source_src_28000.ds) = 1, 7, EXTRACT(dayofweek FROM buys_source_src_28000.ds) - 1) AS ds__extract_dow , EXTRACT(dayofyear FROM buys_source_src_28000.ds) AS ds__extract_doy - , DATE_TRUNC(buys_source_src_28000.ds, day) AS buy__ds__day - , DATE_TRUNC(buys_source_src_28000.ds, isoweek) AS buy__ds__week - , DATE_TRUNC(buys_source_src_28000.ds, month) AS buy__ds__month - , DATE_TRUNC(buys_source_src_28000.ds, quarter) AS buy__ds__quarter - , DATE_TRUNC(buys_source_src_28000.ds, year) AS buy__ds__year + , DATETIME_TRUNC(buys_source_src_28000.ds, day) AS buy__ds__day + , DATETIME_TRUNC(buys_source_src_28000.ds, isoweek) AS buy__ds__week + , DATETIME_TRUNC(buys_source_src_28000.ds, month) AS buy__ds__month + , DATETIME_TRUNC(buys_source_src_28000.ds, quarter) AS buy__ds__quarter + , DATETIME_TRUNC(buys_source_src_28000.ds, year) AS buy__ds__year , EXTRACT(year FROM buys_source_src_28000.ds) AS buy__ds__extract_year , EXTRACT(quarter FROM buys_source_src_28000.ds) AS buy__ds__extract_quarter , EXTRACT(month FROM buys_source_src_28000.ds) AS buy__ds__extract_month diff --git a/tests_metricflow/snapshots/test_conversion_metric_rendering.py/SqlQueryPlan/BigQuery/test_conversion_metric__plan0_optimized.sql b/tests_metricflow/snapshots/test_conversion_metric_rendering.py/SqlQueryPlan/BigQuery/test_conversion_metric__plan0_optimized.sql index a079495eec..8cf7b74bb6 100644 --- a/tests_metricflow/snapshots/test_conversion_metric_rendering.py/SqlQueryPlan/BigQuery/test_conversion_metric__plan0_optimized.sql +++ b/tests_metricflow/snapshots/test_conversion_metric_rendering.py/SqlQueryPlan/BigQuery/test_conversion_metric__plan0_optimized.sql @@ -19,7 +19,7 @@ FROM ( -- Metric Time Dimension 'ds' -- Pass Only Elements: ['visits', 'metric_time__day'] SELECT - DATE_TRUNC(ds, day) AS metric_time__day + DATETIME_TRUNC(ds, day) AS metric_time__day , 1 AS visits FROM ***************************.fct_visits visits_source_src_28000 ) subq_18 @@ -76,8 +76,8 @@ FROM ( -- Metric Time Dimension 'ds' -- Pass Only Elements: ['visits', 'ds__day', 'metric_time__day', 'user'] SELECT - DATE_TRUNC(ds, day) AS ds__day - , DATE_TRUNC(ds, day) AS metric_time__day + DATETIME_TRUNC(ds, day) AS ds__day + , DATETIME_TRUNC(ds, day) AS metric_time__day , user_id AS user , 1 AS visits FROM ***************************.fct_visits visits_source_src_28000 @@ -87,7 +87,7 @@ FROM ( -- Metric Time Dimension 'ds' -- Add column with generated UUID SELECT - DATE_TRUNC(ds, day) AS ds__day + DATETIME_TRUNC(ds, day) AS ds__day , user_id AS user , 1 AS buys , GENERATE_UUID() AS mf_internal_uuid diff --git a/tests_metricflow/snapshots/test_conversion_metric_rendering.py/SqlQueryPlan/BigQuery/test_conversion_metric_with_categorical_filter__plan0.sql b/tests_metricflow/snapshots/test_conversion_metric_rendering.py/SqlQueryPlan/BigQuery/test_conversion_metric_with_categorical_filter__plan0.sql index fea6c7b2fb..fa20a4890f 100644 --- a/tests_metricflow/snapshots/test_conversion_metric_rendering.py/SqlQueryPlan/BigQuery/test_conversion_metric_with_categorical_filter__plan0.sql +++ b/tests_metricflow/snapshots/test_conversion_metric_rendering.py/SqlQueryPlan/BigQuery/test_conversion_metric_with_categorical_filter__plan0.sql @@ -77,11 +77,11 @@ FROM ( SELECT 1 AS visits , visits_source_src_28000.user_id AS visitors - , DATE_TRUNC(visits_source_src_28000.ds, day) AS ds__day - , DATE_TRUNC(visits_source_src_28000.ds, isoweek) AS ds__week - , DATE_TRUNC(visits_source_src_28000.ds, month) AS ds__month - , DATE_TRUNC(visits_source_src_28000.ds, quarter) AS ds__quarter - , DATE_TRUNC(visits_source_src_28000.ds, year) AS ds__year + , DATETIME_TRUNC(visits_source_src_28000.ds, day) AS ds__day + , DATETIME_TRUNC(visits_source_src_28000.ds, isoweek) AS ds__week + , DATETIME_TRUNC(visits_source_src_28000.ds, month) AS ds__month + , DATETIME_TRUNC(visits_source_src_28000.ds, quarter) AS ds__quarter + , DATETIME_TRUNC(visits_source_src_28000.ds, year) AS ds__year , EXTRACT(year FROM visits_source_src_28000.ds) AS ds__extract_year , EXTRACT(quarter FROM visits_source_src_28000.ds) AS ds__extract_quarter , EXTRACT(month FROM visits_source_src_28000.ds) AS ds__extract_month @@ -89,11 +89,11 @@ FROM ( , IF(EXTRACT(dayofweek FROM visits_source_src_28000.ds) = 1, 7, EXTRACT(dayofweek FROM visits_source_src_28000.ds) - 1) AS ds__extract_dow , EXTRACT(dayofyear FROM visits_source_src_28000.ds) AS ds__extract_doy , visits_source_src_28000.referrer_id - , DATE_TRUNC(visits_source_src_28000.ds, day) AS visit__ds__day - , DATE_TRUNC(visits_source_src_28000.ds, isoweek) AS visit__ds__week - , DATE_TRUNC(visits_source_src_28000.ds, month) AS visit__ds__month - , DATE_TRUNC(visits_source_src_28000.ds, quarter) AS visit__ds__quarter - , DATE_TRUNC(visits_source_src_28000.ds, year) AS visit__ds__year + , DATETIME_TRUNC(visits_source_src_28000.ds, day) AS visit__ds__day + , DATETIME_TRUNC(visits_source_src_28000.ds, isoweek) AS visit__ds__week + , DATETIME_TRUNC(visits_source_src_28000.ds, month) AS visit__ds__month + , DATETIME_TRUNC(visits_source_src_28000.ds, quarter) AS visit__ds__quarter + , DATETIME_TRUNC(visits_source_src_28000.ds, year) AS visit__ds__year , EXTRACT(year FROM visits_source_src_28000.ds) AS visit__ds__extract_year , EXTRACT(quarter FROM visits_source_src_28000.ds) AS visit__ds__extract_quarter , EXTRACT(month FROM visits_source_src_28000.ds) AS visit__ds__extract_month @@ -238,11 +238,11 @@ FROM ( SELECT 1 AS visits , visits_source_src_28000.user_id AS visitors - , DATE_TRUNC(visits_source_src_28000.ds, day) AS ds__day - , DATE_TRUNC(visits_source_src_28000.ds, isoweek) AS ds__week - , DATE_TRUNC(visits_source_src_28000.ds, month) AS ds__month - , DATE_TRUNC(visits_source_src_28000.ds, quarter) AS ds__quarter - , DATE_TRUNC(visits_source_src_28000.ds, year) AS ds__year + , DATETIME_TRUNC(visits_source_src_28000.ds, day) AS ds__day + , DATETIME_TRUNC(visits_source_src_28000.ds, isoweek) AS ds__week + , DATETIME_TRUNC(visits_source_src_28000.ds, month) AS ds__month + , DATETIME_TRUNC(visits_source_src_28000.ds, quarter) AS ds__quarter + , DATETIME_TRUNC(visits_source_src_28000.ds, year) AS ds__year , EXTRACT(year FROM visits_source_src_28000.ds) AS ds__extract_year , EXTRACT(quarter FROM visits_source_src_28000.ds) AS ds__extract_quarter , EXTRACT(month FROM visits_source_src_28000.ds) AS ds__extract_month @@ -250,11 +250,11 @@ FROM ( , IF(EXTRACT(dayofweek FROM visits_source_src_28000.ds) = 1, 7, EXTRACT(dayofweek FROM visits_source_src_28000.ds) - 1) AS ds__extract_dow , EXTRACT(dayofyear FROM visits_source_src_28000.ds) AS ds__extract_doy , visits_source_src_28000.referrer_id - , DATE_TRUNC(visits_source_src_28000.ds, day) AS visit__ds__day - , DATE_TRUNC(visits_source_src_28000.ds, isoweek) AS visit__ds__week - , DATE_TRUNC(visits_source_src_28000.ds, month) AS visit__ds__month - , DATE_TRUNC(visits_source_src_28000.ds, quarter) AS visit__ds__quarter - , DATE_TRUNC(visits_source_src_28000.ds, year) AS visit__ds__year + , DATETIME_TRUNC(visits_source_src_28000.ds, day) AS visit__ds__day + , DATETIME_TRUNC(visits_source_src_28000.ds, isoweek) AS visit__ds__week + , DATETIME_TRUNC(visits_source_src_28000.ds, month) AS visit__ds__month + , DATETIME_TRUNC(visits_source_src_28000.ds, quarter) AS visit__ds__quarter + , DATETIME_TRUNC(visits_source_src_28000.ds, year) AS visit__ds__year , EXTRACT(year FROM visits_source_src_28000.ds) AS visit__ds__extract_year , EXTRACT(quarter FROM visits_source_src_28000.ds) AS visit__ds__extract_quarter , EXTRACT(month FROM visits_source_src_28000.ds) AS visit__ds__extract_month @@ -360,22 +360,22 @@ FROM ( SELECT 1 AS buys , buys_source_src_28000.user_id AS buyers - , DATE_TRUNC(buys_source_src_28000.ds, day) AS ds__day - , DATE_TRUNC(buys_source_src_28000.ds, isoweek) AS ds__week - , DATE_TRUNC(buys_source_src_28000.ds, month) AS ds__month - , DATE_TRUNC(buys_source_src_28000.ds, quarter) AS ds__quarter - , DATE_TRUNC(buys_source_src_28000.ds, year) AS ds__year + , DATETIME_TRUNC(buys_source_src_28000.ds, day) AS ds__day + , DATETIME_TRUNC(buys_source_src_28000.ds, isoweek) AS ds__week + , DATETIME_TRUNC(buys_source_src_28000.ds, month) AS ds__month + , DATETIME_TRUNC(buys_source_src_28000.ds, quarter) AS ds__quarter + , DATETIME_TRUNC(buys_source_src_28000.ds, year) AS ds__year , EXTRACT(year FROM buys_source_src_28000.ds) AS ds__extract_year , EXTRACT(quarter FROM buys_source_src_28000.ds) AS ds__extract_quarter , EXTRACT(month FROM buys_source_src_28000.ds) AS ds__extract_month , EXTRACT(day FROM buys_source_src_28000.ds) AS ds__extract_day , IF(EXTRACT(dayofweek FROM buys_source_src_28000.ds) = 1, 7, EXTRACT(dayofweek FROM buys_source_src_28000.ds) - 1) AS ds__extract_dow , EXTRACT(dayofyear FROM buys_source_src_28000.ds) AS ds__extract_doy - , DATE_TRUNC(buys_source_src_28000.ds, day) AS buy__ds__day - , DATE_TRUNC(buys_source_src_28000.ds, isoweek) AS buy__ds__week - , DATE_TRUNC(buys_source_src_28000.ds, month) AS buy__ds__month - , DATE_TRUNC(buys_source_src_28000.ds, quarter) AS buy__ds__quarter - , DATE_TRUNC(buys_source_src_28000.ds, year) AS buy__ds__year + , DATETIME_TRUNC(buys_source_src_28000.ds, day) AS buy__ds__day + , DATETIME_TRUNC(buys_source_src_28000.ds, isoweek) AS buy__ds__week + , DATETIME_TRUNC(buys_source_src_28000.ds, month) AS buy__ds__month + , DATETIME_TRUNC(buys_source_src_28000.ds, quarter) AS buy__ds__quarter + , DATETIME_TRUNC(buys_source_src_28000.ds, year) AS buy__ds__year , EXTRACT(year FROM buys_source_src_28000.ds) AS buy__ds__extract_year , EXTRACT(quarter FROM buys_source_src_28000.ds) AS buy__ds__extract_quarter , EXTRACT(month FROM buys_source_src_28000.ds) AS buy__ds__extract_month diff --git a/tests_metricflow/snapshots/test_conversion_metric_rendering.py/SqlQueryPlan/BigQuery/test_conversion_metric_with_categorical_filter__plan0_optimized.sql b/tests_metricflow/snapshots/test_conversion_metric_rendering.py/SqlQueryPlan/BigQuery/test_conversion_metric_with_categorical_filter__plan0_optimized.sql index 4bab3e4f64..cf990757b6 100644 --- a/tests_metricflow/snapshots/test_conversion_metric_rendering.py/SqlQueryPlan/BigQuery/test_conversion_metric_with_categorical_filter__plan0_optimized.sql +++ b/tests_metricflow/snapshots/test_conversion_metric_rendering.py/SqlQueryPlan/BigQuery/test_conversion_metric_with_categorical_filter__plan0_optimized.sql @@ -22,7 +22,7 @@ FROM ( -- Metric Time Dimension 'ds' -- Pass Only Elements: ['visits', 'visit__referrer_id', 'metric_time__day'] SELECT - DATE_TRUNC(ds, day) AS metric_time__day + DATETIME_TRUNC(ds, day) AS metric_time__day , referrer_id AS visit__referrer_id , 1 AS visits FROM ***************************.fct_visits visits_source_src_28000 @@ -90,8 +90,8 @@ FROM ( -- Metric Time Dimension 'ds' -- Pass Only Elements: ['visits', 'visit__referrer_id', 'ds__day', 'metric_time__day', 'user'] SELECT - DATE_TRUNC(ds, day) AS ds__day - , DATE_TRUNC(ds, day) AS metric_time__day + DATETIME_TRUNC(ds, day) AS ds__day + , DATETIME_TRUNC(ds, day) AS metric_time__day , user_id AS user , referrer_id AS visit__referrer_id , 1 AS visits @@ -102,7 +102,7 @@ FROM ( -- Metric Time Dimension 'ds' -- Add column with generated UUID SELECT - DATE_TRUNC(ds, day) AS ds__day + DATETIME_TRUNC(ds, day) AS ds__day , user_id AS user , 1 AS buys , GENERATE_UUID() AS mf_internal_uuid diff --git a/tests_metricflow/snapshots/test_conversion_metric_rendering.py/SqlQueryPlan/BigQuery/test_conversion_metric_with_time_constraint__plan0.sql b/tests_metricflow/snapshots/test_conversion_metric_rendering.py/SqlQueryPlan/BigQuery/test_conversion_metric_with_time_constraint__plan0.sql index d799fea526..1a1dcdd800 100644 --- a/tests_metricflow/snapshots/test_conversion_metric_rendering.py/SqlQueryPlan/BigQuery/test_conversion_metric_with_time_constraint__plan0.sql +++ b/tests_metricflow/snapshots/test_conversion_metric_rendering.py/SqlQueryPlan/BigQuery/test_conversion_metric_with_time_constraint__plan0.sql @@ -116,11 +116,11 @@ FROM ( SELECT 1 AS visits , visits_source_src_28000.user_id AS visitors - , DATE_TRUNC(visits_source_src_28000.ds, day) AS ds__day - , DATE_TRUNC(visits_source_src_28000.ds, isoweek) AS ds__week - , DATE_TRUNC(visits_source_src_28000.ds, month) AS ds__month - , DATE_TRUNC(visits_source_src_28000.ds, quarter) AS ds__quarter - , DATE_TRUNC(visits_source_src_28000.ds, year) AS ds__year + , DATETIME_TRUNC(visits_source_src_28000.ds, day) AS ds__day + , DATETIME_TRUNC(visits_source_src_28000.ds, isoweek) AS ds__week + , DATETIME_TRUNC(visits_source_src_28000.ds, month) AS ds__month + , DATETIME_TRUNC(visits_source_src_28000.ds, quarter) AS ds__quarter + , DATETIME_TRUNC(visits_source_src_28000.ds, year) AS ds__year , EXTRACT(year FROM visits_source_src_28000.ds) AS ds__extract_year , EXTRACT(quarter FROM visits_source_src_28000.ds) AS ds__extract_quarter , EXTRACT(month FROM visits_source_src_28000.ds) AS ds__extract_month @@ -128,11 +128,11 @@ FROM ( , IF(EXTRACT(dayofweek FROM visits_source_src_28000.ds) = 1, 7, EXTRACT(dayofweek FROM visits_source_src_28000.ds) - 1) AS ds__extract_dow , EXTRACT(dayofyear FROM visits_source_src_28000.ds) AS ds__extract_doy , visits_source_src_28000.referrer_id - , DATE_TRUNC(visits_source_src_28000.ds, day) AS visit__ds__day - , DATE_TRUNC(visits_source_src_28000.ds, isoweek) AS visit__ds__week - , DATE_TRUNC(visits_source_src_28000.ds, month) AS visit__ds__month - , DATE_TRUNC(visits_source_src_28000.ds, quarter) AS visit__ds__quarter - , DATE_TRUNC(visits_source_src_28000.ds, year) AS visit__ds__year + , DATETIME_TRUNC(visits_source_src_28000.ds, day) AS visit__ds__day + , DATETIME_TRUNC(visits_source_src_28000.ds, isoweek) AS visit__ds__week + , DATETIME_TRUNC(visits_source_src_28000.ds, month) AS visit__ds__month + , DATETIME_TRUNC(visits_source_src_28000.ds, quarter) AS visit__ds__quarter + , DATETIME_TRUNC(visits_source_src_28000.ds, year) AS visit__ds__year , EXTRACT(year FROM visits_source_src_28000.ds) AS visit__ds__extract_year , EXTRACT(quarter FROM visits_source_src_28000.ds) AS visit__ds__extract_quarter , EXTRACT(month FROM visits_source_src_28000.ds) AS visit__ds__extract_month @@ -310,11 +310,11 @@ FROM ( SELECT 1 AS visits , visits_source_src_28000.user_id AS visitors - , DATE_TRUNC(visits_source_src_28000.ds, day) AS ds__day - , DATE_TRUNC(visits_source_src_28000.ds, isoweek) AS ds__week - , DATE_TRUNC(visits_source_src_28000.ds, month) AS ds__month - , DATE_TRUNC(visits_source_src_28000.ds, quarter) AS ds__quarter - , DATE_TRUNC(visits_source_src_28000.ds, year) AS ds__year + , DATETIME_TRUNC(visits_source_src_28000.ds, day) AS ds__day + , DATETIME_TRUNC(visits_source_src_28000.ds, isoweek) AS ds__week + , DATETIME_TRUNC(visits_source_src_28000.ds, month) AS ds__month + , DATETIME_TRUNC(visits_source_src_28000.ds, quarter) AS ds__quarter + , DATETIME_TRUNC(visits_source_src_28000.ds, year) AS ds__year , EXTRACT(year FROM visits_source_src_28000.ds) AS ds__extract_year , EXTRACT(quarter FROM visits_source_src_28000.ds) AS ds__extract_quarter , EXTRACT(month FROM visits_source_src_28000.ds) AS ds__extract_month @@ -322,11 +322,11 @@ FROM ( , IF(EXTRACT(dayofweek FROM visits_source_src_28000.ds) = 1, 7, EXTRACT(dayofweek FROM visits_source_src_28000.ds) - 1) AS ds__extract_dow , EXTRACT(dayofyear FROM visits_source_src_28000.ds) AS ds__extract_doy , visits_source_src_28000.referrer_id - , DATE_TRUNC(visits_source_src_28000.ds, day) AS visit__ds__day - , DATE_TRUNC(visits_source_src_28000.ds, isoweek) AS visit__ds__week - , DATE_TRUNC(visits_source_src_28000.ds, month) AS visit__ds__month - , DATE_TRUNC(visits_source_src_28000.ds, quarter) AS visit__ds__quarter - , DATE_TRUNC(visits_source_src_28000.ds, year) AS visit__ds__year + , DATETIME_TRUNC(visits_source_src_28000.ds, day) AS visit__ds__day + , DATETIME_TRUNC(visits_source_src_28000.ds, isoweek) AS visit__ds__week + , DATETIME_TRUNC(visits_source_src_28000.ds, month) AS visit__ds__month + , DATETIME_TRUNC(visits_source_src_28000.ds, quarter) AS visit__ds__quarter + , DATETIME_TRUNC(visits_source_src_28000.ds, year) AS visit__ds__year , EXTRACT(year FROM visits_source_src_28000.ds) AS visit__ds__extract_year , EXTRACT(quarter FROM visits_source_src_28000.ds) AS visit__ds__extract_quarter , EXTRACT(month FROM visits_source_src_28000.ds) AS visit__ds__extract_month @@ -434,22 +434,22 @@ FROM ( SELECT 1 AS buys , buys_source_src_28000.user_id AS buyers - , DATE_TRUNC(buys_source_src_28000.ds, day) AS ds__day - , DATE_TRUNC(buys_source_src_28000.ds, isoweek) AS ds__week - , DATE_TRUNC(buys_source_src_28000.ds, month) AS ds__month - , DATE_TRUNC(buys_source_src_28000.ds, quarter) AS ds__quarter - , DATE_TRUNC(buys_source_src_28000.ds, year) AS ds__year + , DATETIME_TRUNC(buys_source_src_28000.ds, day) AS ds__day + , DATETIME_TRUNC(buys_source_src_28000.ds, isoweek) AS ds__week + , DATETIME_TRUNC(buys_source_src_28000.ds, month) AS ds__month + , DATETIME_TRUNC(buys_source_src_28000.ds, quarter) AS ds__quarter + , DATETIME_TRUNC(buys_source_src_28000.ds, year) AS ds__year , EXTRACT(year FROM buys_source_src_28000.ds) AS ds__extract_year , EXTRACT(quarter FROM buys_source_src_28000.ds) AS ds__extract_quarter , EXTRACT(month FROM buys_source_src_28000.ds) AS ds__extract_month , EXTRACT(day FROM buys_source_src_28000.ds) AS ds__extract_day , IF(EXTRACT(dayofweek FROM buys_source_src_28000.ds) = 1, 7, EXTRACT(dayofweek FROM buys_source_src_28000.ds) - 1) AS ds__extract_dow , EXTRACT(dayofyear FROM buys_source_src_28000.ds) AS ds__extract_doy - , DATE_TRUNC(buys_source_src_28000.ds, day) AS buy__ds__day - , DATE_TRUNC(buys_source_src_28000.ds, isoweek) AS buy__ds__week - , DATE_TRUNC(buys_source_src_28000.ds, month) AS buy__ds__month - , DATE_TRUNC(buys_source_src_28000.ds, quarter) AS buy__ds__quarter - , DATE_TRUNC(buys_source_src_28000.ds, year) AS buy__ds__year + , DATETIME_TRUNC(buys_source_src_28000.ds, day) AS buy__ds__day + , DATETIME_TRUNC(buys_source_src_28000.ds, isoweek) AS buy__ds__week + , DATETIME_TRUNC(buys_source_src_28000.ds, month) AS buy__ds__month + , DATETIME_TRUNC(buys_source_src_28000.ds, quarter) AS buy__ds__quarter + , DATETIME_TRUNC(buys_source_src_28000.ds, year) AS buy__ds__year , EXTRACT(year FROM buys_source_src_28000.ds) AS buy__ds__extract_year , EXTRACT(quarter FROM buys_source_src_28000.ds) AS buy__ds__extract_quarter , EXTRACT(month FROM buys_source_src_28000.ds) AS buy__ds__extract_month diff --git a/tests_metricflow/snapshots/test_conversion_metric_rendering.py/SqlQueryPlan/BigQuery/test_conversion_metric_with_time_constraint__plan0_optimized.sql b/tests_metricflow/snapshots/test_conversion_metric_rendering.py/SqlQueryPlan/BigQuery/test_conversion_metric_with_time_constraint__plan0_optimized.sql index cd1b0725c9..bf18f3b8a3 100644 --- a/tests_metricflow/snapshots/test_conversion_metric_rendering.py/SqlQueryPlan/BigQuery/test_conversion_metric_with_time_constraint__plan0_optimized.sql +++ b/tests_metricflow/snapshots/test_conversion_metric_rendering.py/SqlQueryPlan/BigQuery/test_conversion_metric_with_time_constraint__plan0_optimized.sql @@ -23,7 +23,7 @@ FROM ( referrer_id AS visit__referrer_id , 1 AS visits FROM ***************************.fct_visits visits_source_src_28000 - WHERE DATE_TRUNC(ds, day) BETWEEN '2020-01-01' AND '2020-01-02' + WHERE DATETIME_TRUNC(ds, day) BETWEEN '2020-01-01' AND '2020-01-02' ) subq_25 WHERE visit__referrer_id = 'ref_id_01' GROUP BY @@ -79,19 +79,19 @@ FROM ( -- Constrain Time Range to [2020-01-01T00:00:00, 2020-01-02T00:00:00] -- Pass Only Elements: ['visits', 'visit__referrer_id', 'ds__day', 'user'] SELECT - DATE_TRUNC(ds, day) AS ds__day + DATETIME_TRUNC(ds, day) AS ds__day , user_id AS user , referrer_id AS visit__referrer_id , 1 AS visits FROM ***************************.fct_visits visits_source_src_28000 - WHERE DATE_TRUNC(ds, day) BETWEEN '2020-01-01' AND '2020-01-02' + WHERE DATETIME_TRUNC(ds, day) BETWEEN '2020-01-01' AND '2020-01-02' ) subq_31 INNER JOIN ( -- Read Elements From Semantic Model 'buys_source' -- Metric Time Dimension 'ds' -- Add column with generated UUID SELECT - DATE_TRUNC(ds, day) AS ds__day + DATETIME_TRUNC(ds, day) AS ds__day , user_id AS user , 1 AS buys , GENERATE_UUID() AS mf_internal_uuid diff --git a/tests_metricflow/snapshots/test_conversion_metric_rendering.py/SqlQueryPlan/BigQuery/test_conversion_metric_with_window__plan0.sql b/tests_metricflow/snapshots/test_conversion_metric_rendering.py/SqlQueryPlan/BigQuery/test_conversion_metric_with_window__plan0.sql index 47325286aa..8d811e2743 100644 --- a/tests_metricflow/snapshots/test_conversion_metric_rendering.py/SqlQueryPlan/BigQuery/test_conversion_metric_with_window__plan0.sql +++ b/tests_metricflow/snapshots/test_conversion_metric_rendering.py/SqlQueryPlan/BigQuery/test_conversion_metric_with_window__plan0.sql @@ -72,11 +72,11 @@ FROM ( SELECT 1 AS visits , visits_source_src_28000.user_id AS visitors - , DATE_TRUNC(visits_source_src_28000.ds, day) AS ds__day - , DATE_TRUNC(visits_source_src_28000.ds, isoweek) AS ds__week - , DATE_TRUNC(visits_source_src_28000.ds, month) AS ds__month - , DATE_TRUNC(visits_source_src_28000.ds, quarter) AS ds__quarter - , DATE_TRUNC(visits_source_src_28000.ds, year) AS ds__year + , DATETIME_TRUNC(visits_source_src_28000.ds, day) AS ds__day + , DATETIME_TRUNC(visits_source_src_28000.ds, isoweek) AS ds__week + , DATETIME_TRUNC(visits_source_src_28000.ds, month) AS ds__month + , DATETIME_TRUNC(visits_source_src_28000.ds, quarter) AS ds__quarter + , DATETIME_TRUNC(visits_source_src_28000.ds, year) AS ds__year , EXTRACT(year FROM visits_source_src_28000.ds) AS ds__extract_year , EXTRACT(quarter FROM visits_source_src_28000.ds) AS ds__extract_quarter , EXTRACT(month FROM visits_source_src_28000.ds) AS ds__extract_month @@ -84,11 +84,11 @@ FROM ( , IF(EXTRACT(dayofweek FROM visits_source_src_28000.ds) = 1, 7, EXTRACT(dayofweek FROM visits_source_src_28000.ds) - 1) AS ds__extract_dow , EXTRACT(dayofyear FROM visits_source_src_28000.ds) AS ds__extract_doy , visits_source_src_28000.referrer_id - , DATE_TRUNC(visits_source_src_28000.ds, day) AS visit__ds__day - , DATE_TRUNC(visits_source_src_28000.ds, isoweek) AS visit__ds__week - , DATE_TRUNC(visits_source_src_28000.ds, month) AS visit__ds__month - , DATE_TRUNC(visits_source_src_28000.ds, quarter) AS visit__ds__quarter - , DATE_TRUNC(visits_source_src_28000.ds, year) AS visit__ds__year + , DATETIME_TRUNC(visits_source_src_28000.ds, day) AS visit__ds__day + , DATETIME_TRUNC(visits_source_src_28000.ds, isoweek) AS visit__ds__week + , DATETIME_TRUNC(visits_source_src_28000.ds, month) AS visit__ds__month + , DATETIME_TRUNC(visits_source_src_28000.ds, quarter) AS visit__ds__quarter + , DATETIME_TRUNC(visits_source_src_28000.ds, year) AS visit__ds__year , EXTRACT(year FROM visits_source_src_28000.ds) AS visit__ds__extract_year , EXTRACT(quarter FROM visits_source_src_28000.ds) AS visit__ds__extract_quarter , EXTRACT(month FROM visits_source_src_28000.ds) AS visit__ds__extract_month @@ -220,11 +220,11 @@ FROM ( SELECT 1 AS visits , visits_source_src_28000.user_id AS visitors - , DATE_TRUNC(visits_source_src_28000.ds, day) AS ds__day - , DATE_TRUNC(visits_source_src_28000.ds, isoweek) AS ds__week - , DATE_TRUNC(visits_source_src_28000.ds, month) AS ds__month - , DATE_TRUNC(visits_source_src_28000.ds, quarter) AS ds__quarter - , DATE_TRUNC(visits_source_src_28000.ds, year) AS ds__year + , DATETIME_TRUNC(visits_source_src_28000.ds, day) AS ds__day + , DATETIME_TRUNC(visits_source_src_28000.ds, isoweek) AS ds__week + , DATETIME_TRUNC(visits_source_src_28000.ds, month) AS ds__month + , DATETIME_TRUNC(visits_source_src_28000.ds, quarter) AS ds__quarter + , DATETIME_TRUNC(visits_source_src_28000.ds, year) AS ds__year , EXTRACT(year FROM visits_source_src_28000.ds) AS ds__extract_year , EXTRACT(quarter FROM visits_source_src_28000.ds) AS ds__extract_quarter , EXTRACT(month FROM visits_source_src_28000.ds) AS ds__extract_month @@ -232,11 +232,11 @@ FROM ( , IF(EXTRACT(dayofweek FROM visits_source_src_28000.ds) = 1, 7, EXTRACT(dayofweek FROM visits_source_src_28000.ds) - 1) AS ds__extract_dow , EXTRACT(dayofyear FROM visits_source_src_28000.ds) AS ds__extract_doy , visits_source_src_28000.referrer_id - , DATE_TRUNC(visits_source_src_28000.ds, day) AS visit__ds__day - , DATE_TRUNC(visits_source_src_28000.ds, isoweek) AS visit__ds__week - , DATE_TRUNC(visits_source_src_28000.ds, month) AS visit__ds__month - , DATE_TRUNC(visits_source_src_28000.ds, quarter) AS visit__ds__quarter - , DATE_TRUNC(visits_source_src_28000.ds, year) AS visit__ds__year + , DATETIME_TRUNC(visits_source_src_28000.ds, day) AS visit__ds__day + , DATETIME_TRUNC(visits_source_src_28000.ds, isoweek) AS visit__ds__week + , DATETIME_TRUNC(visits_source_src_28000.ds, month) AS visit__ds__month + , DATETIME_TRUNC(visits_source_src_28000.ds, quarter) AS visit__ds__quarter + , DATETIME_TRUNC(visits_source_src_28000.ds, year) AS visit__ds__year , EXTRACT(year FROM visits_source_src_28000.ds) AS visit__ds__extract_year , EXTRACT(quarter FROM visits_source_src_28000.ds) AS visit__ds__extract_quarter , EXTRACT(month FROM visits_source_src_28000.ds) AS visit__ds__extract_month @@ -342,22 +342,22 @@ FROM ( SELECT 1 AS buys , buys_source_src_28000.user_id AS buyers - , DATE_TRUNC(buys_source_src_28000.ds, day) AS ds__day - , DATE_TRUNC(buys_source_src_28000.ds, isoweek) AS ds__week - , DATE_TRUNC(buys_source_src_28000.ds, month) AS ds__month - , DATE_TRUNC(buys_source_src_28000.ds, quarter) AS ds__quarter - , DATE_TRUNC(buys_source_src_28000.ds, year) AS ds__year + , DATETIME_TRUNC(buys_source_src_28000.ds, day) AS ds__day + , DATETIME_TRUNC(buys_source_src_28000.ds, isoweek) AS ds__week + , DATETIME_TRUNC(buys_source_src_28000.ds, month) AS ds__month + , DATETIME_TRUNC(buys_source_src_28000.ds, quarter) AS ds__quarter + , DATETIME_TRUNC(buys_source_src_28000.ds, year) AS ds__year , EXTRACT(year FROM buys_source_src_28000.ds) AS ds__extract_year , EXTRACT(quarter FROM buys_source_src_28000.ds) AS ds__extract_quarter , EXTRACT(month FROM buys_source_src_28000.ds) AS ds__extract_month , EXTRACT(day FROM buys_source_src_28000.ds) AS ds__extract_day , IF(EXTRACT(dayofweek FROM buys_source_src_28000.ds) = 1, 7, EXTRACT(dayofweek FROM buys_source_src_28000.ds) - 1) AS ds__extract_dow , EXTRACT(dayofyear FROM buys_source_src_28000.ds) AS ds__extract_doy - , DATE_TRUNC(buys_source_src_28000.ds, day) AS buy__ds__day - , DATE_TRUNC(buys_source_src_28000.ds, isoweek) AS buy__ds__week - , DATE_TRUNC(buys_source_src_28000.ds, month) AS buy__ds__month - , DATE_TRUNC(buys_source_src_28000.ds, quarter) AS buy__ds__quarter - , DATE_TRUNC(buys_source_src_28000.ds, year) AS buy__ds__year + , DATETIME_TRUNC(buys_source_src_28000.ds, day) AS buy__ds__day + , DATETIME_TRUNC(buys_source_src_28000.ds, isoweek) AS buy__ds__week + , DATETIME_TRUNC(buys_source_src_28000.ds, month) AS buy__ds__month + , DATETIME_TRUNC(buys_source_src_28000.ds, quarter) AS buy__ds__quarter + , DATETIME_TRUNC(buys_source_src_28000.ds, year) AS buy__ds__year , EXTRACT(year FROM buys_source_src_28000.ds) AS buy__ds__extract_year , EXTRACT(quarter FROM buys_source_src_28000.ds) AS buy__ds__extract_quarter , EXTRACT(month FROM buys_source_src_28000.ds) AS buy__ds__extract_month diff --git a/tests_metricflow/snapshots/test_conversion_metric_rendering.py/SqlQueryPlan/BigQuery/test_conversion_metric_with_window__plan0_optimized.sql b/tests_metricflow/snapshots/test_conversion_metric_rendering.py/SqlQueryPlan/BigQuery/test_conversion_metric_with_window__plan0_optimized.sql index e5b1d2d946..2431e36973 100644 --- a/tests_metricflow/snapshots/test_conversion_metric_rendering.py/SqlQueryPlan/BigQuery/test_conversion_metric_with_window__plan0_optimized.sql +++ b/tests_metricflow/snapshots/test_conversion_metric_rendering.py/SqlQueryPlan/BigQuery/test_conversion_metric_with_window__plan0_optimized.sql @@ -19,7 +19,7 @@ FROM ( -- Metric Time Dimension 'ds' -- Pass Only Elements: ['visits', 'metric_time__day'] SELECT - DATE_TRUNC(ds, day) AS metric_time__day + DATETIME_TRUNC(ds, day) AS metric_time__day , 1 AS visits FROM ***************************.fct_visits visits_source_src_28000 ) subq_18 @@ -76,8 +76,8 @@ FROM ( -- Metric Time Dimension 'ds' -- Pass Only Elements: ['visits', 'ds__day', 'metric_time__day', 'user'] SELECT - DATE_TRUNC(ds, day) AS ds__day - , DATE_TRUNC(ds, day) AS metric_time__day + DATETIME_TRUNC(ds, day) AS ds__day + , DATETIME_TRUNC(ds, day) AS metric_time__day , user_id AS user , 1 AS visits FROM ***************************.fct_visits visits_source_src_28000 @@ -87,7 +87,7 @@ FROM ( -- Metric Time Dimension 'ds' -- Add column with generated UUID SELECT - DATE_TRUNC(ds, day) AS ds__day + DATETIME_TRUNC(ds, day) AS ds__day , user_id AS user , 1 AS buys , GENERATE_UUID() AS mf_internal_uuid diff --git a/tests_metricflow/snapshots/test_conversion_metric_rendering.py/SqlQueryPlan/BigQuery/test_conversion_metric_with_window_and_time_constraint__plan0.sql b/tests_metricflow/snapshots/test_conversion_metric_rendering.py/SqlQueryPlan/BigQuery/test_conversion_metric_with_window_and_time_constraint__plan0.sql index 80a38a831d..1acc95787d 100644 --- a/tests_metricflow/snapshots/test_conversion_metric_rendering.py/SqlQueryPlan/BigQuery/test_conversion_metric_with_window_and_time_constraint__plan0.sql +++ b/tests_metricflow/snapshots/test_conversion_metric_rendering.py/SqlQueryPlan/BigQuery/test_conversion_metric_with_window_and_time_constraint__plan0.sql @@ -121,11 +121,11 @@ FROM ( SELECT 1 AS visits , visits_source_src_28000.user_id AS visitors - , DATE_TRUNC(visits_source_src_28000.ds, day) AS ds__day - , DATE_TRUNC(visits_source_src_28000.ds, isoweek) AS ds__week - , DATE_TRUNC(visits_source_src_28000.ds, month) AS ds__month - , DATE_TRUNC(visits_source_src_28000.ds, quarter) AS ds__quarter - , DATE_TRUNC(visits_source_src_28000.ds, year) AS ds__year + , DATETIME_TRUNC(visits_source_src_28000.ds, day) AS ds__day + , DATETIME_TRUNC(visits_source_src_28000.ds, isoweek) AS ds__week + , DATETIME_TRUNC(visits_source_src_28000.ds, month) AS ds__month + , DATETIME_TRUNC(visits_source_src_28000.ds, quarter) AS ds__quarter + , DATETIME_TRUNC(visits_source_src_28000.ds, year) AS ds__year , EXTRACT(year FROM visits_source_src_28000.ds) AS ds__extract_year , EXTRACT(quarter FROM visits_source_src_28000.ds) AS ds__extract_quarter , EXTRACT(month FROM visits_source_src_28000.ds) AS ds__extract_month @@ -133,11 +133,11 @@ FROM ( , IF(EXTRACT(dayofweek FROM visits_source_src_28000.ds) = 1, 7, EXTRACT(dayofweek FROM visits_source_src_28000.ds) - 1) AS ds__extract_dow , EXTRACT(dayofyear FROM visits_source_src_28000.ds) AS ds__extract_doy , visits_source_src_28000.referrer_id - , DATE_TRUNC(visits_source_src_28000.ds, day) AS visit__ds__day - , DATE_TRUNC(visits_source_src_28000.ds, isoweek) AS visit__ds__week - , DATE_TRUNC(visits_source_src_28000.ds, month) AS visit__ds__month - , DATE_TRUNC(visits_source_src_28000.ds, quarter) AS visit__ds__quarter - , DATE_TRUNC(visits_source_src_28000.ds, year) AS visit__ds__year + , DATETIME_TRUNC(visits_source_src_28000.ds, day) AS visit__ds__day + , DATETIME_TRUNC(visits_source_src_28000.ds, isoweek) AS visit__ds__week + , DATETIME_TRUNC(visits_source_src_28000.ds, month) AS visit__ds__month + , DATETIME_TRUNC(visits_source_src_28000.ds, quarter) AS visit__ds__quarter + , DATETIME_TRUNC(visits_source_src_28000.ds, year) AS visit__ds__year , EXTRACT(year FROM visits_source_src_28000.ds) AS visit__ds__extract_year , EXTRACT(quarter FROM visits_source_src_28000.ds) AS visit__ds__extract_quarter , EXTRACT(month FROM visits_source_src_28000.ds) AS visit__ds__extract_month @@ -328,11 +328,11 @@ FROM ( SELECT 1 AS visits , visits_source_src_28000.user_id AS visitors - , DATE_TRUNC(visits_source_src_28000.ds, day) AS ds__day - , DATE_TRUNC(visits_source_src_28000.ds, isoweek) AS ds__week - , DATE_TRUNC(visits_source_src_28000.ds, month) AS ds__month - , DATE_TRUNC(visits_source_src_28000.ds, quarter) AS ds__quarter - , DATE_TRUNC(visits_source_src_28000.ds, year) AS ds__year + , DATETIME_TRUNC(visits_source_src_28000.ds, day) AS ds__day + , DATETIME_TRUNC(visits_source_src_28000.ds, isoweek) AS ds__week + , DATETIME_TRUNC(visits_source_src_28000.ds, month) AS ds__month + , DATETIME_TRUNC(visits_source_src_28000.ds, quarter) AS ds__quarter + , DATETIME_TRUNC(visits_source_src_28000.ds, year) AS ds__year , EXTRACT(year FROM visits_source_src_28000.ds) AS ds__extract_year , EXTRACT(quarter FROM visits_source_src_28000.ds) AS ds__extract_quarter , EXTRACT(month FROM visits_source_src_28000.ds) AS ds__extract_month @@ -340,11 +340,11 @@ FROM ( , IF(EXTRACT(dayofweek FROM visits_source_src_28000.ds) = 1, 7, EXTRACT(dayofweek FROM visits_source_src_28000.ds) - 1) AS ds__extract_dow , EXTRACT(dayofyear FROM visits_source_src_28000.ds) AS ds__extract_doy , visits_source_src_28000.referrer_id - , DATE_TRUNC(visits_source_src_28000.ds, day) AS visit__ds__day - , DATE_TRUNC(visits_source_src_28000.ds, isoweek) AS visit__ds__week - , DATE_TRUNC(visits_source_src_28000.ds, month) AS visit__ds__month - , DATE_TRUNC(visits_source_src_28000.ds, quarter) AS visit__ds__quarter - , DATE_TRUNC(visits_source_src_28000.ds, year) AS visit__ds__year + , DATETIME_TRUNC(visits_source_src_28000.ds, day) AS visit__ds__day + , DATETIME_TRUNC(visits_source_src_28000.ds, isoweek) AS visit__ds__week + , DATETIME_TRUNC(visits_source_src_28000.ds, month) AS visit__ds__month + , DATETIME_TRUNC(visits_source_src_28000.ds, quarter) AS visit__ds__quarter + , DATETIME_TRUNC(visits_source_src_28000.ds, year) AS visit__ds__year , EXTRACT(year FROM visits_source_src_28000.ds) AS visit__ds__extract_year , EXTRACT(quarter FROM visits_source_src_28000.ds) AS visit__ds__extract_quarter , EXTRACT(month FROM visits_source_src_28000.ds) AS visit__ds__extract_month @@ -452,22 +452,22 @@ FROM ( SELECT 1 AS buys , buys_source_src_28000.user_id AS buyers - , DATE_TRUNC(buys_source_src_28000.ds, day) AS ds__day - , DATE_TRUNC(buys_source_src_28000.ds, isoweek) AS ds__week - , DATE_TRUNC(buys_source_src_28000.ds, month) AS ds__month - , DATE_TRUNC(buys_source_src_28000.ds, quarter) AS ds__quarter - , DATE_TRUNC(buys_source_src_28000.ds, year) AS ds__year + , DATETIME_TRUNC(buys_source_src_28000.ds, day) AS ds__day + , DATETIME_TRUNC(buys_source_src_28000.ds, isoweek) AS ds__week + , DATETIME_TRUNC(buys_source_src_28000.ds, month) AS ds__month + , DATETIME_TRUNC(buys_source_src_28000.ds, quarter) AS ds__quarter + , DATETIME_TRUNC(buys_source_src_28000.ds, year) AS ds__year , EXTRACT(year FROM buys_source_src_28000.ds) AS ds__extract_year , EXTRACT(quarter FROM buys_source_src_28000.ds) AS ds__extract_quarter , EXTRACT(month FROM buys_source_src_28000.ds) AS ds__extract_month , EXTRACT(day FROM buys_source_src_28000.ds) AS ds__extract_day , IF(EXTRACT(dayofweek FROM buys_source_src_28000.ds) = 1, 7, EXTRACT(dayofweek FROM buys_source_src_28000.ds) - 1) AS ds__extract_dow , EXTRACT(dayofyear FROM buys_source_src_28000.ds) AS ds__extract_doy - , DATE_TRUNC(buys_source_src_28000.ds, day) AS buy__ds__day - , DATE_TRUNC(buys_source_src_28000.ds, isoweek) AS buy__ds__week - , DATE_TRUNC(buys_source_src_28000.ds, month) AS buy__ds__month - , DATE_TRUNC(buys_source_src_28000.ds, quarter) AS buy__ds__quarter - , DATE_TRUNC(buys_source_src_28000.ds, year) AS buy__ds__year + , DATETIME_TRUNC(buys_source_src_28000.ds, day) AS buy__ds__day + , DATETIME_TRUNC(buys_source_src_28000.ds, isoweek) AS buy__ds__week + , DATETIME_TRUNC(buys_source_src_28000.ds, month) AS buy__ds__month + , DATETIME_TRUNC(buys_source_src_28000.ds, quarter) AS buy__ds__quarter + , DATETIME_TRUNC(buys_source_src_28000.ds, year) AS buy__ds__year , EXTRACT(year FROM buys_source_src_28000.ds) AS buy__ds__extract_year , EXTRACT(quarter FROM buys_source_src_28000.ds) AS buy__ds__extract_quarter , EXTRACT(month FROM buys_source_src_28000.ds) AS buy__ds__extract_month diff --git a/tests_metricflow/snapshots/test_conversion_metric_rendering.py/SqlQueryPlan/BigQuery/test_conversion_metric_with_window_and_time_constraint__plan0_optimized.sql b/tests_metricflow/snapshots/test_conversion_metric_rendering.py/SqlQueryPlan/BigQuery/test_conversion_metric_with_window_and_time_constraint__plan0_optimized.sql index 4c512fc780..17ae80eefd 100644 --- a/tests_metricflow/snapshots/test_conversion_metric_rendering.py/SqlQueryPlan/BigQuery/test_conversion_metric_with_window_and_time_constraint__plan0_optimized.sql +++ b/tests_metricflow/snapshots/test_conversion_metric_rendering.py/SqlQueryPlan/BigQuery/test_conversion_metric_with_window_and_time_constraint__plan0_optimized.sql @@ -23,11 +23,11 @@ FROM ( -- Constrain Time Range to [2020-01-01T00:00:00, 2020-01-02T00:00:00] -- Pass Only Elements: ['visits', 'visit__referrer_id', 'metric_time__day'] SELECT - DATE_TRUNC(ds, day) AS metric_time__day + DATETIME_TRUNC(ds, day) AS metric_time__day , referrer_id AS visit__referrer_id , 1 AS visits FROM ***************************.fct_visits visits_source_src_28000 - WHERE DATE_TRUNC(ds, day) BETWEEN '2020-01-01' AND '2020-01-02' + WHERE DATETIME_TRUNC(ds, day) BETWEEN '2020-01-01' AND '2020-01-02' ) subq_25 WHERE visit__referrer_id = 'ref_id_01' GROUP BY @@ -93,20 +93,20 @@ FROM ( -- Constrain Time Range to [2020-01-01T00:00:00, 2020-01-02T00:00:00] -- Pass Only Elements: ['visits', 'visit__referrer_id', 'ds__day', 'metric_time__day', 'user'] SELECT - DATE_TRUNC(ds, day) AS ds__day - , DATE_TRUNC(ds, day) AS metric_time__day + DATETIME_TRUNC(ds, day) AS ds__day + , DATETIME_TRUNC(ds, day) AS metric_time__day , user_id AS user , referrer_id AS visit__referrer_id , 1 AS visits FROM ***************************.fct_visits visits_source_src_28000 - WHERE DATE_TRUNC(ds, day) BETWEEN '2020-01-01' AND '2020-01-02' + WHERE DATETIME_TRUNC(ds, day) BETWEEN '2020-01-01' AND '2020-01-02' ) subq_31 INNER JOIN ( -- Read Elements From Semantic Model 'buys_source' -- Metric Time Dimension 'ds' -- Add column with generated UUID SELECT - DATE_TRUNC(ds, day) AS ds__day + DATETIME_TRUNC(ds, day) AS ds__day , user_id AS user , 1 AS buys , GENERATE_UUID() AS mf_internal_uuid diff --git a/tests_metricflow/snapshots/test_conversion_metrics_to_sql.py/SqlQueryPlan/BigQuery/test_conversion_count_with_no_group_by__plan0.sql b/tests_metricflow/snapshots/test_conversion_metrics_to_sql.py/SqlQueryPlan/BigQuery/test_conversion_count_with_no_group_by__plan0.sql index 28852a3c20..62bc90317e 100644 --- a/tests_metricflow/snapshots/test_conversion_metrics_to_sql.py/SqlQueryPlan/BigQuery/test_conversion_count_with_no_group_by__plan0.sql +++ b/tests_metricflow/snapshots/test_conversion_metrics_to_sql.py/SqlQueryPlan/BigQuery/test_conversion_count_with_no_group_by__plan0.sql @@ -63,11 +63,11 @@ FROM ( SELECT 1 AS visits , visits_source_src_28000.user_id AS visitors - , DATE_TRUNC(visits_source_src_28000.ds, day) AS ds__day - , DATE_TRUNC(visits_source_src_28000.ds, isoweek) AS ds__week - , DATE_TRUNC(visits_source_src_28000.ds, month) AS ds__month - , DATE_TRUNC(visits_source_src_28000.ds, quarter) AS ds__quarter - , DATE_TRUNC(visits_source_src_28000.ds, year) AS ds__year + , DATETIME_TRUNC(visits_source_src_28000.ds, day) AS ds__day + , DATETIME_TRUNC(visits_source_src_28000.ds, isoweek) AS ds__week + , DATETIME_TRUNC(visits_source_src_28000.ds, month) AS ds__month + , DATETIME_TRUNC(visits_source_src_28000.ds, quarter) AS ds__quarter + , DATETIME_TRUNC(visits_source_src_28000.ds, year) AS ds__year , EXTRACT(year FROM visits_source_src_28000.ds) AS ds__extract_year , EXTRACT(quarter FROM visits_source_src_28000.ds) AS ds__extract_quarter , EXTRACT(month FROM visits_source_src_28000.ds) AS ds__extract_month @@ -75,11 +75,11 @@ FROM ( , IF(EXTRACT(dayofweek FROM visits_source_src_28000.ds) = 1, 7, EXTRACT(dayofweek FROM visits_source_src_28000.ds) - 1) AS ds__extract_dow , EXTRACT(dayofyear FROM visits_source_src_28000.ds) AS ds__extract_doy , visits_source_src_28000.referrer_id - , DATE_TRUNC(visits_source_src_28000.ds, day) AS visit__ds__day - , DATE_TRUNC(visits_source_src_28000.ds, isoweek) AS visit__ds__week - , DATE_TRUNC(visits_source_src_28000.ds, month) AS visit__ds__month - , DATE_TRUNC(visits_source_src_28000.ds, quarter) AS visit__ds__quarter - , DATE_TRUNC(visits_source_src_28000.ds, year) AS visit__ds__year + , DATETIME_TRUNC(visits_source_src_28000.ds, day) AS visit__ds__day + , DATETIME_TRUNC(visits_source_src_28000.ds, isoweek) AS visit__ds__week + , DATETIME_TRUNC(visits_source_src_28000.ds, month) AS visit__ds__month + , DATETIME_TRUNC(visits_source_src_28000.ds, quarter) AS visit__ds__quarter + , DATETIME_TRUNC(visits_source_src_28000.ds, year) AS visit__ds__year , EXTRACT(year FROM visits_source_src_28000.ds) AS visit__ds__extract_year , EXTRACT(quarter FROM visits_source_src_28000.ds) AS visit__ds__extract_quarter , EXTRACT(month FROM visits_source_src_28000.ds) AS visit__ds__extract_month @@ -195,11 +195,11 @@ FROM ( SELECT 1 AS visits , visits_source_src_28000.user_id AS visitors - , DATE_TRUNC(visits_source_src_28000.ds, day) AS ds__day - , DATE_TRUNC(visits_source_src_28000.ds, isoweek) AS ds__week - , DATE_TRUNC(visits_source_src_28000.ds, month) AS ds__month - , DATE_TRUNC(visits_source_src_28000.ds, quarter) AS ds__quarter - , DATE_TRUNC(visits_source_src_28000.ds, year) AS ds__year + , DATETIME_TRUNC(visits_source_src_28000.ds, day) AS ds__day + , DATETIME_TRUNC(visits_source_src_28000.ds, isoweek) AS ds__week + , DATETIME_TRUNC(visits_source_src_28000.ds, month) AS ds__month + , DATETIME_TRUNC(visits_source_src_28000.ds, quarter) AS ds__quarter + , DATETIME_TRUNC(visits_source_src_28000.ds, year) AS ds__year , EXTRACT(year FROM visits_source_src_28000.ds) AS ds__extract_year , EXTRACT(quarter FROM visits_source_src_28000.ds) AS ds__extract_quarter , EXTRACT(month FROM visits_source_src_28000.ds) AS ds__extract_month @@ -207,11 +207,11 @@ FROM ( , IF(EXTRACT(dayofweek FROM visits_source_src_28000.ds) = 1, 7, EXTRACT(dayofweek FROM visits_source_src_28000.ds) - 1) AS ds__extract_dow , EXTRACT(dayofyear FROM visits_source_src_28000.ds) AS ds__extract_doy , visits_source_src_28000.referrer_id - , DATE_TRUNC(visits_source_src_28000.ds, day) AS visit__ds__day - , DATE_TRUNC(visits_source_src_28000.ds, isoweek) AS visit__ds__week - , DATE_TRUNC(visits_source_src_28000.ds, month) AS visit__ds__month - , DATE_TRUNC(visits_source_src_28000.ds, quarter) AS visit__ds__quarter - , DATE_TRUNC(visits_source_src_28000.ds, year) AS visit__ds__year + , DATETIME_TRUNC(visits_source_src_28000.ds, day) AS visit__ds__day + , DATETIME_TRUNC(visits_source_src_28000.ds, isoweek) AS visit__ds__week + , DATETIME_TRUNC(visits_source_src_28000.ds, month) AS visit__ds__month + , DATETIME_TRUNC(visits_source_src_28000.ds, quarter) AS visit__ds__quarter + , DATETIME_TRUNC(visits_source_src_28000.ds, year) AS visit__ds__year , EXTRACT(year FROM visits_source_src_28000.ds) AS visit__ds__extract_year , EXTRACT(quarter FROM visits_source_src_28000.ds) AS visit__ds__extract_quarter , EXTRACT(month FROM visits_source_src_28000.ds) AS visit__ds__extract_month @@ -317,22 +317,22 @@ FROM ( SELECT 1 AS buys , buys_source_src_28000.user_id AS buyers - , DATE_TRUNC(buys_source_src_28000.ds, day) AS ds__day - , DATE_TRUNC(buys_source_src_28000.ds, isoweek) AS ds__week - , DATE_TRUNC(buys_source_src_28000.ds, month) AS ds__month - , DATE_TRUNC(buys_source_src_28000.ds, quarter) AS ds__quarter - , DATE_TRUNC(buys_source_src_28000.ds, year) AS ds__year + , DATETIME_TRUNC(buys_source_src_28000.ds, day) AS ds__day + , DATETIME_TRUNC(buys_source_src_28000.ds, isoweek) AS ds__week + , DATETIME_TRUNC(buys_source_src_28000.ds, month) AS ds__month + , DATETIME_TRUNC(buys_source_src_28000.ds, quarter) AS ds__quarter + , DATETIME_TRUNC(buys_source_src_28000.ds, year) AS ds__year , EXTRACT(year FROM buys_source_src_28000.ds) AS ds__extract_year , EXTRACT(quarter FROM buys_source_src_28000.ds) AS ds__extract_quarter , EXTRACT(month FROM buys_source_src_28000.ds) AS ds__extract_month , EXTRACT(day FROM buys_source_src_28000.ds) AS ds__extract_day , IF(EXTRACT(dayofweek FROM buys_source_src_28000.ds) = 1, 7, EXTRACT(dayofweek FROM buys_source_src_28000.ds) - 1) AS ds__extract_dow , EXTRACT(dayofyear FROM buys_source_src_28000.ds) AS ds__extract_doy - , DATE_TRUNC(buys_source_src_28000.ds, day) AS buy__ds__day - , DATE_TRUNC(buys_source_src_28000.ds, isoweek) AS buy__ds__week - , DATE_TRUNC(buys_source_src_28000.ds, month) AS buy__ds__month - , DATE_TRUNC(buys_source_src_28000.ds, quarter) AS buy__ds__quarter - , DATE_TRUNC(buys_source_src_28000.ds, year) AS buy__ds__year + , DATETIME_TRUNC(buys_source_src_28000.ds, day) AS buy__ds__day + , DATETIME_TRUNC(buys_source_src_28000.ds, isoweek) AS buy__ds__week + , DATETIME_TRUNC(buys_source_src_28000.ds, month) AS buy__ds__month + , DATETIME_TRUNC(buys_source_src_28000.ds, quarter) AS buy__ds__quarter + , DATETIME_TRUNC(buys_source_src_28000.ds, year) AS buy__ds__year , EXTRACT(year FROM buys_source_src_28000.ds) AS buy__ds__extract_year , EXTRACT(quarter FROM buys_source_src_28000.ds) AS buy__ds__extract_quarter , EXTRACT(month FROM buys_source_src_28000.ds) AS buy__ds__extract_month diff --git a/tests_metricflow/snapshots/test_conversion_metrics_to_sql.py/SqlQueryPlan/BigQuery/test_conversion_count_with_no_group_by__plan0_optimized.sql b/tests_metricflow/snapshots/test_conversion_metrics_to_sql.py/SqlQueryPlan/BigQuery/test_conversion_count_with_no_group_by__plan0_optimized.sql index 41ea6f4248..b277bee163 100644 --- a/tests_metricflow/snapshots/test_conversion_metrics_to_sql.py/SqlQueryPlan/BigQuery/test_conversion_count_with_no_group_by__plan0_optimized.sql +++ b/tests_metricflow/snapshots/test_conversion_metrics_to_sql.py/SqlQueryPlan/BigQuery/test_conversion_count_with_no_group_by__plan0_optimized.sql @@ -51,7 +51,7 @@ CROSS JOIN ( -- Metric Time Dimension 'ds' -- Pass Only Elements: ['visits', 'ds__day', 'user'] SELECT - DATE_TRUNC(ds, day) AS ds__day + DATETIME_TRUNC(ds, day) AS ds__day , user_id AS user , 1 AS visits FROM ***************************.fct_visits visits_source_src_28000 @@ -61,7 +61,7 @@ CROSS JOIN ( -- Metric Time Dimension 'ds' -- Add column with generated UUID SELECT - DATE_TRUNC(ds, day) AS ds__day + DATETIME_TRUNC(ds, day) AS ds__day , user_id AS user , 1 AS buys , GENERATE_UUID() AS mf_internal_uuid diff --git a/tests_metricflow/snapshots/test_conversion_metrics_to_sql.py/SqlQueryPlan/BigQuery/test_conversion_metric_join_to_timespine_and_fill_nulls_with_0__plan0.sql b/tests_metricflow/snapshots/test_conversion_metrics_to_sql.py/SqlQueryPlan/BigQuery/test_conversion_metric_join_to_timespine_and_fill_nulls_with_0__plan0.sql index ce32326609..32577b7a84 100644 --- a/tests_metricflow/snapshots/test_conversion_metrics_to_sql.py/SqlQueryPlan/BigQuery/test_conversion_metric_join_to_timespine_and_fill_nulls_with_0__plan0.sql +++ b/tests_metricflow/snapshots/test_conversion_metrics_to_sql.py/SqlQueryPlan/BigQuery/test_conversion_metric_join_to_timespine_and_fill_nulls_with_0__plan0.sql @@ -78,11 +78,11 @@ FROM ( SELECT 1 AS visits , visits_source_src_28000.user_id AS visitors - , DATE_TRUNC(visits_source_src_28000.ds, day) AS ds__day - , DATE_TRUNC(visits_source_src_28000.ds, isoweek) AS ds__week - , DATE_TRUNC(visits_source_src_28000.ds, month) AS ds__month - , DATE_TRUNC(visits_source_src_28000.ds, quarter) AS ds__quarter - , DATE_TRUNC(visits_source_src_28000.ds, year) AS ds__year + , DATETIME_TRUNC(visits_source_src_28000.ds, day) AS ds__day + , DATETIME_TRUNC(visits_source_src_28000.ds, isoweek) AS ds__week + , DATETIME_TRUNC(visits_source_src_28000.ds, month) AS ds__month + , DATETIME_TRUNC(visits_source_src_28000.ds, quarter) AS ds__quarter + , DATETIME_TRUNC(visits_source_src_28000.ds, year) AS ds__year , EXTRACT(year FROM visits_source_src_28000.ds) AS ds__extract_year , EXTRACT(quarter FROM visits_source_src_28000.ds) AS ds__extract_quarter , EXTRACT(month FROM visits_source_src_28000.ds) AS ds__extract_month @@ -90,11 +90,11 @@ FROM ( , IF(EXTRACT(dayofweek FROM visits_source_src_28000.ds) = 1, 7, EXTRACT(dayofweek FROM visits_source_src_28000.ds) - 1) AS ds__extract_dow , EXTRACT(dayofyear FROM visits_source_src_28000.ds) AS ds__extract_doy , visits_source_src_28000.referrer_id - , DATE_TRUNC(visits_source_src_28000.ds, day) AS visit__ds__day - , DATE_TRUNC(visits_source_src_28000.ds, isoweek) AS visit__ds__week - , DATE_TRUNC(visits_source_src_28000.ds, month) AS visit__ds__month - , DATE_TRUNC(visits_source_src_28000.ds, quarter) AS visit__ds__quarter - , DATE_TRUNC(visits_source_src_28000.ds, year) AS visit__ds__year + , DATETIME_TRUNC(visits_source_src_28000.ds, day) AS visit__ds__day + , DATETIME_TRUNC(visits_source_src_28000.ds, isoweek) AS visit__ds__week + , DATETIME_TRUNC(visits_source_src_28000.ds, month) AS visit__ds__month + , DATETIME_TRUNC(visits_source_src_28000.ds, quarter) AS visit__ds__quarter + , DATETIME_TRUNC(visits_source_src_28000.ds, year) AS visit__ds__year , EXTRACT(year FROM visits_source_src_28000.ds) AS visit__ds__extract_year , EXTRACT(quarter FROM visits_source_src_28000.ds) AS visit__ds__extract_quarter , EXTRACT(month FROM visits_source_src_28000.ds) AS visit__ds__extract_month @@ -238,11 +238,11 @@ FROM ( SELECT 1 AS visits , visits_source_src_28000.user_id AS visitors - , DATE_TRUNC(visits_source_src_28000.ds, day) AS ds__day - , DATE_TRUNC(visits_source_src_28000.ds, isoweek) AS ds__week - , DATE_TRUNC(visits_source_src_28000.ds, month) AS ds__month - , DATE_TRUNC(visits_source_src_28000.ds, quarter) AS ds__quarter - , DATE_TRUNC(visits_source_src_28000.ds, year) AS ds__year + , DATETIME_TRUNC(visits_source_src_28000.ds, day) AS ds__day + , DATETIME_TRUNC(visits_source_src_28000.ds, isoweek) AS ds__week + , DATETIME_TRUNC(visits_source_src_28000.ds, month) AS ds__month + , DATETIME_TRUNC(visits_source_src_28000.ds, quarter) AS ds__quarter + , DATETIME_TRUNC(visits_source_src_28000.ds, year) AS ds__year , EXTRACT(year FROM visits_source_src_28000.ds) AS ds__extract_year , EXTRACT(quarter FROM visits_source_src_28000.ds) AS ds__extract_quarter , EXTRACT(month FROM visits_source_src_28000.ds) AS ds__extract_month @@ -250,11 +250,11 @@ FROM ( , IF(EXTRACT(dayofweek FROM visits_source_src_28000.ds) = 1, 7, EXTRACT(dayofweek FROM visits_source_src_28000.ds) - 1) AS ds__extract_dow , EXTRACT(dayofyear FROM visits_source_src_28000.ds) AS ds__extract_doy , visits_source_src_28000.referrer_id - , DATE_TRUNC(visits_source_src_28000.ds, day) AS visit__ds__day - , DATE_TRUNC(visits_source_src_28000.ds, isoweek) AS visit__ds__week - , DATE_TRUNC(visits_source_src_28000.ds, month) AS visit__ds__month - , DATE_TRUNC(visits_source_src_28000.ds, quarter) AS visit__ds__quarter - , DATE_TRUNC(visits_source_src_28000.ds, year) AS visit__ds__year + , DATETIME_TRUNC(visits_source_src_28000.ds, day) AS visit__ds__day + , DATETIME_TRUNC(visits_source_src_28000.ds, isoweek) AS visit__ds__week + , DATETIME_TRUNC(visits_source_src_28000.ds, month) AS visit__ds__month + , DATETIME_TRUNC(visits_source_src_28000.ds, quarter) AS visit__ds__quarter + , DATETIME_TRUNC(visits_source_src_28000.ds, year) AS visit__ds__year , EXTRACT(year FROM visits_source_src_28000.ds) AS visit__ds__extract_year , EXTRACT(quarter FROM visits_source_src_28000.ds) AS visit__ds__extract_quarter , EXTRACT(month FROM visits_source_src_28000.ds) AS visit__ds__extract_month @@ -360,22 +360,22 @@ FROM ( SELECT 1 AS buys , buys_source_src_28000.user_id AS buyers - , DATE_TRUNC(buys_source_src_28000.ds, day) AS ds__day - , DATE_TRUNC(buys_source_src_28000.ds, isoweek) AS ds__week - , DATE_TRUNC(buys_source_src_28000.ds, month) AS ds__month - , DATE_TRUNC(buys_source_src_28000.ds, quarter) AS ds__quarter - , DATE_TRUNC(buys_source_src_28000.ds, year) AS ds__year + , DATETIME_TRUNC(buys_source_src_28000.ds, day) AS ds__day + , DATETIME_TRUNC(buys_source_src_28000.ds, isoweek) AS ds__week + , DATETIME_TRUNC(buys_source_src_28000.ds, month) AS ds__month + , DATETIME_TRUNC(buys_source_src_28000.ds, quarter) AS ds__quarter + , DATETIME_TRUNC(buys_source_src_28000.ds, year) AS ds__year , EXTRACT(year FROM buys_source_src_28000.ds) AS ds__extract_year , EXTRACT(quarter FROM buys_source_src_28000.ds) AS ds__extract_quarter , EXTRACT(month FROM buys_source_src_28000.ds) AS ds__extract_month , EXTRACT(day FROM buys_source_src_28000.ds) AS ds__extract_day , IF(EXTRACT(dayofweek FROM buys_source_src_28000.ds) = 1, 7, EXTRACT(dayofweek FROM buys_source_src_28000.ds) - 1) AS ds__extract_dow , EXTRACT(dayofyear FROM buys_source_src_28000.ds) AS ds__extract_doy - , DATE_TRUNC(buys_source_src_28000.ds, day) AS buy__ds__day - , DATE_TRUNC(buys_source_src_28000.ds, isoweek) AS buy__ds__week - , DATE_TRUNC(buys_source_src_28000.ds, month) AS buy__ds__month - , DATE_TRUNC(buys_source_src_28000.ds, quarter) AS buy__ds__quarter - , DATE_TRUNC(buys_source_src_28000.ds, year) AS buy__ds__year + , DATETIME_TRUNC(buys_source_src_28000.ds, day) AS buy__ds__day + , DATETIME_TRUNC(buys_source_src_28000.ds, isoweek) AS buy__ds__week + , DATETIME_TRUNC(buys_source_src_28000.ds, month) AS buy__ds__month + , DATETIME_TRUNC(buys_source_src_28000.ds, quarter) AS buy__ds__quarter + , DATETIME_TRUNC(buys_source_src_28000.ds, year) AS buy__ds__year , EXTRACT(year FROM buys_source_src_28000.ds) AS buy__ds__extract_year , EXTRACT(quarter FROM buys_source_src_28000.ds) AS buy__ds__extract_quarter , EXTRACT(month FROM buys_source_src_28000.ds) AS buy__ds__extract_month diff --git a/tests_metricflow/snapshots/test_conversion_metrics_to_sql.py/SqlQueryPlan/BigQuery/test_conversion_metric_join_to_timespine_and_fill_nulls_with_0__plan0_optimized.sql b/tests_metricflow/snapshots/test_conversion_metrics_to_sql.py/SqlQueryPlan/BigQuery/test_conversion_metric_join_to_timespine_and_fill_nulls_with_0__plan0_optimized.sql index 573d14bb4a..04ef683a5d 100644 --- a/tests_metricflow/snapshots/test_conversion_metrics_to_sql.py/SqlQueryPlan/BigQuery/test_conversion_metric_join_to_timespine_and_fill_nulls_with_0__plan0_optimized.sql +++ b/tests_metricflow/snapshots/test_conversion_metrics_to_sql.py/SqlQueryPlan/BigQuery/test_conversion_metric_join_to_timespine_and_fill_nulls_with_0__plan0_optimized.sql @@ -24,7 +24,7 @@ FROM ( -- Metric Time Dimension 'ds' -- Pass Only Elements: ['visits', 'metric_time__day'] SELECT - DATE_TRUNC(ds, day) AS metric_time__day + DATETIME_TRUNC(ds, day) AS metric_time__day , 1 AS visits FROM ***************************.fct_visits visits_source_src_28000 ) subq_23 @@ -89,8 +89,8 @@ FROM ( -- Metric Time Dimension 'ds' -- Pass Only Elements: ['visits', 'ds__day', 'metric_time__day', 'user'] SELECT - DATE_TRUNC(ds, day) AS ds__day - , DATE_TRUNC(ds, day) AS metric_time__day + DATETIME_TRUNC(ds, day) AS ds__day + , DATETIME_TRUNC(ds, day) AS metric_time__day , user_id AS user , 1 AS visits FROM ***************************.fct_visits visits_source_src_28000 @@ -100,7 +100,7 @@ FROM ( -- Metric Time Dimension 'ds' -- Add column with generated UUID SELECT - DATE_TRUNC(ds, day) AS ds__day + DATETIME_TRUNC(ds, day) AS ds__day , user_id AS user , 1 AS buys , GENERATE_UUID() AS mf_internal_uuid diff --git a/tests_metricflow/snapshots/test_conversion_metrics_to_sql.py/SqlQueryPlan/BigQuery/test_conversion_rate__plan0.sql b/tests_metricflow/snapshots/test_conversion_metrics_to_sql.py/SqlQueryPlan/BigQuery/test_conversion_rate__plan0.sql index 167fd6341d..297cc0c6ea 100644 --- a/tests_metricflow/snapshots/test_conversion_metrics_to_sql.py/SqlQueryPlan/BigQuery/test_conversion_rate__plan0.sql +++ b/tests_metricflow/snapshots/test_conversion_metrics_to_sql.py/SqlQueryPlan/BigQuery/test_conversion_rate__plan0.sql @@ -67,11 +67,11 @@ FROM ( SELECT 1 AS visits , visits_source_src_28000.user_id AS visitors - , DATE_TRUNC(visits_source_src_28000.ds, day) AS ds__day - , DATE_TRUNC(visits_source_src_28000.ds, isoweek) AS ds__week - , DATE_TRUNC(visits_source_src_28000.ds, month) AS ds__month - , DATE_TRUNC(visits_source_src_28000.ds, quarter) AS ds__quarter - , DATE_TRUNC(visits_source_src_28000.ds, year) AS ds__year + , DATETIME_TRUNC(visits_source_src_28000.ds, day) AS ds__day + , DATETIME_TRUNC(visits_source_src_28000.ds, isoweek) AS ds__week + , DATETIME_TRUNC(visits_source_src_28000.ds, month) AS ds__month + , DATETIME_TRUNC(visits_source_src_28000.ds, quarter) AS ds__quarter + , DATETIME_TRUNC(visits_source_src_28000.ds, year) AS ds__year , EXTRACT(year FROM visits_source_src_28000.ds) AS ds__extract_year , EXTRACT(quarter FROM visits_source_src_28000.ds) AS ds__extract_quarter , EXTRACT(month FROM visits_source_src_28000.ds) AS ds__extract_month @@ -79,11 +79,11 @@ FROM ( , IF(EXTRACT(dayofweek FROM visits_source_src_28000.ds) = 1, 7, EXTRACT(dayofweek FROM visits_source_src_28000.ds) - 1) AS ds__extract_dow , EXTRACT(dayofyear FROM visits_source_src_28000.ds) AS ds__extract_doy , visits_source_src_28000.referrer_id - , DATE_TRUNC(visits_source_src_28000.ds, day) AS visit__ds__day - , DATE_TRUNC(visits_source_src_28000.ds, isoweek) AS visit__ds__week - , DATE_TRUNC(visits_source_src_28000.ds, month) AS visit__ds__month - , DATE_TRUNC(visits_source_src_28000.ds, quarter) AS visit__ds__quarter - , DATE_TRUNC(visits_source_src_28000.ds, year) AS visit__ds__year + , DATETIME_TRUNC(visits_source_src_28000.ds, day) AS visit__ds__day + , DATETIME_TRUNC(visits_source_src_28000.ds, isoweek) AS visit__ds__week + , DATETIME_TRUNC(visits_source_src_28000.ds, month) AS visit__ds__month + , DATETIME_TRUNC(visits_source_src_28000.ds, quarter) AS visit__ds__quarter + , DATETIME_TRUNC(visits_source_src_28000.ds, year) AS visit__ds__year , EXTRACT(year FROM visits_source_src_28000.ds) AS visit__ds__extract_year , EXTRACT(quarter FROM visits_source_src_28000.ds) AS visit__ds__extract_quarter , EXTRACT(month FROM visits_source_src_28000.ds) AS visit__ds__extract_month @@ -213,11 +213,11 @@ FROM ( SELECT 1 AS visits , visits_source_src_28000.user_id AS visitors - , DATE_TRUNC(visits_source_src_28000.ds, day) AS ds__day - , DATE_TRUNC(visits_source_src_28000.ds, isoweek) AS ds__week - , DATE_TRUNC(visits_source_src_28000.ds, month) AS ds__month - , DATE_TRUNC(visits_source_src_28000.ds, quarter) AS ds__quarter - , DATE_TRUNC(visits_source_src_28000.ds, year) AS ds__year + , DATETIME_TRUNC(visits_source_src_28000.ds, day) AS ds__day + , DATETIME_TRUNC(visits_source_src_28000.ds, isoweek) AS ds__week + , DATETIME_TRUNC(visits_source_src_28000.ds, month) AS ds__month + , DATETIME_TRUNC(visits_source_src_28000.ds, quarter) AS ds__quarter + , DATETIME_TRUNC(visits_source_src_28000.ds, year) AS ds__year , EXTRACT(year FROM visits_source_src_28000.ds) AS ds__extract_year , EXTRACT(quarter FROM visits_source_src_28000.ds) AS ds__extract_quarter , EXTRACT(month FROM visits_source_src_28000.ds) AS ds__extract_month @@ -225,11 +225,11 @@ FROM ( , IF(EXTRACT(dayofweek FROM visits_source_src_28000.ds) = 1, 7, EXTRACT(dayofweek FROM visits_source_src_28000.ds) - 1) AS ds__extract_dow , EXTRACT(dayofyear FROM visits_source_src_28000.ds) AS ds__extract_doy , visits_source_src_28000.referrer_id - , DATE_TRUNC(visits_source_src_28000.ds, day) AS visit__ds__day - , DATE_TRUNC(visits_source_src_28000.ds, isoweek) AS visit__ds__week - , DATE_TRUNC(visits_source_src_28000.ds, month) AS visit__ds__month - , DATE_TRUNC(visits_source_src_28000.ds, quarter) AS visit__ds__quarter - , DATE_TRUNC(visits_source_src_28000.ds, year) AS visit__ds__year + , DATETIME_TRUNC(visits_source_src_28000.ds, day) AS visit__ds__day + , DATETIME_TRUNC(visits_source_src_28000.ds, isoweek) AS visit__ds__week + , DATETIME_TRUNC(visits_source_src_28000.ds, month) AS visit__ds__month + , DATETIME_TRUNC(visits_source_src_28000.ds, quarter) AS visit__ds__quarter + , DATETIME_TRUNC(visits_source_src_28000.ds, year) AS visit__ds__year , EXTRACT(year FROM visits_source_src_28000.ds) AS visit__ds__extract_year , EXTRACT(quarter FROM visits_source_src_28000.ds) AS visit__ds__extract_quarter , EXTRACT(month FROM visits_source_src_28000.ds) AS visit__ds__extract_month @@ -335,22 +335,22 @@ FROM ( SELECT 1 AS buys , buys_source_src_28000.user_id AS buyers - , DATE_TRUNC(buys_source_src_28000.ds, day) AS ds__day - , DATE_TRUNC(buys_source_src_28000.ds, isoweek) AS ds__week - , DATE_TRUNC(buys_source_src_28000.ds, month) AS ds__month - , DATE_TRUNC(buys_source_src_28000.ds, quarter) AS ds__quarter - , DATE_TRUNC(buys_source_src_28000.ds, year) AS ds__year + , DATETIME_TRUNC(buys_source_src_28000.ds, day) AS ds__day + , DATETIME_TRUNC(buys_source_src_28000.ds, isoweek) AS ds__week + , DATETIME_TRUNC(buys_source_src_28000.ds, month) AS ds__month + , DATETIME_TRUNC(buys_source_src_28000.ds, quarter) AS ds__quarter + , DATETIME_TRUNC(buys_source_src_28000.ds, year) AS ds__year , EXTRACT(year FROM buys_source_src_28000.ds) AS ds__extract_year , EXTRACT(quarter FROM buys_source_src_28000.ds) AS ds__extract_quarter , EXTRACT(month FROM buys_source_src_28000.ds) AS ds__extract_month , EXTRACT(day FROM buys_source_src_28000.ds) AS ds__extract_day , IF(EXTRACT(dayofweek FROM buys_source_src_28000.ds) = 1, 7, EXTRACT(dayofweek FROM buys_source_src_28000.ds) - 1) AS ds__extract_dow , EXTRACT(dayofyear FROM buys_source_src_28000.ds) AS ds__extract_doy - , DATE_TRUNC(buys_source_src_28000.ds, day) AS buy__ds__day - , DATE_TRUNC(buys_source_src_28000.ds, isoweek) AS buy__ds__week - , DATE_TRUNC(buys_source_src_28000.ds, month) AS buy__ds__month - , DATE_TRUNC(buys_source_src_28000.ds, quarter) AS buy__ds__quarter - , DATE_TRUNC(buys_source_src_28000.ds, year) AS buy__ds__year + , DATETIME_TRUNC(buys_source_src_28000.ds, day) AS buy__ds__day + , DATETIME_TRUNC(buys_source_src_28000.ds, isoweek) AS buy__ds__week + , DATETIME_TRUNC(buys_source_src_28000.ds, month) AS buy__ds__month + , DATETIME_TRUNC(buys_source_src_28000.ds, quarter) AS buy__ds__quarter + , DATETIME_TRUNC(buys_source_src_28000.ds, year) AS buy__ds__year , EXTRACT(year FROM buys_source_src_28000.ds) AS buy__ds__extract_year , EXTRACT(quarter FROM buys_source_src_28000.ds) AS buy__ds__extract_quarter , EXTRACT(month FROM buys_source_src_28000.ds) AS buy__ds__extract_month diff --git a/tests_metricflow/snapshots/test_conversion_metrics_to_sql.py/SqlQueryPlan/BigQuery/test_conversion_rate__plan0_optimized.sql b/tests_metricflow/snapshots/test_conversion_metrics_to_sql.py/SqlQueryPlan/BigQuery/test_conversion_rate__plan0_optimized.sql index e87eca744a..86ef055208 100644 --- a/tests_metricflow/snapshots/test_conversion_metrics_to_sql.py/SqlQueryPlan/BigQuery/test_conversion_rate__plan0_optimized.sql +++ b/tests_metricflow/snapshots/test_conversion_metrics_to_sql.py/SqlQueryPlan/BigQuery/test_conversion_rate__plan0_optimized.sql @@ -74,7 +74,7 @@ FROM ( -- Metric Time Dimension 'ds' -- Pass Only Elements: ['visits', 'visit__referrer_id', 'ds__day', 'user'] SELECT - DATE_TRUNC(ds, day) AS ds__day + DATETIME_TRUNC(ds, day) AS ds__day , user_id AS user , referrer_id AS visit__referrer_id , 1 AS visits @@ -85,7 +85,7 @@ FROM ( -- Metric Time Dimension 'ds' -- Add column with generated UUID SELECT - DATE_TRUNC(ds, day) AS ds__day + DATETIME_TRUNC(ds, day) AS ds__day , user_id AS user , 1 AS buys , GENERATE_UUID() AS mf_internal_uuid diff --git a/tests_metricflow/snapshots/test_conversion_metrics_to_sql.py/SqlQueryPlan/BigQuery/test_conversion_rate_with_constant_properties__plan0.sql b/tests_metricflow/snapshots/test_conversion_metrics_to_sql.py/SqlQueryPlan/BigQuery/test_conversion_rate_with_constant_properties__plan0.sql index 865afbdc22..d552d66a9b 100644 --- a/tests_metricflow/snapshots/test_conversion_metrics_to_sql.py/SqlQueryPlan/BigQuery/test_conversion_rate_with_constant_properties__plan0.sql +++ b/tests_metricflow/snapshots/test_conversion_metrics_to_sql.py/SqlQueryPlan/BigQuery/test_conversion_rate_with_constant_properties__plan0.sql @@ -71,11 +71,11 @@ FROM ( SELECT 1 AS visits , visits_source_src_28000.user_id AS visitors - , DATE_TRUNC(visits_source_src_28000.ds, day) AS ds__day - , DATE_TRUNC(visits_source_src_28000.ds, isoweek) AS ds__week - , DATE_TRUNC(visits_source_src_28000.ds, month) AS ds__month - , DATE_TRUNC(visits_source_src_28000.ds, quarter) AS ds__quarter - , DATE_TRUNC(visits_source_src_28000.ds, year) AS ds__year + , DATETIME_TRUNC(visits_source_src_28000.ds, day) AS ds__day + , DATETIME_TRUNC(visits_source_src_28000.ds, isoweek) AS ds__week + , DATETIME_TRUNC(visits_source_src_28000.ds, month) AS ds__month + , DATETIME_TRUNC(visits_source_src_28000.ds, quarter) AS ds__quarter + , DATETIME_TRUNC(visits_source_src_28000.ds, year) AS ds__year , EXTRACT(year FROM visits_source_src_28000.ds) AS ds__extract_year , EXTRACT(quarter FROM visits_source_src_28000.ds) AS ds__extract_quarter , EXTRACT(month FROM visits_source_src_28000.ds) AS ds__extract_month @@ -83,11 +83,11 @@ FROM ( , IF(EXTRACT(dayofweek FROM visits_source_src_28000.ds) = 1, 7, EXTRACT(dayofweek FROM visits_source_src_28000.ds) - 1) AS ds__extract_dow , EXTRACT(dayofyear FROM visits_source_src_28000.ds) AS ds__extract_doy , visits_source_src_28000.referrer_id - , DATE_TRUNC(visits_source_src_28000.ds, day) AS visit__ds__day - , DATE_TRUNC(visits_source_src_28000.ds, isoweek) AS visit__ds__week - , DATE_TRUNC(visits_source_src_28000.ds, month) AS visit__ds__month - , DATE_TRUNC(visits_source_src_28000.ds, quarter) AS visit__ds__quarter - , DATE_TRUNC(visits_source_src_28000.ds, year) AS visit__ds__year + , DATETIME_TRUNC(visits_source_src_28000.ds, day) AS visit__ds__day + , DATETIME_TRUNC(visits_source_src_28000.ds, isoweek) AS visit__ds__week + , DATETIME_TRUNC(visits_source_src_28000.ds, month) AS visit__ds__month + , DATETIME_TRUNC(visits_source_src_28000.ds, quarter) AS visit__ds__quarter + , DATETIME_TRUNC(visits_source_src_28000.ds, year) AS visit__ds__year , EXTRACT(year FROM visits_source_src_28000.ds) AS visit__ds__extract_year , EXTRACT(quarter FROM visits_source_src_28000.ds) AS visit__ds__extract_quarter , EXTRACT(month FROM visits_source_src_28000.ds) AS visit__ds__extract_month @@ -246,11 +246,11 @@ FROM ( SELECT 1 AS visits , visits_source_src_28000.user_id AS visitors - , DATE_TRUNC(visits_source_src_28000.ds, day) AS ds__day - , DATE_TRUNC(visits_source_src_28000.ds, isoweek) AS ds__week - , DATE_TRUNC(visits_source_src_28000.ds, month) AS ds__month - , DATE_TRUNC(visits_source_src_28000.ds, quarter) AS ds__quarter - , DATE_TRUNC(visits_source_src_28000.ds, year) AS ds__year + , DATETIME_TRUNC(visits_source_src_28000.ds, day) AS ds__day + , DATETIME_TRUNC(visits_source_src_28000.ds, isoweek) AS ds__week + , DATETIME_TRUNC(visits_source_src_28000.ds, month) AS ds__month + , DATETIME_TRUNC(visits_source_src_28000.ds, quarter) AS ds__quarter + , DATETIME_TRUNC(visits_source_src_28000.ds, year) AS ds__year , EXTRACT(year FROM visits_source_src_28000.ds) AS ds__extract_year , EXTRACT(quarter FROM visits_source_src_28000.ds) AS ds__extract_quarter , EXTRACT(month FROM visits_source_src_28000.ds) AS ds__extract_month @@ -258,11 +258,11 @@ FROM ( , IF(EXTRACT(dayofweek FROM visits_source_src_28000.ds) = 1, 7, EXTRACT(dayofweek FROM visits_source_src_28000.ds) - 1) AS ds__extract_dow , EXTRACT(dayofyear FROM visits_source_src_28000.ds) AS ds__extract_doy , visits_source_src_28000.referrer_id - , DATE_TRUNC(visits_source_src_28000.ds, day) AS visit__ds__day - , DATE_TRUNC(visits_source_src_28000.ds, isoweek) AS visit__ds__week - , DATE_TRUNC(visits_source_src_28000.ds, month) AS visit__ds__month - , DATE_TRUNC(visits_source_src_28000.ds, quarter) AS visit__ds__quarter - , DATE_TRUNC(visits_source_src_28000.ds, year) AS visit__ds__year + , DATETIME_TRUNC(visits_source_src_28000.ds, day) AS visit__ds__day + , DATETIME_TRUNC(visits_source_src_28000.ds, isoweek) AS visit__ds__week + , DATETIME_TRUNC(visits_source_src_28000.ds, month) AS visit__ds__month + , DATETIME_TRUNC(visits_source_src_28000.ds, quarter) AS visit__ds__quarter + , DATETIME_TRUNC(visits_source_src_28000.ds, year) AS visit__ds__year , EXTRACT(year FROM visits_source_src_28000.ds) AS visit__ds__extract_year , EXTRACT(quarter FROM visits_source_src_28000.ds) AS visit__ds__extract_quarter , EXTRACT(month FROM visits_source_src_28000.ds) AS visit__ds__extract_month @@ -368,22 +368,22 @@ FROM ( SELECT 1 AS buys , buys_source_src_28000.user_id AS buyers - , DATE_TRUNC(buys_source_src_28000.ds, day) AS ds__day - , DATE_TRUNC(buys_source_src_28000.ds, isoweek) AS ds__week - , DATE_TRUNC(buys_source_src_28000.ds, month) AS ds__month - , DATE_TRUNC(buys_source_src_28000.ds, quarter) AS ds__quarter - , DATE_TRUNC(buys_source_src_28000.ds, year) AS ds__year + , DATETIME_TRUNC(buys_source_src_28000.ds, day) AS ds__day + , DATETIME_TRUNC(buys_source_src_28000.ds, isoweek) AS ds__week + , DATETIME_TRUNC(buys_source_src_28000.ds, month) AS ds__month + , DATETIME_TRUNC(buys_source_src_28000.ds, quarter) AS ds__quarter + , DATETIME_TRUNC(buys_source_src_28000.ds, year) AS ds__year , EXTRACT(year FROM buys_source_src_28000.ds) AS ds__extract_year , EXTRACT(quarter FROM buys_source_src_28000.ds) AS ds__extract_quarter , EXTRACT(month FROM buys_source_src_28000.ds) AS ds__extract_month , EXTRACT(day FROM buys_source_src_28000.ds) AS ds__extract_day , IF(EXTRACT(dayofweek FROM buys_source_src_28000.ds) = 1, 7, EXTRACT(dayofweek FROM buys_source_src_28000.ds) - 1) AS ds__extract_dow , EXTRACT(dayofyear FROM buys_source_src_28000.ds) AS ds__extract_doy - , DATE_TRUNC(buys_source_src_28000.ds, day) AS buy__ds__day - , DATE_TRUNC(buys_source_src_28000.ds, isoweek) AS buy__ds__week - , DATE_TRUNC(buys_source_src_28000.ds, month) AS buy__ds__month - , DATE_TRUNC(buys_source_src_28000.ds, quarter) AS buy__ds__quarter - , DATE_TRUNC(buys_source_src_28000.ds, year) AS buy__ds__year + , DATETIME_TRUNC(buys_source_src_28000.ds, day) AS buy__ds__day + , DATETIME_TRUNC(buys_source_src_28000.ds, isoweek) AS buy__ds__week + , DATETIME_TRUNC(buys_source_src_28000.ds, month) AS buy__ds__month + , DATETIME_TRUNC(buys_source_src_28000.ds, quarter) AS buy__ds__quarter + , DATETIME_TRUNC(buys_source_src_28000.ds, year) AS buy__ds__year , EXTRACT(year FROM buys_source_src_28000.ds) AS buy__ds__extract_year , EXTRACT(quarter FROM buys_source_src_28000.ds) AS buy__ds__extract_quarter , EXTRACT(month FROM buys_source_src_28000.ds) AS buy__ds__extract_month diff --git a/tests_metricflow/snapshots/test_conversion_metrics_to_sql.py/SqlQueryPlan/BigQuery/test_conversion_rate_with_constant_properties__plan0_optimized.sql b/tests_metricflow/snapshots/test_conversion_metrics_to_sql.py/SqlQueryPlan/BigQuery/test_conversion_rate_with_constant_properties__plan0_optimized.sql index 253fba91e7..b6de87e9d0 100644 --- a/tests_metricflow/snapshots/test_conversion_metrics_to_sql.py/SqlQueryPlan/BigQuery/test_conversion_rate_with_constant_properties__plan0_optimized.sql +++ b/tests_metricflow/snapshots/test_conversion_metrics_to_sql.py/SqlQueryPlan/BigQuery/test_conversion_rate_with_constant_properties__plan0_optimized.sql @@ -21,7 +21,7 @@ FROM ( -- Metric Time Dimension 'ds' -- Pass Only Elements: ['visits', 'visit__referrer_id', 'metric_time__day'] SELECT - DATE_TRUNC(ds, day) AS metric_time__day + DATETIME_TRUNC(ds, day) AS metric_time__day , referrer_id AS visit__referrer_id , 1 AS visits FROM ***************************.fct_visits visits_source_src_28000 @@ -102,8 +102,8 @@ FROM ( -- Metric Time Dimension 'ds' -- Pass Only Elements: ['visits', 'visit__referrer_id', 'ds__day', 'metric_time__day', 'user', 'session'] SELECT - DATE_TRUNC(ds, day) AS ds__day - , DATE_TRUNC(ds, day) AS metric_time__day + DATETIME_TRUNC(ds, day) AS ds__day + , DATETIME_TRUNC(ds, day) AS metric_time__day , user_id AS user , session_id AS session , referrer_id AS visit__referrer_id @@ -115,7 +115,7 @@ FROM ( -- Metric Time Dimension 'ds' -- Add column with generated UUID SELECT - DATE_TRUNC(ds, day) AS ds__day + DATETIME_TRUNC(ds, day) AS ds__day , user_id AS user , session_id , 1 AS buys diff --git a/tests_metricflow/snapshots/test_conversion_metrics_to_sql.py/SqlQueryPlan/BigQuery/test_conversion_rate_with_no_group_by__plan0.sql b/tests_metricflow/snapshots/test_conversion_metrics_to_sql.py/SqlQueryPlan/BigQuery/test_conversion_rate_with_no_group_by__plan0.sql index 1b8ec12976..c7e426d48c 100644 --- a/tests_metricflow/snapshots/test_conversion_metrics_to_sql.py/SqlQueryPlan/BigQuery/test_conversion_rate_with_no_group_by__plan0.sql +++ b/tests_metricflow/snapshots/test_conversion_metrics_to_sql.py/SqlQueryPlan/BigQuery/test_conversion_rate_with_no_group_by__plan0.sql @@ -63,11 +63,11 @@ FROM ( SELECT 1 AS visits , visits_source_src_28000.user_id AS visitors - , DATE_TRUNC(visits_source_src_28000.ds, day) AS ds__day - , DATE_TRUNC(visits_source_src_28000.ds, isoweek) AS ds__week - , DATE_TRUNC(visits_source_src_28000.ds, month) AS ds__month - , DATE_TRUNC(visits_source_src_28000.ds, quarter) AS ds__quarter - , DATE_TRUNC(visits_source_src_28000.ds, year) AS ds__year + , DATETIME_TRUNC(visits_source_src_28000.ds, day) AS ds__day + , DATETIME_TRUNC(visits_source_src_28000.ds, isoweek) AS ds__week + , DATETIME_TRUNC(visits_source_src_28000.ds, month) AS ds__month + , DATETIME_TRUNC(visits_source_src_28000.ds, quarter) AS ds__quarter + , DATETIME_TRUNC(visits_source_src_28000.ds, year) AS ds__year , EXTRACT(year FROM visits_source_src_28000.ds) AS ds__extract_year , EXTRACT(quarter FROM visits_source_src_28000.ds) AS ds__extract_quarter , EXTRACT(month FROM visits_source_src_28000.ds) AS ds__extract_month @@ -75,11 +75,11 @@ FROM ( , IF(EXTRACT(dayofweek FROM visits_source_src_28000.ds) = 1, 7, EXTRACT(dayofweek FROM visits_source_src_28000.ds) - 1) AS ds__extract_dow , EXTRACT(dayofyear FROM visits_source_src_28000.ds) AS ds__extract_doy , visits_source_src_28000.referrer_id - , DATE_TRUNC(visits_source_src_28000.ds, day) AS visit__ds__day - , DATE_TRUNC(visits_source_src_28000.ds, isoweek) AS visit__ds__week - , DATE_TRUNC(visits_source_src_28000.ds, month) AS visit__ds__month - , DATE_TRUNC(visits_source_src_28000.ds, quarter) AS visit__ds__quarter - , DATE_TRUNC(visits_source_src_28000.ds, year) AS visit__ds__year + , DATETIME_TRUNC(visits_source_src_28000.ds, day) AS visit__ds__day + , DATETIME_TRUNC(visits_source_src_28000.ds, isoweek) AS visit__ds__week + , DATETIME_TRUNC(visits_source_src_28000.ds, month) AS visit__ds__month + , DATETIME_TRUNC(visits_source_src_28000.ds, quarter) AS visit__ds__quarter + , DATETIME_TRUNC(visits_source_src_28000.ds, year) AS visit__ds__year , EXTRACT(year FROM visits_source_src_28000.ds) AS visit__ds__extract_year , EXTRACT(quarter FROM visits_source_src_28000.ds) AS visit__ds__extract_quarter , EXTRACT(month FROM visits_source_src_28000.ds) AS visit__ds__extract_month @@ -195,11 +195,11 @@ FROM ( SELECT 1 AS visits , visits_source_src_28000.user_id AS visitors - , DATE_TRUNC(visits_source_src_28000.ds, day) AS ds__day - , DATE_TRUNC(visits_source_src_28000.ds, isoweek) AS ds__week - , DATE_TRUNC(visits_source_src_28000.ds, month) AS ds__month - , DATE_TRUNC(visits_source_src_28000.ds, quarter) AS ds__quarter - , DATE_TRUNC(visits_source_src_28000.ds, year) AS ds__year + , DATETIME_TRUNC(visits_source_src_28000.ds, day) AS ds__day + , DATETIME_TRUNC(visits_source_src_28000.ds, isoweek) AS ds__week + , DATETIME_TRUNC(visits_source_src_28000.ds, month) AS ds__month + , DATETIME_TRUNC(visits_source_src_28000.ds, quarter) AS ds__quarter + , DATETIME_TRUNC(visits_source_src_28000.ds, year) AS ds__year , EXTRACT(year FROM visits_source_src_28000.ds) AS ds__extract_year , EXTRACT(quarter FROM visits_source_src_28000.ds) AS ds__extract_quarter , EXTRACT(month FROM visits_source_src_28000.ds) AS ds__extract_month @@ -207,11 +207,11 @@ FROM ( , IF(EXTRACT(dayofweek FROM visits_source_src_28000.ds) = 1, 7, EXTRACT(dayofweek FROM visits_source_src_28000.ds) - 1) AS ds__extract_dow , EXTRACT(dayofyear FROM visits_source_src_28000.ds) AS ds__extract_doy , visits_source_src_28000.referrer_id - , DATE_TRUNC(visits_source_src_28000.ds, day) AS visit__ds__day - , DATE_TRUNC(visits_source_src_28000.ds, isoweek) AS visit__ds__week - , DATE_TRUNC(visits_source_src_28000.ds, month) AS visit__ds__month - , DATE_TRUNC(visits_source_src_28000.ds, quarter) AS visit__ds__quarter - , DATE_TRUNC(visits_source_src_28000.ds, year) AS visit__ds__year + , DATETIME_TRUNC(visits_source_src_28000.ds, day) AS visit__ds__day + , DATETIME_TRUNC(visits_source_src_28000.ds, isoweek) AS visit__ds__week + , DATETIME_TRUNC(visits_source_src_28000.ds, month) AS visit__ds__month + , DATETIME_TRUNC(visits_source_src_28000.ds, quarter) AS visit__ds__quarter + , DATETIME_TRUNC(visits_source_src_28000.ds, year) AS visit__ds__year , EXTRACT(year FROM visits_source_src_28000.ds) AS visit__ds__extract_year , EXTRACT(quarter FROM visits_source_src_28000.ds) AS visit__ds__extract_quarter , EXTRACT(month FROM visits_source_src_28000.ds) AS visit__ds__extract_month @@ -317,22 +317,22 @@ FROM ( SELECT 1 AS buys , buys_source_src_28000.user_id AS buyers - , DATE_TRUNC(buys_source_src_28000.ds, day) AS ds__day - , DATE_TRUNC(buys_source_src_28000.ds, isoweek) AS ds__week - , DATE_TRUNC(buys_source_src_28000.ds, month) AS ds__month - , DATE_TRUNC(buys_source_src_28000.ds, quarter) AS ds__quarter - , DATE_TRUNC(buys_source_src_28000.ds, year) AS ds__year + , DATETIME_TRUNC(buys_source_src_28000.ds, day) AS ds__day + , DATETIME_TRUNC(buys_source_src_28000.ds, isoweek) AS ds__week + , DATETIME_TRUNC(buys_source_src_28000.ds, month) AS ds__month + , DATETIME_TRUNC(buys_source_src_28000.ds, quarter) AS ds__quarter + , DATETIME_TRUNC(buys_source_src_28000.ds, year) AS ds__year , EXTRACT(year FROM buys_source_src_28000.ds) AS ds__extract_year , EXTRACT(quarter FROM buys_source_src_28000.ds) AS ds__extract_quarter , EXTRACT(month FROM buys_source_src_28000.ds) AS ds__extract_month , EXTRACT(day FROM buys_source_src_28000.ds) AS ds__extract_day , IF(EXTRACT(dayofweek FROM buys_source_src_28000.ds) = 1, 7, EXTRACT(dayofweek FROM buys_source_src_28000.ds) - 1) AS ds__extract_dow , EXTRACT(dayofyear FROM buys_source_src_28000.ds) AS ds__extract_doy - , DATE_TRUNC(buys_source_src_28000.ds, day) AS buy__ds__day - , DATE_TRUNC(buys_source_src_28000.ds, isoweek) AS buy__ds__week - , DATE_TRUNC(buys_source_src_28000.ds, month) AS buy__ds__month - , DATE_TRUNC(buys_source_src_28000.ds, quarter) AS buy__ds__quarter - , DATE_TRUNC(buys_source_src_28000.ds, year) AS buy__ds__year + , DATETIME_TRUNC(buys_source_src_28000.ds, day) AS buy__ds__day + , DATETIME_TRUNC(buys_source_src_28000.ds, isoweek) AS buy__ds__week + , DATETIME_TRUNC(buys_source_src_28000.ds, month) AS buy__ds__month + , DATETIME_TRUNC(buys_source_src_28000.ds, quarter) AS buy__ds__quarter + , DATETIME_TRUNC(buys_source_src_28000.ds, year) AS buy__ds__year , EXTRACT(year FROM buys_source_src_28000.ds) AS buy__ds__extract_year , EXTRACT(quarter FROM buys_source_src_28000.ds) AS buy__ds__extract_quarter , EXTRACT(month FROM buys_source_src_28000.ds) AS buy__ds__extract_month diff --git a/tests_metricflow/snapshots/test_conversion_metrics_to_sql.py/SqlQueryPlan/BigQuery/test_conversion_rate_with_no_group_by__plan0_optimized.sql b/tests_metricflow/snapshots/test_conversion_metrics_to_sql.py/SqlQueryPlan/BigQuery/test_conversion_rate_with_no_group_by__plan0_optimized.sql index 6cefd76071..600310bc17 100644 --- a/tests_metricflow/snapshots/test_conversion_metrics_to_sql.py/SqlQueryPlan/BigQuery/test_conversion_rate_with_no_group_by__plan0_optimized.sql +++ b/tests_metricflow/snapshots/test_conversion_metrics_to_sql.py/SqlQueryPlan/BigQuery/test_conversion_rate_with_no_group_by__plan0_optimized.sql @@ -51,7 +51,7 @@ CROSS JOIN ( -- Metric Time Dimension 'ds' -- Pass Only Elements: ['visits', 'ds__day', 'user'] SELECT - DATE_TRUNC(ds, day) AS ds__day + DATETIME_TRUNC(ds, day) AS ds__day , user_id AS user , 1 AS visits FROM ***************************.fct_visits visits_source_src_28000 @@ -61,7 +61,7 @@ CROSS JOIN ( -- Metric Time Dimension 'ds' -- Add column with generated UUID SELECT - DATE_TRUNC(ds, day) AS ds__day + DATETIME_TRUNC(ds, day) AS ds__day , user_id AS user , 1 AS buys , GENERATE_UUID() AS mf_internal_uuid diff --git a/tests_metricflow/snapshots/test_conversion_metrics_to_sql.py/SqlQueryPlan/BigQuery/test_conversion_rate_with_window__plan0.sql b/tests_metricflow/snapshots/test_conversion_metrics_to_sql.py/SqlQueryPlan/BigQuery/test_conversion_rate_with_window__plan0.sql index 8f7623dfc2..702e8c2c6f 100644 --- a/tests_metricflow/snapshots/test_conversion_metrics_to_sql.py/SqlQueryPlan/BigQuery/test_conversion_rate_with_window__plan0.sql +++ b/tests_metricflow/snapshots/test_conversion_metrics_to_sql.py/SqlQueryPlan/BigQuery/test_conversion_rate_with_window__plan0.sql @@ -71,11 +71,11 @@ FROM ( SELECT 1 AS visits , visits_source_src_28000.user_id AS visitors - , DATE_TRUNC(visits_source_src_28000.ds, day) AS ds__day - , DATE_TRUNC(visits_source_src_28000.ds, isoweek) AS ds__week - , DATE_TRUNC(visits_source_src_28000.ds, month) AS ds__month - , DATE_TRUNC(visits_source_src_28000.ds, quarter) AS ds__quarter - , DATE_TRUNC(visits_source_src_28000.ds, year) AS ds__year + , DATETIME_TRUNC(visits_source_src_28000.ds, day) AS ds__day + , DATETIME_TRUNC(visits_source_src_28000.ds, isoweek) AS ds__week + , DATETIME_TRUNC(visits_source_src_28000.ds, month) AS ds__month + , DATETIME_TRUNC(visits_source_src_28000.ds, quarter) AS ds__quarter + , DATETIME_TRUNC(visits_source_src_28000.ds, year) AS ds__year , EXTRACT(year FROM visits_source_src_28000.ds) AS ds__extract_year , EXTRACT(quarter FROM visits_source_src_28000.ds) AS ds__extract_quarter , EXTRACT(month FROM visits_source_src_28000.ds) AS ds__extract_month @@ -83,11 +83,11 @@ FROM ( , IF(EXTRACT(dayofweek FROM visits_source_src_28000.ds) = 1, 7, EXTRACT(dayofweek FROM visits_source_src_28000.ds) - 1) AS ds__extract_dow , EXTRACT(dayofyear FROM visits_source_src_28000.ds) AS ds__extract_doy , visits_source_src_28000.referrer_id - , DATE_TRUNC(visits_source_src_28000.ds, day) AS visit__ds__day - , DATE_TRUNC(visits_source_src_28000.ds, isoweek) AS visit__ds__week - , DATE_TRUNC(visits_source_src_28000.ds, month) AS visit__ds__month - , DATE_TRUNC(visits_source_src_28000.ds, quarter) AS visit__ds__quarter - , DATE_TRUNC(visits_source_src_28000.ds, year) AS visit__ds__year + , DATETIME_TRUNC(visits_source_src_28000.ds, day) AS visit__ds__day + , DATETIME_TRUNC(visits_source_src_28000.ds, isoweek) AS visit__ds__week + , DATETIME_TRUNC(visits_source_src_28000.ds, month) AS visit__ds__month + , DATETIME_TRUNC(visits_source_src_28000.ds, quarter) AS visit__ds__quarter + , DATETIME_TRUNC(visits_source_src_28000.ds, year) AS visit__ds__year , EXTRACT(year FROM visits_source_src_28000.ds) AS visit__ds__extract_year , EXTRACT(quarter FROM visits_source_src_28000.ds) AS visit__ds__extract_quarter , EXTRACT(month FROM visits_source_src_28000.ds) AS visit__ds__extract_month @@ -230,11 +230,11 @@ FROM ( SELECT 1 AS visits , visits_source_src_28000.user_id AS visitors - , DATE_TRUNC(visits_source_src_28000.ds, day) AS ds__day - , DATE_TRUNC(visits_source_src_28000.ds, isoweek) AS ds__week - , DATE_TRUNC(visits_source_src_28000.ds, month) AS ds__month - , DATE_TRUNC(visits_source_src_28000.ds, quarter) AS ds__quarter - , DATE_TRUNC(visits_source_src_28000.ds, year) AS ds__year + , DATETIME_TRUNC(visits_source_src_28000.ds, day) AS ds__day + , DATETIME_TRUNC(visits_source_src_28000.ds, isoweek) AS ds__week + , DATETIME_TRUNC(visits_source_src_28000.ds, month) AS ds__month + , DATETIME_TRUNC(visits_source_src_28000.ds, quarter) AS ds__quarter + , DATETIME_TRUNC(visits_source_src_28000.ds, year) AS ds__year , EXTRACT(year FROM visits_source_src_28000.ds) AS ds__extract_year , EXTRACT(quarter FROM visits_source_src_28000.ds) AS ds__extract_quarter , EXTRACT(month FROM visits_source_src_28000.ds) AS ds__extract_month @@ -242,11 +242,11 @@ FROM ( , IF(EXTRACT(dayofweek FROM visits_source_src_28000.ds) = 1, 7, EXTRACT(dayofweek FROM visits_source_src_28000.ds) - 1) AS ds__extract_dow , EXTRACT(dayofyear FROM visits_source_src_28000.ds) AS ds__extract_doy , visits_source_src_28000.referrer_id - , DATE_TRUNC(visits_source_src_28000.ds, day) AS visit__ds__day - , DATE_TRUNC(visits_source_src_28000.ds, isoweek) AS visit__ds__week - , DATE_TRUNC(visits_source_src_28000.ds, month) AS visit__ds__month - , DATE_TRUNC(visits_source_src_28000.ds, quarter) AS visit__ds__quarter - , DATE_TRUNC(visits_source_src_28000.ds, year) AS visit__ds__year + , DATETIME_TRUNC(visits_source_src_28000.ds, day) AS visit__ds__day + , DATETIME_TRUNC(visits_source_src_28000.ds, isoweek) AS visit__ds__week + , DATETIME_TRUNC(visits_source_src_28000.ds, month) AS visit__ds__month + , DATETIME_TRUNC(visits_source_src_28000.ds, quarter) AS visit__ds__quarter + , DATETIME_TRUNC(visits_source_src_28000.ds, year) AS visit__ds__year , EXTRACT(year FROM visits_source_src_28000.ds) AS visit__ds__extract_year , EXTRACT(quarter FROM visits_source_src_28000.ds) AS visit__ds__extract_quarter , EXTRACT(month FROM visits_source_src_28000.ds) AS visit__ds__extract_month @@ -352,22 +352,22 @@ FROM ( SELECT 1 AS buys , buys_source_src_28000.user_id AS buyers - , DATE_TRUNC(buys_source_src_28000.ds, day) AS ds__day - , DATE_TRUNC(buys_source_src_28000.ds, isoweek) AS ds__week - , DATE_TRUNC(buys_source_src_28000.ds, month) AS ds__month - , DATE_TRUNC(buys_source_src_28000.ds, quarter) AS ds__quarter - , DATE_TRUNC(buys_source_src_28000.ds, year) AS ds__year + , DATETIME_TRUNC(buys_source_src_28000.ds, day) AS ds__day + , DATETIME_TRUNC(buys_source_src_28000.ds, isoweek) AS ds__week + , DATETIME_TRUNC(buys_source_src_28000.ds, month) AS ds__month + , DATETIME_TRUNC(buys_source_src_28000.ds, quarter) AS ds__quarter + , DATETIME_TRUNC(buys_source_src_28000.ds, year) AS ds__year , EXTRACT(year FROM buys_source_src_28000.ds) AS ds__extract_year , EXTRACT(quarter FROM buys_source_src_28000.ds) AS ds__extract_quarter , EXTRACT(month FROM buys_source_src_28000.ds) AS ds__extract_month , EXTRACT(day FROM buys_source_src_28000.ds) AS ds__extract_day , IF(EXTRACT(dayofweek FROM buys_source_src_28000.ds) = 1, 7, EXTRACT(dayofweek FROM buys_source_src_28000.ds) - 1) AS ds__extract_dow , EXTRACT(dayofyear FROM buys_source_src_28000.ds) AS ds__extract_doy - , DATE_TRUNC(buys_source_src_28000.ds, day) AS buy__ds__day - , DATE_TRUNC(buys_source_src_28000.ds, isoweek) AS buy__ds__week - , DATE_TRUNC(buys_source_src_28000.ds, month) AS buy__ds__month - , DATE_TRUNC(buys_source_src_28000.ds, quarter) AS buy__ds__quarter - , DATE_TRUNC(buys_source_src_28000.ds, year) AS buy__ds__year + , DATETIME_TRUNC(buys_source_src_28000.ds, day) AS buy__ds__day + , DATETIME_TRUNC(buys_source_src_28000.ds, isoweek) AS buy__ds__week + , DATETIME_TRUNC(buys_source_src_28000.ds, month) AS buy__ds__month + , DATETIME_TRUNC(buys_source_src_28000.ds, quarter) AS buy__ds__quarter + , DATETIME_TRUNC(buys_source_src_28000.ds, year) AS buy__ds__year , EXTRACT(year FROM buys_source_src_28000.ds) AS buy__ds__extract_year , EXTRACT(quarter FROM buys_source_src_28000.ds) AS buy__ds__extract_quarter , EXTRACT(month FROM buys_source_src_28000.ds) AS buy__ds__extract_month diff --git a/tests_metricflow/snapshots/test_conversion_metrics_to_sql.py/SqlQueryPlan/BigQuery/test_conversion_rate_with_window__plan0_optimized.sql b/tests_metricflow/snapshots/test_conversion_metrics_to_sql.py/SqlQueryPlan/BigQuery/test_conversion_rate_with_window__plan0_optimized.sql index 68c8d46192..478eb0b07f 100644 --- a/tests_metricflow/snapshots/test_conversion_metrics_to_sql.py/SqlQueryPlan/BigQuery/test_conversion_rate_with_window__plan0_optimized.sql +++ b/tests_metricflow/snapshots/test_conversion_metrics_to_sql.py/SqlQueryPlan/BigQuery/test_conversion_rate_with_window__plan0_optimized.sql @@ -21,7 +21,7 @@ FROM ( -- Metric Time Dimension 'ds' -- Pass Only Elements: ['visits', 'visit__referrer_id', 'metric_time__day'] SELECT - DATE_TRUNC(ds, day) AS metric_time__day + DATETIME_TRUNC(ds, day) AS metric_time__day , referrer_id AS visit__referrer_id , 1 AS visits FROM ***************************.fct_visits visits_source_src_28000 @@ -88,8 +88,8 @@ FROM ( -- Metric Time Dimension 'ds' -- Pass Only Elements: ['visits', 'visit__referrer_id', 'ds__day', 'metric_time__day', 'user'] SELECT - DATE_TRUNC(ds, day) AS ds__day - , DATE_TRUNC(ds, day) AS metric_time__day + DATETIME_TRUNC(ds, day) AS ds__day + , DATETIME_TRUNC(ds, day) AS metric_time__day , user_id AS user , referrer_id AS visit__referrer_id , 1 AS visits @@ -100,7 +100,7 @@ FROM ( -- Metric Time Dimension 'ds' -- Add column with generated UUID SELECT - DATE_TRUNC(ds, day) AS ds__day + DATETIME_TRUNC(ds, day) AS ds__day , user_id AS user , 1 AS buys , GENERATE_UUID() AS mf_internal_uuid diff --git a/tests_metricflow/snapshots/test_convert_semantic_model.py/SqlQueryPlan/BigQuery/test_convert_query_semantic_model__plan0.sql b/tests_metricflow/snapshots/test_convert_semantic_model.py/SqlQueryPlan/BigQuery/test_convert_query_semantic_model__plan0.sql index 62bd3fea5e..9ce0459e87 100644 --- a/tests_metricflow/snapshots/test_convert_semantic_model.py/SqlQueryPlan/BigQuery/test_convert_query_semantic_model__plan0.sql +++ b/tests_metricflow/snapshots/test_convert_semantic_model.py/SqlQueryPlan/BigQuery/test_convert_query_semantic_model__plan0.sql @@ -1,22 +1,22 @@ -- Read Elements From Semantic Model 'revenue' SELECT revenue_src_28000.revenue AS txn_revenue - , DATE_TRUNC(revenue_src_28000.created_at, day) AS ds__day - , DATE_TRUNC(revenue_src_28000.created_at, isoweek) AS ds__week - , DATE_TRUNC(revenue_src_28000.created_at, month) AS ds__month - , DATE_TRUNC(revenue_src_28000.created_at, quarter) AS ds__quarter - , DATE_TRUNC(revenue_src_28000.created_at, year) AS ds__year + , DATETIME_TRUNC(revenue_src_28000.created_at, day) AS ds__day + , DATETIME_TRUNC(revenue_src_28000.created_at, isoweek) AS ds__week + , DATETIME_TRUNC(revenue_src_28000.created_at, month) AS ds__month + , DATETIME_TRUNC(revenue_src_28000.created_at, quarter) AS ds__quarter + , DATETIME_TRUNC(revenue_src_28000.created_at, year) AS ds__year , EXTRACT(year FROM revenue_src_28000.created_at) AS ds__extract_year , EXTRACT(quarter FROM revenue_src_28000.created_at) AS ds__extract_quarter , EXTRACT(month FROM revenue_src_28000.created_at) AS ds__extract_month , EXTRACT(day FROM revenue_src_28000.created_at) AS ds__extract_day , IF(EXTRACT(dayofweek FROM revenue_src_28000.created_at) = 1, 7, EXTRACT(dayofweek FROM revenue_src_28000.created_at) - 1) AS ds__extract_dow , EXTRACT(dayofyear FROM revenue_src_28000.created_at) AS ds__extract_doy - , DATE_TRUNC(revenue_src_28000.created_at, day) AS revenue_instance__ds__day - , DATE_TRUNC(revenue_src_28000.created_at, isoweek) AS revenue_instance__ds__week - , DATE_TRUNC(revenue_src_28000.created_at, month) AS revenue_instance__ds__month - , DATE_TRUNC(revenue_src_28000.created_at, quarter) AS revenue_instance__ds__quarter - , DATE_TRUNC(revenue_src_28000.created_at, year) AS revenue_instance__ds__year + , DATETIME_TRUNC(revenue_src_28000.created_at, day) AS revenue_instance__ds__day + , DATETIME_TRUNC(revenue_src_28000.created_at, isoweek) AS revenue_instance__ds__week + , DATETIME_TRUNC(revenue_src_28000.created_at, month) AS revenue_instance__ds__month + , DATETIME_TRUNC(revenue_src_28000.created_at, quarter) AS revenue_instance__ds__quarter + , DATETIME_TRUNC(revenue_src_28000.created_at, year) AS revenue_instance__ds__year , EXTRACT(year FROM revenue_src_28000.created_at) AS revenue_instance__ds__extract_year , EXTRACT(quarter FROM revenue_src_28000.created_at) AS revenue_instance__ds__extract_quarter , EXTRACT(month FROM revenue_src_28000.created_at) AS revenue_instance__ds__extract_month diff --git a/tests_metricflow/snapshots/test_convert_semantic_model.py/SqlQueryPlan/BigQuery/test_convert_table_semantic_model_with_measures__plan0.sql b/tests_metricflow/snapshots/test_convert_semantic_model.py/SqlQueryPlan/BigQuery/test_convert_table_semantic_model_with_measures__plan0.sql index 879c6b43f7..a5d84f15f3 100644 --- a/tests_metricflow/snapshots/test_convert_semantic_model.py/SqlQueryPlan/BigQuery/test_convert_table_semantic_model_with_measures__plan0.sql +++ b/tests_metricflow/snapshots/test_convert_semantic_model.py/SqlQueryPlan/BigQuery/test_convert_table_semantic_model_with_measures__plan0.sql @@ -1,22 +1,22 @@ -- Read Elements From Semantic Model 'id_verifications' SELECT 1 AS identity_verifications - , DATE_TRUNC(id_verifications_src_28000.ds, day) AS ds__day - , DATE_TRUNC(id_verifications_src_28000.ds, isoweek) AS ds__week - , DATE_TRUNC(id_verifications_src_28000.ds, month) AS ds__month - , DATE_TRUNC(id_verifications_src_28000.ds, quarter) AS ds__quarter - , DATE_TRUNC(id_verifications_src_28000.ds, year) AS ds__year + , DATETIME_TRUNC(id_verifications_src_28000.ds, day) AS ds__day + , DATETIME_TRUNC(id_verifications_src_28000.ds, isoweek) AS ds__week + , DATETIME_TRUNC(id_verifications_src_28000.ds, month) AS ds__month + , DATETIME_TRUNC(id_verifications_src_28000.ds, quarter) AS ds__quarter + , DATETIME_TRUNC(id_verifications_src_28000.ds, year) AS ds__year , EXTRACT(year FROM id_verifications_src_28000.ds) AS ds__extract_year , EXTRACT(quarter FROM id_verifications_src_28000.ds) AS ds__extract_quarter , EXTRACT(month FROM id_verifications_src_28000.ds) AS ds__extract_month , EXTRACT(day FROM id_verifications_src_28000.ds) AS ds__extract_day , IF(EXTRACT(dayofweek FROM id_verifications_src_28000.ds) = 1, 7, EXTRACT(dayofweek FROM id_verifications_src_28000.ds) - 1) AS ds__extract_dow , EXTRACT(dayofyear FROM id_verifications_src_28000.ds) AS ds__extract_doy - , DATE_TRUNC(id_verifications_src_28000.ds_partitioned, day) AS ds_partitioned__day - , DATE_TRUNC(id_verifications_src_28000.ds_partitioned, isoweek) AS ds_partitioned__week - , DATE_TRUNC(id_verifications_src_28000.ds_partitioned, month) AS ds_partitioned__month - , DATE_TRUNC(id_verifications_src_28000.ds_partitioned, quarter) AS ds_partitioned__quarter - , DATE_TRUNC(id_verifications_src_28000.ds_partitioned, year) AS ds_partitioned__year + , DATETIME_TRUNC(id_verifications_src_28000.ds_partitioned, day) AS ds_partitioned__day + , DATETIME_TRUNC(id_verifications_src_28000.ds_partitioned, isoweek) AS ds_partitioned__week + , DATETIME_TRUNC(id_verifications_src_28000.ds_partitioned, month) AS ds_partitioned__month + , DATETIME_TRUNC(id_verifications_src_28000.ds_partitioned, quarter) AS ds_partitioned__quarter + , DATETIME_TRUNC(id_verifications_src_28000.ds_partitioned, year) AS ds_partitioned__year , EXTRACT(year FROM id_verifications_src_28000.ds_partitioned) AS ds_partitioned__extract_year , EXTRACT(quarter FROM id_verifications_src_28000.ds_partitioned) AS ds_partitioned__extract_quarter , EXTRACT(month FROM id_verifications_src_28000.ds_partitioned) AS ds_partitioned__extract_month @@ -24,22 +24,22 @@ SELECT , IF(EXTRACT(dayofweek FROM id_verifications_src_28000.ds_partitioned) = 1, 7, EXTRACT(dayofweek FROM id_verifications_src_28000.ds_partitioned) - 1) AS ds_partitioned__extract_dow , EXTRACT(dayofyear FROM id_verifications_src_28000.ds_partitioned) AS ds_partitioned__extract_doy , id_verifications_src_28000.verification_type - , DATE_TRUNC(id_verifications_src_28000.ds, day) AS verification__ds__day - , DATE_TRUNC(id_verifications_src_28000.ds, isoweek) AS verification__ds__week - , DATE_TRUNC(id_verifications_src_28000.ds, month) AS verification__ds__month - , DATE_TRUNC(id_verifications_src_28000.ds, quarter) AS verification__ds__quarter - , DATE_TRUNC(id_verifications_src_28000.ds, year) AS verification__ds__year + , DATETIME_TRUNC(id_verifications_src_28000.ds, day) AS verification__ds__day + , DATETIME_TRUNC(id_verifications_src_28000.ds, isoweek) AS verification__ds__week + , DATETIME_TRUNC(id_verifications_src_28000.ds, month) AS verification__ds__month + , DATETIME_TRUNC(id_verifications_src_28000.ds, quarter) AS verification__ds__quarter + , DATETIME_TRUNC(id_verifications_src_28000.ds, year) AS verification__ds__year , EXTRACT(year FROM id_verifications_src_28000.ds) AS verification__ds__extract_year , EXTRACT(quarter FROM id_verifications_src_28000.ds) AS verification__ds__extract_quarter , EXTRACT(month FROM id_verifications_src_28000.ds) AS verification__ds__extract_month , EXTRACT(day FROM id_verifications_src_28000.ds) AS verification__ds__extract_day , IF(EXTRACT(dayofweek FROM id_verifications_src_28000.ds) = 1, 7, EXTRACT(dayofweek FROM id_verifications_src_28000.ds) - 1) AS verification__ds__extract_dow , EXTRACT(dayofyear FROM id_verifications_src_28000.ds) AS verification__ds__extract_doy - , DATE_TRUNC(id_verifications_src_28000.ds_partitioned, day) AS verification__ds_partitioned__day - , DATE_TRUNC(id_verifications_src_28000.ds_partitioned, isoweek) AS verification__ds_partitioned__week - , DATE_TRUNC(id_verifications_src_28000.ds_partitioned, month) AS verification__ds_partitioned__month - , DATE_TRUNC(id_verifications_src_28000.ds_partitioned, quarter) AS verification__ds_partitioned__quarter - , DATE_TRUNC(id_verifications_src_28000.ds_partitioned, year) AS verification__ds_partitioned__year + , DATETIME_TRUNC(id_verifications_src_28000.ds_partitioned, day) AS verification__ds_partitioned__day + , DATETIME_TRUNC(id_verifications_src_28000.ds_partitioned, isoweek) AS verification__ds_partitioned__week + , DATETIME_TRUNC(id_verifications_src_28000.ds_partitioned, month) AS verification__ds_partitioned__month + , DATETIME_TRUNC(id_verifications_src_28000.ds_partitioned, quarter) AS verification__ds_partitioned__quarter + , DATETIME_TRUNC(id_verifications_src_28000.ds_partitioned, year) AS verification__ds_partitioned__year , EXTRACT(year FROM id_verifications_src_28000.ds_partitioned) AS verification__ds_partitioned__extract_year , EXTRACT(quarter FROM id_verifications_src_28000.ds_partitioned) AS verification__ds_partitioned__extract_quarter , EXTRACT(month FROM id_verifications_src_28000.ds_partitioned) AS verification__ds_partitioned__extract_month diff --git a/tests_metricflow/snapshots/test_convert_semantic_model.py/SqlQueryPlan/BigQuery/test_convert_table_semantic_model_without_measures__plan0.sql b/tests_metricflow/snapshots/test_convert_semantic_model.py/SqlQueryPlan/BigQuery/test_convert_table_semantic_model_without_measures__plan0.sql index 20f253203a..bf8885b259 100644 --- a/tests_metricflow/snapshots/test_convert_semantic_model.py/SqlQueryPlan/BigQuery/test_convert_table_semantic_model_without_measures__plan0.sql +++ b/tests_metricflow/snapshots/test_convert_semantic_model.py/SqlQueryPlan/BigQuery/test_convert_table_semantic_model_without_measures__plan0.sql @@ -1,10 +1,10 @@ -- Read Elements From Semantic Model 'users_latest' SELECT - DATE_TRUNC(users_latest_src_28000.ds, day) AS ds_latest__day - , DATE_TRUNC(users_latest_src_28000.ds, isoweek) AS ds_latest__week - , DATE_TRUNC(users_latest_src_28000.ds, month) AS ds_latest__month - , DATE_TRUNC(users_latest_src_28000.ds, quarter) AS ds_latest__quarter - , DATE_TRUNC(users_latest_src_28000.ds, year) AS ds_latest__year + DATETIME_TRUNC(users_latest_src_28000.ds, day) AS ds_latest__day + , DATETIME_TRUNC(users_latest_src_28000.ds, isoweek) AS ds_latest__week + , DATETIME_TRUNC(users_latest_src_28000.ds, month) AS ds_latest__month + , DATETIME_TRUNC(users_latest_src_28000.ds, quarter) AS ds_latest__quarter + , DATETIME_TRUNC(users_latest_src_28000.ds, year) AS ds_latest__year , EXTRACT(year FROM users_latest_src_28000.ds) AS ds_latest__extract_year , EXTRACT(quarter FROM users_latest_src_28000.ds) AS ds_latest__extract_quarter , EXTRACT(month FROM users_latest_src_28000.ds) AS ds_latest__extract_month @@ -12,11 +12,11 @@ SELECT , IF(EXTRACT(dayofweek FROM users_latest_src_28000.ds) = 1, 7, EXTRACT(dayofweek FROM users_latest_src_28000.ds) - 1) AS ds_latest__extract_dow , EXTRACT(dayofyear FROM users_latest_src_28000.ds) AS ds_latest__extract_doy , users_latest_src_28000.home_state_latest - , DATE_TRUNC(users_latest_src_28000.ds, day) AS user__ds_latest__day - , DATE_TRUNC(users_latest_src_28000.ds, isoweek) AS user__ds_latest__week - , DATE_TRUNC(users_latest_src_28000.ds, month) AS user__ds_latest__month - , DATE_TRUNC(users_latest_src_28000.ds, quarter) AS user__ds_latest__quarter - , DATE_TRUNC(users_latest_src_28000.ds, year) AS user__ds_latest__year + , DATETIME_TRUNC(users_latest_src_28000.ds, day) AS user__ds_latest__day + , DATETIME_TRUNC(users_latest_src_28000.ds, isoweek) AS user__ds_latest__week + , DATETIME_TRUNC(users_latest_src_28000.ds, month) AS user__ds_latest__month + , DATETIME_TRUNC(users_latest_src_28000.ds, quarter) AS user__ds_latest__quarter + , DATETIME_TRUNC(users_latest_src_28000.ds, year) AS user__ds_latest__year , EXTRACT(year FROM users_latest_src_28000.ds) AS user__ds_latest__extract_year , EXTRACT(quarter FROM users_latest_src_28000.ds) AS user__ds_latest__extract_quarter , EXTRACT(month FROM users_latest_src_28000.ds) AS user__ds_latest__extract_month diff --git a/tests_metricflow/snapshots/test_cumulative_metric_rendering.py/SqlQueryPlan/BigQuery/test_cumulative_metric__plan0.sql b/tests_metricflow/snapshots/test_cumulative_metric_rendering.py/SqlQueryPlan/BigQuery/test_cumulative_metric__plan0.sql index f0d2fd26ea..c1980b1f08 100644 --- a/tests_metricflow/snapshots/test_cumulative_metric_rendering.py/SqlQueryPlan/BigQuery/test_cumulative_metric__plan0.sql +++ b/tests_metricflow/snapshots/test_cumulative_metric_rendering.py/SqlQueryPlan/BigQuery/test_cumulative_metric__plan0.sql @@ -55,22 +55,22 @@ FROM ( -- Read Elements From Semantic Model 'revenue' SELECT revenue_src_28000.revenue AS txn_revenue - , DATE_TRUNC(revenue_src_28000.created_at, day) AS ds__day - , DATE_TRUNC(revenue_src_28000.created_at, isoweek) AS ds__week - , DATE_TRUNC(revenue_src_28000.created_at, month) AS ds__month - , DATE_TRUNC(revenue_src_28000.created_at, quarter) AS ds__quarter - , DATE_TRUNC(revenue_src_28000.created_at, year) AS ds__year + , DATETIME_TRUNC(revenue_src_28000.created_at, day) AS ds__day + , DATETIME_TRUNC(revenue_src_28000.created_at, isoweek) AS ds__week + , DATETIME_TRUNC(revenue_src_28000.created_at, month) AS ds__month + , DATETIME_TRUNC(revenue_src_28000.created_at, quarter) AS ds__quarter + , DATETIME_TRUNC(revenue_src_28000.created_at, year) AS ds__year , EXTRACT(year FROM revenue_src_28000.created_at) AS ds__extract_year , EXTRACT(quarter FROM revenue_src_28000.created_at) AS ds__extract_quarter , EXTRACT(month FROM revenue_src_28000.created_at) AS ds__extract_month , EXTRACT(day FROM revenue_src_28000.created_at) AS ds__extract_day , IF(EXTRACT(dayofweek FROM revenue_src_28000.created_at) = 1, 7, EXTRACT(dayofweek FROM revenue_src_28000.created_at) - 1) AS ds__extract_dow , EXTRACT(dayofyear FROM revenue_src_28000.created_at) AS ds__extract_doy - , DATE_TRUNC(revenue_src_28000.created_at, day) AS revenue_instance__ds__day - , DATE_TRUNC(revenue_src_28000.created_at, isoweek) AS revenue_instance__ds__week - , DATE_TRUNC(revenue_src_28000.created_at, month) AS revenue_instance__ds__month - , DATE_TRUNC(revenue_src_28000.created_at, quarter) AS revenue_instance__ds__quarter - , DATE_TRUNC(revenue_src_28000.created_at, year) AS revenue_instance__ds__year + , DATETIME_TRUNC(revenue_src_28000.created_at, day) AS revenue_instance__ds__day + , DATETIME_TRUNC(revenue_src_28000.created_at, isoweek) AS revenue_instance__ds__week + , DATETIME_TRUNC(revenue_src_28000.created_at, month) AS revenue_instance__ds__month + , DATETIME_TRUNC(revenue_src_28000.created_at, quarter) AS revenue_instance__ds__quarter + , DATETIME_TRUNC(revenue_src_28000.created_at, year) AS revenue_instance__ds__year , EXTRACT(year FROM revenue_src_28000.created_at) AS revenue_instance__ds__extract_year , EXTRACT(quarter FROM revenue_src_28000.created_at) AS revenue_instance__ds__extract_quarter , EXTRACT(month FROM revenue_src_28000.created_at) AS revenue_instance__ds__extract_month diff --git a/tests_metricflow/snapshots/test_cumulative_metric_rendering.py/SqlQueryPlan/BigQuery/test_cumulative_metric__plan0_optimized.sql b/tests_metricflow/snapshots/test_cumulative_metric_rendering.py/SqlQueryPlan/BigQuery/test_cumulative_metric__plan0_optimized.sql index f1006b1250..e5be7b428a 100644 --- a/tests_metricflow/snapshots/test_cumulative_metric_rendering.py/SqlQueryPlan/BigQuery/test_cumulative_metric__plan0_optimized.sql +++ b/tests_metricflow/snapshots/test_cumulative_metric_rendering.py/SqlQueryPlan/BigQuery/test_cumulative_metric__plan0_optimized.sql @@ -4,7 +4,7 @@ -- Aggregate Measures -- Compute Metrics via Expressions SELECT - DATE_TRUNC(created_at, day) AS ds__day + DATETIME_TRUNC(created_at, day) AS ds__day , SUM(revenue) AS trailing_2_months_revenue FROM ***************************.fct_revenue revenue_src_28000 GROUP BY diff --git a/tests_metricflow/snapshots/test_cumulative_metric_rendering.py/SqlQueryPlan/BigQuery/test_cumulative_metric_grain_to_date__plan0.sql b/tests_metricflow/snapshots/test_cumulative_metric_rendering.py/SqlQueryPlan/BigQuery/test_cumulative_metric_grain_to_date__plan0.sql index f3e707e743..0ead1ebe91 100644 --- a/tests_metricflow/snapshots/test_cumulative_metric_rendering.py/SqlQueryPlan/BigQuery/test_cumulative_metric_grain_to_date__plan0.sql +++ b/tests_metricflow/snapshots/test_cumulative_metric_rendering.py/SqlQueryPlan/BigQuery/test_cumulative_metric_grain_to_date__plan0.sql @@ -55,22 +55,22 @@ FROM ( -- Read Elements From Semantic Model 'revenue' SELECT revenue_src_28000.revenue AS txn_revenue - , DATE_TRUNC(revenue_src_28000.created_at, day) AS ds__day - , DATE_TRUNC(revenue_src_28000.created_at, isoweek) AS ds__week - , DATE_TRUNC(revenue_src_28000.created_at, month) AS ds__month - , DATE_TRUNC(revenue_src_28000.created_at, quarter) AS ds__quarter - , DATE_TRUNC(revenue_src_28000.created_at, year) AS ds__year + , DATETIME_TRUNC(revenue_src_28000.created_at, day) AS ds__day + , DATETIME_TRUNC(revenue_src_28000.created_at, isoweek) AS ds__week + , DATETIME_TRUNC(revenue_src_28000.created_at, month) AS ds__month + , DATETIME_TRUNC(revenue_src_28000.created_at, quarter) AS ds__quarter + , DATETIME_TRUNC(revenue_src_28000.created_at, year) AS ds__year , EXTRACT(year FROM revenue_src_28000.created_at) AS ds__extract_year , EXTRACT(quarter FROM revenue_src_28000.created_at) AS ds__extract_quarter , EXTRACT(month FROM revenue_src_28000.created_at) AS ds__extract_month , EXTRACT(day FROM revenue_src_28000.created_at) AS ds__extract_day , IF(EXTRACT(dayofweek FROM revenue_src_28000.created_at) = 1, 7, EXTRACT(dayofweek FROM revenue_src_28000.created_at) - 1) AS ds__extract_dow , EXTRACT(dayofyear FROM revenue_src_28000.created_at) AS ds__extract_doy - , DATE_TRUNC(revenue_src_28000.created_at, day) AS revenue_instance__ds__day - , DATE_TRUNC(revenue_src_28000.created_at, isoweek) AS revenue_instance__ds__week - , DATE_TRUNC(revenue_src_28000.created_at, month) AS revenue_instance__ds__month - , DATE_TRUNC(revenue_src_28000.created_at, quarter) AS revenue_instance__ds__quarter - , DATE_TRUNC(revenue_src_28000.created_at, year) AS revenue_instance__ds__year + , DATETIME_TRUNC(revenue_src_28000.created_at, day) AS revenue_instance__ds__day + , DATETIME_TRUNC(revenue_src_28000.created_at, isoweek) AS revenue_instance__ds__week + , DATETIME_TRUNC(revenue_src_28000.created_at, month) AS revenue_instance__ds__month + , DATETIME_TRUNC(revenue_src_28000.created_at, quarter) AS revenue_instance__ds__quarter + , DATETIME_TRUNC(revenue_src_28000.created_at, year) AS revenue_instance__ds__year , EXTRACT(year FROM revenue_src_28000.created_at) AS revenue_instance__ds__extract_year , EXTRACT(quarter FROM revenue_src_28000.created_at) AS revenue_instance__ds__extract_quarter , EXTRACT(month FROM revenue_src_28000.created_at) AS revenue_instance__ds__extract_month diff --git a/tests_metricflow/snapshots/test_cumulative_metric_rendering.py/SqlQueryPlan/BigQuery/test_cumulative_metric_grain_to_date__plan0_optimized.sql b/tests_metricflow/snapshots/test_cumulative_metric_rendering.py/SqlQueryPlan/BigQuery/test_cumulative_metric_grain_to_date__plan0_optimized.sql index db69f59081..4269bad578 100644 --- a/tests_metricflow/snapshots/test_cumulative_metric_rendering.py/SqlQueryPlan/BigQuery/test_cumulative_metric_grain_to_date__plan0_optimized.sql +++ b/tests_metricflow/snapshots/test_cumulative_metric_rendering.py/SqlQueryPlan/BigQuery/test_cumulative_metric_grain_to_date__plan0_optimized.sql @@ -4,7 +4,7 @@ -- Aggregate Measures -- Compute Metrics via Expressions SELECT - DATE_TRUNC(created_at, month) AS ds__month + DATETIME_TRUNC(created_at, month) AS ds__month , SUM(revenue) AS revenue_mtd FROM ***************************.fct_revenue revenue_src_28000 GROUP BY diff --git a/tests_metricflow/snapshots/test_cumulative_metric_rendering.py/SqlQueryPlan/BigQuery/test_cumulative_metric_month__plan0.sql b/tests_metricflow/snapshots/test_cumulative_metric_rendering.py/SqlQueryPlan/BigQuery/test_cumulative_metric_month__plan0.sql index 3f753cdc6b..e52ecffc47 100644 --- a/tests_metricflow/snapshots/test_cumulative_metric_rendering.py/SqlQueryPlan/BigQuery/test_cumulative_metric_month__plan0.sql +++ b/tests_metricflow/snapshots/test_cumulative_metric_rendering.py/SqlQueryPlan/BigQuery/test_cumulative_metric_month__plan0.sql @@ -44,7 +44,7 @@ FROM ( FROM ( -- Time Spine SELECT - DATE_TRUNC(subq_6.ds, month) AS metric_time__month + DATETIME_TRUNC(subq_6.ds, month) AS metric_time__month FROM ***************************.mf_time_spine subq_6 WHERE subq_6.ds BETWEEN '2020-03-05' AND '2021-01-04' GROUP BY @@ -102,15 +102,15 @@ FROM ( -- Read Elements From Semantic Model 'bookings_monthly_source' SELECT bookings_monthly_source_src_16000.bookings_monthly - , DATE_TRUNC(bookings_monthly_source_src_16000.ds, month) AS monthly_ds__month - , DATE_TRUNC(bookings_monthly_source_src_16000.ds, quarter) AS monthly_ds__quarter - , DATE_TRUNC(bookings_monthly_source_src_16000.ds, year) AS monthly_ds__year + , DATETIME_TRUNC(bookings_monthly_source_src_16000.ds, month) AS monthly_ds__month + , DATETIME_TRUNC(bookings_monthly_source_src_16000.ds, quarter) AS monthly_ds__quarter + , DATETIME_TRUNC(bookings_monthly_source_src_16000.ds, year) AS monthly_ds__year , EXTRACT(year FROM bookings_monthly_source_src_16000.ds) AS monthly_ds__extract_year , EXTRACT(quarter FROM bookings_monthly_source_src_16000.ds) AS monthly_ds__extract_quarter , EXTRACT(month FROM bookings_monthly_source_src_16000.ds) AS monthly_ds__extract_month - , DATE_TRUNC(bookings_monthly_source_src_16000.ds, month) AS booking__monthly_ds__month - , DATE_TRUNC(bookings_monthly_source_src_16000.ds, quarter) AS booking__monthly_ds__quarter - , DATE_TRUNC(bookings_monthly_source_src_16000.ds, year) AS booking__monthly_ds__year + , DATETIME_TRUNC(bookings_monthly_source_src_16000.ds, month) AS booking__monthly_ds__month + , DATETIME_TRUNC(bookings_monthly_source_src_16000.ds, quarter) AS booking__monthly_ds__quarter + , DATETIME_TRUNC(bookings_monthly_source_src_16000.ds, year) AS booking__monthly_ds__year , EXTRACT(year FROM bookings_monthly_source_src_16000.ds) AS booking__monthly_ds__extract_year , EXTRACT(quarter FROM bookings_monthly_source_src_16000.ds) AS booking__monthly_ds__extract_quarter , EXTRACT(month FROM bookings_monthly_source_src_16000.ds) AS booking__monthly_ds__extract_month diff --git a/tests_metricflow/snapshots/test_cumulative_metric_rendering.py/SqlQueryPlan/BigQuery/test_cumulative_metric_month__plan0_optimized.sql b/tests_metricflow/snapshots/test_cumulative_metric_rendering.py/SqlQueryPlan/BigQuery/test_cumulative_metric_month__plan0_optimized.sql index 7bf9152d91..46c590a7f4 100644 --- a/tests_metricflow/snapshots/test_cumulative_metric_rendering.py/SqlQueryPlan/BigQuery/test_cumulative_metric_month__plan0_optimized.sql +++ b/tests_metricflow/snapshots/test_cumulative_metric_rendering.py/SqlQueryPlan/BigQuery/test_cumulative_metric_month__plan0_optimized.sql @@ -9,7 +9,7 @@ SELECT FROM ( -- Time Spine SELECT - DATE_TRUNC(ds, month) AS metric_time__month + DATETIME_TRUNC(ds, month) AS metric_time__month FROM ***************************.mf_time_spine subq_15 WHERE ds BETWEEN '2020-03-05' AND '2021-01-04' GROUP BY @@ -20,10 +20,10 @@ INNER JOIN ( -- Metric Time Dimension 'monthly_ds' -- Constrain Time Range to [2019-12-05T00:00:00, 2021-01-04T00:00:00] SELECT - DATE_TRUNC(ds, month) AS metric_time__month + DATETIME_TRUNC(ds, month) AS metric_time__month , bookings_monthly FROM ***************************.fct_bookings_extended_monthly bookings_monthly_source_src_16000 - WHERE DATE_TRUNC(ds, month) BETWEEN '2019-12-05' AND '2021-01-04' + WHERE DATETIME_TRUNC(ds, month) BETWEEN '2019-12-05' AND '2021-01-04' ) subq_13 ON ( diff --git a/tests_metricflow/snapshots/test_cumulative_metric_rendering.py/SqlQueryPlan/BigQuery/test_cumulative_metric_no_ds__plan0.sql b/tests_metricflow/snapshots/test_cumulative_metric_rendering.py/SqlQueryPlan/BigQuery/test_cumulative_metric_no_ds__plan0.sql index 4606e8d792..d663c8e103 100644 --- a/tests_metricflow/snapshots/test_cumulative_metric_rendering.py/SqlQueryPlan/BigQuery/test_cumulative_metric_no_ds__plan0.sql +++ b/tests_metricflow/snapshots/test_cumulative_metric_rendering.py/SqlQueryPlan/BigQuery/test_cumulative_metric_no_ds__plan0.sql @@ -52,22 +52,22 @@ FROM ( -- Read Elements From Semantic Model 'revenue' SELECT revenue_src_28000.revenue AS txn_revenue - , DATE_TRUNC(revenue_src_28000.created_at, day) AS ds__day - , DATE_TRUNC(revenue_src_28000.created_at, isoweek) AS ds__week - , DATE_TRUNC(revenue_src_28000.created_at, month) AS ds__month - , DATE_TRUNC(revenue_src_28000.created_at, quarter) AS ds__quarter - , DATE_TRUNC(revenue_src_28000.created_at, year) AS ds__year + , DATETIME_TRUNC(revenue_src_28000.created_at, day) AS ds__day + , DATETIME_TRUNC(revenue_src_28000.created_at, isoweek) AS ds__week + , DATETIME_TRUNC(revenue_src_28000.created_at, month) AS ds__month + , DATETIME_TRUNC(revenue_src_28000.created_at, quarter) AS ds__quarter + , DATETIME_TRUNC(revenue_src_28000.created_at, year) AS ds__year , EXTRACT(year FROM revenue_src_28000.created_at) AS ds__extract_year , EXTRACT(quarter FROM revenue_src_28000.created_at) AS ds__extract_quarter , EXTRACT(month FROM revenue_src_28000.created_at) AS ds__extract_month , EXTRACT(day FROM revenue_src_28000.created_at) AS ds__extract_day , IF(EXTRACT(dayofweek FROM revenue_src_28000.created_at) = 1, 7, EXTRACT(dayofweek FROM revenue_src_28000.created_at) - 1) AS ds__extract_dow , EXTRACT(dayofyear FROM revenue_src_28000.created_at) AS ds__extract_doy - , DATE_TRUNC(revenue_src_28000.created_at, day) AS revenue_instance__ds__day - , DATE_TRUNC(revenue_src_28000.created_at, isoweek) AS revenue_instance__ds__week - , DATE_TRUNC(revenue_src_28000.created_at, month) AS revenue_instance__ds__month - , DATE_TRUNC(revenue_src_28000.created_at, quarter) AS revenue_instance__ds__quarter - , DATE_TRUNC(revenue_src_28000.created_at, year) AS revenue_instance__ds__year + , DATETIME_TRUNC(revenue_src_28000.created_at, day) AS revenue_instance__ds__day + , DATETIME_TRUNC(revenue_src_28000.created_at, isoweek) AS revenue_instance__ds__week + , DATETIME_TRUNC(revenue_src_28000.created_at, month) AS revenue_instance__ds__month + , DATETIME_TRUNC(revenue_src_28000.created_at, quarter) AS revenue_instance__ds__quarter + , DATETIME_TRUNC(revenue_src_28000.created_at, year) AS revenue_instance__ds__year , EXTRACT(year FROM revenue_src_28000.created_at) AS revenue_instance__ds__extract_year , EXTRACT(quarter FROM revenue_src_28000.created_at) AS revenue_instance__ds__extract_quarter , EXTRACT(month FROM revenue_src_28000.created_at) AS revenue_instance__ds__extract_month diff --git a/tests_metricflow/snapshots/test_cumulative_metric_rendering.py/SqlQueryPlan/BigQuery/test_cumulative_metric_no_window__plan0.sql b/tests_metricflow/snapshots/test_cumulative_metric_rendering.py/SqlQueryPlan/BigQuery/test_cumulative_metric_no_window__plan0.sql index 62aa464850..2c53459080 100644 --- a/tests_metricflow/snapshots/test_cumulative_metric_rendering.py/SqlQueryPlan/BigQuery/test_cumulative_metric_no_window__plan0.sql +++ b/tests_metricflow/snapshots/test_cumulative_metric_rendering.py/SqlQueryPlan/BigQuery/test_cumulative_metric_no_window__plan0.sql @@ -55,22 +55,22 @@ FROM ( -- Read Elements From Semantic Model 'revenue' SELECT revenue_src_28000.revenue AS txn_revenue - , DATE_TRUNC(revenue_src_28000.created_at, day) AS ds__day - , DATE_TRUNC(revenue_src_28000.created_at, isoweek) AS ds__week - , DATE_TRUNC(revenue_src_28000.created_at, month) AS ds__month - , DATE_TRUNC(revenue_src_28000.created_at, quarter) AS ds__quarter - , DATE_TRUNC(revenue_src_28000.created_at, year) AS ds__year + , DATETIME_TRUNC(revenue_src_28000.created_at, day) AS ds__day + , DATETIME_TRUNC(revenue_src_28000.created_at, isoweek) AS ds__week + , DATETIME_TRUNC(revenue_src_28000.created_at, month) AS ds__month + , DATETIME_TRUNC(revenue_src_28000.created_at, quarter) AS ds__quarter + , DATETIME_TRUNC(revenue_src_28000.created_at, year) AS ds__year , EXTRACT(year FROM revenue_src_28000.created_at) AS ds__extract_year , EXTRACT(quarter FROM revenue_src_28000.created_at) AS ds__extract_quarter , EXTRACT(month FROM revenue_src_28000.created_at) AS ds__extract_month , EXTRACT(day FROM revenue_src_28000.created_at) AS ds__extract_day , IF(EXTRACT(dayofweek FROM revenue_src_28000.created_at) = 1, 7, EXTRACT(dayofweek FROM revenue_src_28000.created_at) - 1) AS ds__extract_dow , EXTRACT(dayofyear FROM revenue_src_28000.created_at) AS ds__extract_doy - , DATE_TRUNC(revenue_src_28000.created_at, day) AS revenue_instance__ds__day - , DATE_TRUNC(revenue_src_28000.created_at, isoweek) AS revenue_instance__ds__week - , DATE_TRUNC(revenue_src_28000.created_at, month) AS revenue_instance__ds__month - , DATE_TRUNC(revenue_src_28000.created_at, quarter) AS revenue_instance__ds__quarter - , DATE_TRUNC(revenue_src_28000.created_at, year) AS revenue_instance__ds__year + , DATETIME_TRUNC(revenue_src_28000.created_at, day) AS revenue_instance__ds__day + , DATETIME_TRUNC(revenue_src_28000.created_at, isoweek) AS revenue_instance__ds__week + , DATETIME_TRUNC(revenue_src_28000.created_at, month) AS revenue_instance__ds__month + , DATETIME_TRUNC(revenue_src_28000.created_at, quarter) AS revenue_instance__ds__quarter + , DATETIME_TRUNC(revenue_src_28000.created_at, year) AS revenue_instance__ds__year , EXTRACT(year FROM revenue_src_28000.created_at) AS revenue_instance__ds__extract_year , EXTRACT(quarter FROM revenue_src_28000.created_at) AS revenue_instance__ds__extract_quarter , EXTRACT(month FROM revenue_src_28000.created_at) AS revenue_instance__ds__extract_month diff --git a/tests_metricflow/snapshots/test_cumulative_metric_rendering.py/SqlQueryPlan/BigQuery/test_cumulative_metric_no_window__plan0_optimized.sql b/tests_metricflow/snapshots/test_cumulative_metric_rendering.py/SqlQueryPlan/BigQuery/test_cumulative_metric_no_window__plan0_optimized.sql index 0bea520ecc..e3154d1428 100644 --- a/tests_metricflow/snapshots/test_cumulative_metric_rendering.py/SqlQueryPlan/BigQuery/test_cumulative_metric_no_window__plan0_optimized.sql +++ b/tests_metricflow/snapshots/test_cumulative_metric_rendering.py/SqlQueryPlan/BigQuery/test_cumulative_metric_no_window__plan0_optimized.sql @@ -4,7 +4,7 @@ -- Aggregate Measures -- Compute Metrics via Expressions SELECT - DATE_TRUNC(created_at, month) AS ds__month + DATETIME_TRUNC(created_at, month) AS ds__month , SUM(revenue) AS revenue_all_time FROM ***************************.fct_revenue revenue_src_28000 GROUP BY diff --git a/tests_metricflow/snapshots/test_cumulative_metric_rendering.py/SqlQueryPlan/BigQuery/test_cumulative_metric_no_window_with_time_constraint__plan0.sql b/tests_metricflow/snapshots/test_cumulative_metric_rendering.py/SqlQueryPlan/BigQuery/test_cumulative_metric_no_window_with_time_constraint__plan0.sql index 5621bbafc6..ac6499a90b 100644 --- a/tests_metricflow/snapshots/test_cumulative_metric_rendering.py/SqlQueryPlan/BigQuery/test_cumulative_metric_no_window_with_time_constraint__plan0.sql +++ b/tests_metricflow/snapshots/test_cumulative_metric_rendering.py/SqlQueryPlan/BigQuery/test_cumulative_metric_no_window_with_time_constraint__plan0.sql @@ -59,7 +59,7 @@ FROM ( FROM ( -- Time Spine SELECT - DATE_TRUNC(subq_6.ds, month) AS metric_time__month + DATETIME_TRUNC(subq_6.ds, month) AS metric_time__month FROM ***************************.mf_time_spine subq_6 WHERE subq_6.ds BETWEEN '2020-01-01' AND '2020-01-01' GROUP BY @@ -147,22 +147,22 @@ FROM ( -- Read Elements From Semantic Model 'revenue' SELECT revenue_src_28000.revenue AS txn_revenue - , DATE_TRUNC(revenue_src_28000.created_at, day) AS ds__day - , DATE_TRUNC(revenue_src_28000.created_at, isoweek) AS ds__week - , DATE_TRUNC(revenue_src_28000.created_at, month) AS ds__month - , DATE_TRUNC(revenue_src_28000.created_at, quarter) AS ds__quarter - , DATE_TRUNC(revenue_src_28000.created_at, year) AS ds__year + , DATETIME_TRUNC(revenue_src_28000.created_at, day) AS ds__day + , DATETIME_TRUNC(revenue_src_28000.created_at, isoweek) AS ds__week + , DATETIME_TRUNC(revenue_src_28000.created_at, month) AS ds__month + , DATETIME_TRUNC(revenue_src_28000.created_at, quarter) AS ds__quarter + , DATETIME_TRUNC(revenue_src_28000.created_at, year) AS ds__year , EXTRACT(year FROM revenue_src_28000.created_at) AS ds__extract_year , EXTRACT(quarter FROM revenue_src_28000.created_at) AS ds__extract_quarter , EXTRACT(month FROM revenue_src_28000.created_at) AS ds__extract_month , EXTRACT(day FROM revenue_src_28000.created_at) AS ds__extract_day , IF(EXTRACT(dayofweek FROM revenue_src_28000.created_at) = 1, 7, EXTRACT(dayofweek FROM revenue_src_28000.created_at) - 1) AS ds__extract_dow , EXTRACT(dayofyear FROM revenue_src_28000.created_at) AS ds__extract_doy - , DATE_TRUNC(revenue_src_28000.created_at, day) AS revenue_instance__ds__day - , DATE_TRUNC(revenue_src_28000.created_at, isoweek) AS revenue_instance__ds__week - , DATE_TRUNC(revenue_src_28000.created_at, month) AS revenue_instance__ds__month - , DATE_TRUNC(revenue_src_28000.created_at, quarter) AS revenue_instance__ds__quarter - , DATE_TRUNC(revenue_src_28000.created_at, year) AS revenue_instance__ds__year + , DATETIME_TRUNC(revenue_src_28000.created_at, day) AS revenue_instance__ds__day + , DATETIME_TRUNC(revenue_src_28000.created_at, isoweek) AS revenue_instance__ds__week + , DATETIME_TRUNC(revenue_src_28000.created_at, month) AS revenue_instance__ds__month + , DATETIME_TRUNC(revenue_src_28000.created_at, quarter) AS revenue_instance__ds__quarter + , DATETIME_TRUNC(revenue_src_28000.created_at, year) AS revenue_instance__ds__year , EXTRACT(year FROM revenue_src_28000.created_at) AS revenue_instance__ds__extract_year , EXTRACT(quarter FROM revenue_src_28000.created_at) AS revenue_instance__ds__extract_quarter , EXTRACT(month FROM revenue_src_28000.created_at) AS revenue_instance__ds__extract_month diff --git a/tests_metricflow/snapshots/test_cumulative_metric_rendering.py/SqlQueryPlan/BigQuery/test_cumulative_metric_no_window_with_time_constraint__plan0_optimized.sql b/tests_metricflow/snapshots/test_cumulative_metric_rendering.py/SqlQueryPlan/BigQuery/test_cumulative_metric_no_window_with_time_constraint__plan0_optimized.sql index 6a4c6eec17..360c62e6f8 100644 --- a/tests_metricflow/snapshots/test_cumulative_metric_rendering.py/SqlQueryPlan/BigQuery/test_cumulative_metric_no_window_with_time_constraint__plan0_optimized.sql +++ b/tests_metricflow/snapshots/test_cumulative_metric_rendering.py/SqlQueryPlan/BigQuery/test_cumulative_metric_no_window_with_time_constraint__plan0_optimized.sql @@ -9,7 +9,7 @@ SELECT FROM ( -- Time Spine SELECT - DATE_TRUNC(ds, month) AS metric_time__month + DATETIME_TRUNC(ds, month) AS metric_time__month FROM ***************************.mf_time_spine subq_15 WHERE ds BETWEEN '2020-01-01' AND '2020-01-01' GROUP BY @@ -20,10 +20,10 @@ INNER JOIN ( -- Metric Time Dimension 'ds' -- Constrain Time Range to [2000-01-01T00:00:00, 2020-01-01T00:00:00] SELECT - DATE_TRUNC(created_at, month) AS metric_time__month + DATETIME_TRUNC(created_at, month) AS metric_time__month , revenue AS txn_revenue FROM ***************************.fct_revenue revenue_src_28000 - WHERE DATE_TRUNC(created_at, day) BETWEEN '2000-01-01' AND '2020-01-01' + WHERE DATETIME_TRUNC(created_at, day) BETWEEN '2000-01-01' AND '2020-01-01' ) subq_13 ON (subq_13.metric_time__month <= subq_14.metric_time__month) diff --git a/tests_metricflow/snapshots/test_cumulative_metric_rendering.py/SqlQueryPlan/BigQuery/test_cumulative_metric_with_agg_time_dimension__plan0.sql b/tests_metricflow/snapshots/test_cumulative_metric_rendering.py/SqlQueryPlan/BigQuery/test_cumulative_metric_with_agg_time_dimension__plan0.sql index c047bbda6c..67fa8d1d50 100644 --- a/tests_metricflow/snapshots/test_cumulative_metric_rendering.py/SqlQueryPlan/BigQuery/test_cumulative_metric_with_agg_time_dimension__plan0.sql +++ b/tests_metricflow/snapshots/test_cumulative_metric_rendering.py/SqlQueryPlan/BigQuery/test_cumulative_metric_with_agg_time_dimension__plan0.sql @@ -100,22 +100,22 @@ FROM ( -- Read Elements From Semantic Model 'revenue' SELECT revenue_src_28000.revenue AS txn_revenue - , DATE_TRUNC(revenue_src_28000.created_at, day) AS ds__day - , DATE_TRUNC(revenue_src_28000.created_at, isoweek) AS ds__week - , DATE_TRUNC(revenue_src_28000.created_at, month) AS ds__month - , DATE_TRUNC(revenue_src_28000.created_at, quarter) AS ds__quarter - , DATE_TRUNC(revenue_src_28000.created_at, year) AS ds__year + , DATETIME_TRUNC(revenue_src_28000.created_at, day) AS ds__day + , DATETIME_TRUNC(revenue_src_28000.created_at, isoweek) AS ds__week + , DATETIME_TRUNC(revenue_src_28000.created_at, month) AS ds__month + , DATETIME_TRUNC(revenue_src_28000.created_at, quarter) AS ds__quarter + , DATETIME_TRUNC(revenue_src_28000.created_at, year) AS ds__year , EXTRACT(year FROM revenue_src_28000.created_at) AS ds__extract_year , EXTRACT(quarter FROM revenue_src_28000.created_at) AS ds__extract_quarter , EXTRACT(month FROM revenue_src_28000.created_at) AS ds__extract_month , EXTRACT(day FROM revenue_src_28000.created_at) AS ds__extract_day , IF(EXTRACT(dayofweek FROM revenue_src_28000.created_at) = 1, 7, EXTRACT(dayofweek FROM revenue_src_28000.created_at) - 1) AS ds__extract_dow , EXTRACT(dayofyear FROM revenue_src_28000.created_at) AS ds__extract_doy - , DATE_TRUNC(revenue_src_28000.created_at, day) AS revenue_instance__ds__day - , DATE_TRUNC(revenue_src_28000.created_at, isoweek) AS revenue_instance__ds__week - , DATE_TRUNC(revenue_src_28000.created_at, month) AS revenue_instance__ds__month - , DATE_TRUNC(revenue_src_28000.created_at, quarter) AS revenue_instance__ds__quarter - , DATE_TRUNC(revenue_src_28000.created_at, year) AS revenue_instance__ds__year + , DATETIME_TRUNC(revenue_src_28000.created_at, day) AS revenue_instance__ds__day + , DATETIME_TRUNC(revenue_src_28000.created_at, isoweek) AS revenue_instance__ds__week + , DATETIME_TRUNC(revenue_src_28000.created_at, month) AS revenue_instance__ds__month + , DATETIME_TRUNC(revenue_src_28000.created_at, quarter) AS revenue_instance__ds__quarter + , DATETIME_TRUNC(revenue_src_28000.created_at, year) AS revenue_instance__ds__year , EXTRACT(year FROM revenue_src_28000.created_at) AS revenue_instance__ds__extract_year , EXTRACT(quarter FROM revenue_src_28000.created_at) AS revenue_instance__ds__extract_quarter , EXTRACT(month FROM revenue_src_28000.created_at) AS revenue_instance__ds__extract_month diff --git a/tests_metricflow/snapshots/test_cumulative_metric_rendering.py/SqlQueryPlan/BigQuery/test_cumulative_metric_with_agg_time_dimension__plan0_optimized.sql b/tests_metricflow/snapshots/test_cumulative_metric_rendering.py/SqlQueryPlan/BigQuery/test_cumulative_metric_with_agg_time_dimension__plan0_optimized.sql index 120b36ee37..8589fc64c5 100644 --- a/tests_metricflow/snapshots/test_cumulative_metric_rendering.py/SqlQueryPlan/BigQuery/test_cumulative_metric_with_agg_time_dimension__plan0_optimized.sql +++ b/tests_metricflow/snapshots/test_cumulative_metric_rendering.py/SqlQueryPlan/BigQuery/test_cumulative_metric_with_agg_time_dimension__plan0_optimized.sql @@ -10,9 +10,9 @@ INNER JOIN ***************************.fct_revenue revenue_src_28000 ON ( - DATE_TRUNC(revenue_src_28000.created_at, day) <= subq_10.ds + DATETIME_TRUNC(revenue_src_28000.created_at, day) <= subq_10.ds ) AND ( - DATE_TRUNC(revenue_src_28000.created_at, day) > DATE_SUB(CAST(subq_10.ds AS DATETIME), INTERVAL 2 month) + DATETIME_TRUNC(revenue_src_28000.created_at, day) > DATE_SUB(CAST(subq_10.ds AS DATETIME), INTERVAL 2 month) ) GROUP BY revenue_instance__ds__day diff --git a/tests_metricflow/snapshots/test_cumulative_metric_rendering.py/SqlQueryPlan/BigQuery/test_cumulative_metric_with_non_adjustable_time_filter__plan0.sql b/tests_metricflow/snapshots/test_cumulative_metric_rendering.py/SqlQueryPlan/BigQuery/test_cumulative_metric_with_non_adjustable_time_filter__plan0.sql index 7674932326..aaa5f4c03b 100644 --- a/tests_metricflow/snapshots/test_cumulative_metric_rendering.py/SqlQueryPlan/BigQuery/test_cumulative_metric_with_non_adjustable_time_filter__plan0.sql +++ b/tests_metricflow/snapshots/test_cumulative_metric_rendering.py/SqlQueryPlan/BigQuery/test_cumulative_metric_with_non_adjustable_time_filter__plan0.sql @@ -243,33 +243,33 @@ FROM ( , bookings_source_src_28000.booking_value AS approximate_continuous_booking_value_p99 , bookings_source_src_28000.booking_value AS approximate_discrete_booking_value_p99 , bookings_source_src_28000.is_instant - , DATE_TRUNC(bookings_source_src_28000.ds, day) AS ds__day - , DATE_TRUNC(bookings_source_src_28000.ds, isoweek) AS ds__week - , DATE_TRUNC(bookings_source_src_28000.ds, month) AS ds__month - , DATE_TRUNC(bookings_source_src_28000.ds, quarter) AS ds__quarter - , DATE_TRUNC(bookings_source_src_28000.ds, year) AS ds__year + , DATETIME_TRUNC(bookings_source_src_28000.ds, day) AS ds__day + , DATETIME_TRUNC(bookings_source_src_28000.ds, isoweek) AS ds__week + , DATETIME_TRUNC(bookings_source_src_28000.ds, month) AS ds__month + , DATETIME_TRUNC(bookings_source_src_28000.ds, quarter) AS ds__quarter + , DATETIME_TRUNC(bookings_source_src_28000.ds, year) AS ds__year , EXTRACT(year FROM bookings_source_src_28000.ds) AS ds__extract_year , EXTRACT(quarter FROM bookings_source_src_28000.ds) AS ds__extract_quarter , EXTRACT(month FROM bookings_source_src_28000.ds) AS ds__extract_month , EXTRACT(day FROM bookings_source_src_28000.ds) AS ds__extract_day , IF(EXTRACT(dayofweek FROM bookings_source_src_28000.ds) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_28000.ds) - 1) AS ds__extract_dow , EXTRACT(dayofyear FROM bookings_source_src_28000.ds) AS ds__extract_doy - , DATE_TRUNC(bookings_source_src_28000.ds_partitioned, day) AS ds_partitioned__day - , DATE_TRUNC(bookings_source_src_28000.ds_partitioned, isoweek) AS ds_partitioned__week - , DATE_TRUNC(bookings_source_src_28000.ds_partitioned, month) AS ds_partitioned__month - , DATE_TRUNC(bookings_source_src_28000.ds_partitioned, quarter) AS ds_partitioned__quarter - , DATE_TRUNC(bookings_source_src_28000.ds_partitioned, year) AS ds_partitioned__year + , DATETIME_TRUNC(bookings_source_src_28000.ds_partitioned, day) AS ds_partitioned__day + , DATETIME_TRUNC(bookings_source_src_28000.ds_partitioned, isoweek) AS ds_partitioned__week + , DATETIME_TRUNC(bookings_source_src_28000.ds_partitioned, month) AS ds_partitioned__month + , DATETIME_TRUNC(bookings_source_src_28000.ds_partitioned, quarter) AS ds_partitioned__quarter + , DATETIME_TRUNC(bookings_source_src_28000.ds_partitioned, year) AS ds_partitioned__year , EXTRACT(year FROM bookings_source_src_28000.ds_partitioned) AS ds_partitioned__extract_year , EXTRACT(quarter FROM bookings_source_src_28000.ds_partitioned) AS ds_partitioned__extract_quarter , EXTRACT(month FROM bookings_source_src_28000.ds_partitioned) AS ds_partitioned__extract_month , EXTRACT(day FROM bookings_source_src_28000.ds_partitioned) AS ds_partitioned__extract_day , IF(EXTRACT(dayofweek FROM bookings_source_src_28000.ds_partitioned) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_28000.ds_partitioned) - 1) AS ds_partitioned__extract_dow , EXTRACT(dayofyear FROM bookings_source_src_28000.ds_partitioned) AS ds_partitioned__extract_doy - , DATE_TRUNC(bookings_source_src_28000.paid_at, day) AS paid_at__day - , DATE_TRUNC(bookings_source_src_28000.paid_at, isoweek) AS paid_at__week - , DATE_TRUNC(bookings_source_src_28000.paid_at, month) AS paid_at__month - , DATE_TRUNC(bookings_source_src_28000.paid_at, quarter) AS paid_at__quarter - , DATE_TRUNC(bookings_source_src_28000.paid_at, year) AS paid_at__year + , DATETIME_TRUNC(bookings_source_src_28000.paid_at, day) AS paid_at__day + , DATETIME_TRUNC(bookings_source_src_28000.paid_at, isoweek) AS paid_at__week + , DATETIME_TRUNC(bookings_source_src_28000.paid_at, month) AS paid_at__month + , DATETIME_TRUNC(bookings_source_src_28000.paid_at, quarter) AS paid_at__quarter + , DATETIME_TRUNC(bookings_source_src_28000.paid_at, year) AS paid_at__year , EXTRACT(year FROM bookings_source_src_28000.paid_at) AS paid_at__extract_year , EXTRACT(quarter FROM bookings_source_src_28000.paid_at) AS paid_at__extract_quarter , EXTRACT(month FROM bookings_source_src_28000.paid_at) AS paid_at__extract_month @@ -277,33 +277,33 @@ FROM ( , IF(EXTRACT(dayofweek FROM bookings_source_src_28000.paid_at) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_28000.paid_at) - 1) AS paid_at__extract_dow , EXTRACT(dayofyear FROM bookings_source_src_28000.paid_at) AS paid_at__extract_doy , bookings_source_src_28000.is_instant AS booking__is_instant - , DATE_TRUNC(bookings_source_src_28000.ds, day) AS booking__ds__day - , DATE_TRUNC(bookings_source_src_28000.ds, isoweek) AS booking__ds__week - , DATE_TRUNC(bookings_source_src_28000.ds, month) AS booking__ds__month - , DATE_TRUNC(bookings_source_src_28000.ds, quarter) AS booking__ds__quarter - , DATE_TRUNC(bookings_source_src_28000.ds, year) AS booking__ds__year + , DATETIME_TRUNC(bookings_source_src_28000.ds, day) AS booking__ds__day + , DATETIME_TRUNC(bookings_source_src_28000.ds, isoweek) AS booking__ds__week + , DATETIME_TRUNC(bookings_source_src_28000.ds, month) AS booking__ds__month + , DATETIME_TRUNC(bookings_source_src_28000.ds, quarter) AS booking__ds__quarter + , DATETIME_TRUNC(bookings_source_src_28000.ds, year) AS booking__ds__year , EXTRACT(year FROM bookings_source_src_28000.ds) AS booking__ds__extract_year , EXTRACT(quarter FROM bookings_source_src_28000.ds) AS booking__ds__extract_quarter , EXTRACT(month FROM bookings_source_src_28000.ds) AS booking__ds__extract_month , EXTRACT(day FROM bookings_source_src_28000.ds) AS booking__ds__extract_day , IF(EXTRACT(dayofweek FROM bookings_source_src_28000.ds) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_28000.ds) - 1) AS booking__ds__extract_dow , EXTRACT(dayofyear FROM bookings_source_src_28000.ds) AS booking__ds__extract_doy - , DATE_TRUNC(bookings_source_src_28000.ds_partitioned, day) AS booking__ds_partitioned__day - , DATE_TRUNC(bookings_source_src_28000.ds_partitioned, isoweek) AS booking__ds_partitioned__week - , DATE_TRUNC(bookings_source_src_28000.ds_partitioned, month) AS booking__ds_partitioned__month - , DATE_TRUNC(bookings_source_src_28000.ds_partitioned, quarter) AS booking__ds_partitioned__quarter - , DATE_TRUNC(bookings_source_src_28000.ds_partitioned, year) AS booking__ds_partitioned__year + , DATETIME_TRUNC(bookings_source_src_28000.ds_partitioned, day) AS booking__ds_partitioned__day + , DATETIME_TRUNC(bookings_source_src_28000.ds_partitioned, isoweek) AS booking__ds_partitioned__week + , DATETIME_TRUNC(bookings_source_src_28000.ds_partitioned, month) AS booking__ds_partitioned__month + , DATETIME_TRUNC(bookings_source_src_28000.ds_partitioned, quarter) AS booking__ds_partitioned__quarter + , DATETIME_TRUNC(bookings_source_src_28000.ds_partitioned, year) AS booking__ds_partitioned__year , EXTRACT(year FROM bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__extract_year , EXTRACT(quarter FROM bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__extract_quarter , EXTRACT(month FROM bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__extract_month , EXTRACT(day FROM bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__extract_day , IF(EXTRACT(dayofweek FROM bookings_source_src_28000.ds_partitioned) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_28000.ds_partitioned) - 1) AS booking__ds_partitioned__extract_dow , EXTRACT(dayofyear FROM bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__extract_doy - , DATE_TRUNC(bookings_source_src_28000.paid_at, day) AS booking__paid_at__day - , DATE_TRUNC(bookings_source_src_28000.paid_at, isoweek) AS booking__paid_at__week - , DATE_TRUNC(bookings_source_src_28000.paid_at, month) AS booking__paid_at__month - , DATE_TRUNC(bookings_source_src_28000.paid_at, quarter) AS booking__paid_at__quarter - , DATE_TRUNC(bookings_source_src_28000.paid_at, year) AS booking__paid_at__year + , DATETIME_TRUNC(bookings_source_src_28000.paid_at, day) AS booking__paid_at__day + , DATETIME_TRUNC(bookings_source_src_28000.paid_at, isoweek) AS booking__paid_at__week + , DATETIME_TRUNC(bookings_source_src_28000.paid_at, month) AS booking__paid_at__month + , DATETIME_TRUNC(bookings_source_src_28000.paid_at, quarter) AS booking__paid_at__quarter + , DATETIME_TRUNC(bookings_source_src_28000.paid_at, year) AS booking__paid_at__year , EXTRACT(year FROM bookings_source_src_28000.paid_at) AS booking__paid_at__extract_year , EXTRACT(quarter FROM bookings_source_src_28000.paid_at) AS booking__paid_at__extract_quarter , EXTRACT(month FROM bookings_source_src_28000.paid_at) AS booking__paid_at__extract_month diff --git a/tests_metricflow/snapshots/test_cumulative_metric_rendering.py/SqlQueryPlan/BigQuery/test_cumulative_metric_with_non_adjustable_time_filter__plan0_optimized.sql b/tests_metricflow/snapshots/test_cumulative_metric_rendering.py/SqlQueryPlan/BigQuery/test_cumulative_metric_with_non_adjustable_time_filter__plan0_optimized.sql index c6110aba88..eed113f868 100644 --- a/tests_metricflow/snapshots/test_cumulative_metric_rendering.py/SqlQueryPlan/BigQuery/test_cumulative_metric_with_non_adjustable_time_filter__plan0_optimized.sql +++ b/tests_metricflow/snapshots/test_cumulative_metric_rendering.py/SqlQueryPlan/BigQuery/test_cumulative_metric_with_non_adjustable_time_filter__plan0_optimized.sql @@ -15,9 +15,9 @@ FROM ( ***************************.fct_bookings bookings_source_src_28000 ON ( - DATE_TRUNC(bookings_source_src_28000.ds, day) <= subq_11.ds + DATETIME_TRUNC(bookings_source_src_28000.ds, day) <= subq_11.ds ) AND ( - DATE_TRUNC(bookings_source_src_28000.ds, day) > DATE_SUB(CAST(subq_11.ds AS DATETIME), INTERVAL 2 day) + DATETIME_TRUNC(bookings_source_src_28000.ds, day) > DATE_SUB(CAST(subq_11.ds AS DATETIME), INTERVAL 2 day) ) ) subq_13 WHERE metric_time__day = '2020-01-03' or metric_time__day = '2020-01-07' diff --git a/tests_metricflow/snapshots/test_cumulative_metric_rendering.py/SqlQueryPlan/BigQuery/test_cumulative_metric_with_time_constraint__plan0.sql b/tests_metricflow/snapshots/test_cumulative_metric_rendering.py/SqlQueryPlan/BigQuery/test_cumulative_metric_with_time_constraint__plan0.sql index bb947e18b5..5bca01c1be 100644 --- a/tests_metricflow/snapshots/test_cumulative_metric_rendering.py/SqlQueryPlan/BigQuery/test_cumulative_metric_with_time_constraint__plan0.sql +++ b/tests_metricflow/snapshots/test_cumulative_metric_rendering.py/SqlQueryPlan/BigQuery/test_cumulative_metric_with_time_constraint__plan0.sql @@ -145,22 +145,22 @@ FROM ( -- Read Elements From Semantic Model 'revenue' SELECT revenue_src_28000.revenue AS txn_revenue - , DATE_TRUNC(revenue_src_28000.created_at, day) AS ds__day - , DATE_TRUNC(revenue_src_28000.created_at, isoweek) AS ds__week - , DATE_TRUNC(revenue_src_28000.created_at, month) AS ds__month - , DATE_TRUNC(revenue_src_28000.created_at, quarter) AS ds__quarter - , DATE_TRUNC(revenue_src_28000.created_at, year) AS ds__year + , DATETIME_TRUNC(revenue_src_28000.created_at, day) AS ds__day + , DATETIME_TRUNC(revenue_src_28000.created_at, isoweek) AS ds__week + , DATETIME_TRUNC(revenue_src_28000.created_at, month) AS ds__month + , DATETIME_TRUNC(revenue_src_28000.created_at, quarter) AS ds__quarter + , DATETIME_TRUNC(revenue_src_28000.created_at, year) AS ds__year , EXTRACT(year FROM revenue_src_28000.created_at) AS ds__extract_year , EXTRACT(quarter FROM revenue_src_28000.created_at) AS ds__extract_quarter , EXTRACT(month FROM revenue_src_28000.created_at) AS ds__extract_month , EXTRACT(day FROM revenue_src_28000.created_at) AS ds__extract_day , IF(EXTRACT(dayofweek FROM revenue_src_28000.created_at) = 1, 7, EXTRACT(dayofweek FROM revenue_src_28000.created_at) - 1) AS ds__extract_dow , EXTRACT(dayofyear FROM revenue_src_28000.created_at) AS ds__extract_doy - , DATE_TRUNC(revenue_src_28000.created_at, day) AS revenue_instance__ds__day - , DATE_TRUNC(revenue_src_28000.created_at, isoweek) AS revenue_instance__ds__week - , DATE_TRUNC(revenue_src_28000.created_at, month) AS revenue_instance__ds__month - , DATE_TRUNC(revenue_src_28000.created_at, quarter) AS revenue_instance__ds__quarter - , DATE_TRUNC(revenue_src_28000.created_at, year) AS revenue_instance__ds__year + , DATETIME_TRUNC(revenue_src_28000.created_at, day) AS revenue_instance__ds__day + , DATETIME_TRUNC(revenue_src_28000.created_at, isoweek) AS revenue_instance__ds__week + , DATETIME_TRUNC(revenue_src_28000.created_at, month) AS revenue_instance__ds__month + , DATETIME_TRUNC(revenue_src_28000.created_at, quarter) AS revenue_instance__ds__quarter + , DATETIME_TRUNC(revenue_src_28000.created_at, year) AS revenue_instance__ds__year , EXTRACT(year FROM revenue_src_28000.created_at) AS revenue_instance__ds__extract_year , EXTRACT(quarter FROM revenue_src_28000.created_at) AS revenue_instance__ds__extract_quarter , EXTRACT(month FROM revenue_src_28000.created_at) AS revenue_instance__ds__extract_month diff --git a/tests_metricflow/snapshots/test_cumulative_metric_rendering.py/SqlQueryPlan/BigQuery/test_cumulative_metric_with_time_constraint__plan0_optimized.sql b/tests_metricflow/snapshots/test_cumulative_metric_rendering.py/SqlQueryPlan/BigQuery/test_cumulative_metric_with_time_constraint__plan0_optimized.sql index 1e4219e5d2..45ff4f652b 100644 --- a/tests_metricflow/snapshots/test_cumulative_metric_rendering.py/SqlQueryPlan/BigQuery/test_cumulative_metric_with_time_constraint__plan0_optimized.sql +++ b/tests_metricflow/snapshots/test_cumulative_metric_rendering.py/SqlQueryPlan/BigQuery/test_cumulative_metric_with_time_constraint__plan0_optimized.sql @@ -18,10 +18,10 @@ INNER JOIN ( -- Metric Time Dimension 'ds' -- Constrain Time Range to [2019-11-01T00:00:00, 2020-01-01T00:00:00] SELECT - DATE_TRUNC(created_at, day) AS metric_time__day + DATETIME_TRUNC(created_at, day) AS metric_time__day , revenue AS txn_revenue FROM ***************************.fct_revenue revenue_src_28000 - WHERE DATE_TRUNC(created_at, day) BETWEEN '2019-11-01' AND '2020-01-01' + WHERE DATETIME_TRUNC(created_at, day) BETWEEN '2019-11-01' AND '2020-01-01' ) subq_13 ON ( diff --git a/tests_metricflow/snapshots/test_data_warehouse_tasks.py/str/BigQuery/test_build_metric_tasks__query0.sql b/tests_metricflow/snapshots/test_data_warehouse_tasks.py/str/BigQuery/test_build_metric_tasks__query0.sql index abb68a6f78..ef17f37a26 100644 --- a/tests_metricflow/snapshots/test_data_warehouse_tasks.py/str/BigQuery/test_build_metric_tasks__query0.sql +++ b/tests_metricflow/snapshots/test_data_warehouse_tasks.py/str/BigQuery/test_build_metric_tasks__query0.sql @@ -8,7 +8,7 @@ FROM ( -- Metric Time Dimension 'ds' -- Pass Only Elements: ['count_dogs', 'metric_time__day'] SELECT - DATE_TRUNC(ds, day) AS metric_time__day + DATETIME_TRUNC(ds, day) AS metric_time__day , 1 AS count_dogs FROM ***************************.fct_animals animals_src_10000 ) subq_2 diff --git a/tests_metricflow/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/BigQuery/test_combine_output_node__plan0.sql b/tests_metricflow/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/BigQuery/test_combine_output_node__plan0.sql index ede62dadf5..8181473805 100644 --- a/tests_metricflow/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/BigQuery/test_combine_output_node__plan0.sql +++ b/tests_metricflow/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/BigQuery/test_combine_output_node__plan0.sql @@ -32,33 +32,33 @@ FROM ( , bookings_source_src_28000.booking_value AS approximate_continuous_booking_value_p99 , bookings_source_src_28000.booking_value AS approximate_discrete_booking_value_p99 , bookings_source_src_28000.is_instant - , DATE_TRUNC(bookings_source_src_28000.ds, day) AS ds__day - , DATE_TRUNC(bookings_source_src_28000.ds, isoweek) AS ds__week - , DATE_TRUNC(bookings_source_src_28000.ds, month) AS ds__month - , DATE_TRUNC(bookings_source_src_28000.ds, quarter) AS ds__quarter - , DATE_TRUNC(bookings_source_src_28000.ds, year) AS ds__year + , DATETIME_TRUNC(bookings_source_src_28000.ds, day) AS ds__day + , DATETIME_TRUNC(bookings_source_src_28000.ds, isoweek) AS ds__week + , DATETIME_TRUNC(bookings_source_src_28000.ds, month) AS ds__month + , DATETIME_TRUNC(bookings_source_src_28000.ds, quarter) AS ds__quarter + , DATETIME_TRUNC(bookings_source_src_28000.ds, year) AS ds__year , EXTRACT(year FROM bookings_source_src_28000.ds) AS ds__extract_year , EXTRACT(quarter FROM bookings_source_src_28000.ds) AS ds__extract_quarter , EXTRACT(month FROM bookings_source_src_28000.ds) AS ds__extract_month , EXTRACT(day FROM bookings_source_src_28000.ds) AS ds__extract_day , IF(EXTRACT(dayofweek FROM bookings_source_src_28000.ds) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_28000.ds) - 1) AS ds__extract_dow , EXTRACT(dayofyear FROM bookings_source_src_28000.ds) AS ds__extract_doy - , DATE_TRUNC(bookings_source_src_28000.ds_partitioned, day) AS ds_partitioned__day - , DATE_TRUNC(bookings_source_src_28000.ds_partitioned, isoweek) AS ds_partitioned__week - , DATE_TRUNC(bookings_source_src_28000.ds_partitioned, month) AS ds_partitioned__month - , DATE_TRUNC(bookings_source_src_28000.ds_partitioned, quarter) AS ds_partitioned__quarter - , DATE_TRUNC(bookings_source_src_28000.ds_partitioned, year) AS ds_partitioned__year + , DATETIME_TRUNC(bookings_source_src_28000.ds_partitioned, day) AS ds_partitioned__day + , DATETIME_TRUNC(bookings_source_src_28000.ds_partitioned, isoweek) AS ds_partitioned__week + , DATETIME_TRUNC(bookings_source_src_28000.ds_partitioned, month) AS ds_partitioned__month + , DATETIME_TRUNC(bookings_source_src_28000.ds_partitioned, quarter) AS ds_partitioned__quarter + , DATETIME_TRUNC(bookings_source_src_28000.ds_partitioned, year) AS ds_partitioned__year , EXTRACT(year FROM bookings_source_src_28000.ds_partitioned) AS ds_partitioned__extract_year , EXTRACT(quarter FROM bookings_source_src_28000.ds_partitioned) AS ds_partitioned__extract_quarter , EXTRACT(month FROM bookings_source_src_28000.ds_partitioned) AS ds_partitioned__extract_month , EXTRACT(day FROM bookings_source_src_28000.ds_partitioned) AS ds_partitioned__extract_day , IF(EXTRACT(dayofweek FROM bookings_source_src_28000.ds_partitioned) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_28000.ds_partitioned) - 1) AS ds_partitioned__extract_dow , EXTRACT(dayofyear FROM bookings_source_src_28000.ds_partitioned) AS ds_partitioned__extract_doy - , DATE_TRUNC(bookings_source_src_28000.paid_at, day) AS paid_at__day - , DATE_TRUNC(bookings_source_src_28000.paid_at, isoweek) AS paid_at__week - , DATE_TRUNC(bookings_source_src_28000.paid_at, month) AS paid_at__month - , DATE_TRUNC(bookings_source_src_28000.paid_at, quarter) AS paid_at__quarter - , DATE_TRUNC(bookings_source_src_28000.paid_at, year) AS paid_at__year + , DATETIME_TRUNC(bookings_source_src_28000.paid_at, day) AS paid_at__day + , DATETIME_TRUNC(bookings_source_src_28000.paid_at, isoweek) AS paid_at__week + , DATETIME_TRUNC(bookings_source_src_28000.paid_at, month) AS paid_at__month + , DATETIME_TRUNC(bookings_source_src_28000.paid_at, quarter) AS paid_at__quarter + , DATETIME_TRUNC(bookings_source_src_28000.paid_at, year) AS paid_at__year , EXTRACT(year FROM bookings_source_src_28000.paid_at) AS paid_at__extract_year , EXTRACT(quarter FROM bookings_source_src_28000.paid_at) AS paid_at__extract_quarter , EXTRACT(month FROM bookings_source_src_28000.paid_at) AS paid_at__extract_month @@ -66,33 +66,33 @@ FROM ( , IF(EXTRACT(dayofweek FROM bookings_source_src_28000.paid_at) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_28000.paid_at) - 1) AS paid_at__extract_dow , EXTRACT(dayofyear FROM bookings_source_src_28000.paid_at) AS paid_at__extract_doy , bookings_source_src_28000.is_instant AS booking__is_instant - , DATE_TRUNC(bookings_source_src_28000.ds, day) AS booking__ds__day - , DATE_TRUNC(bookings_source_src_28000.ds, isoweek) AS booking__ds__week - , DATE_TRUNC(bookings_source_src_28000.ds, month) AS booking__ds__month - , DATE_TRUNC(bookings_source_src_28000.ds, quarter) AS booking__ds__quarter - , DATE_TRUNC(bookings_source_src_28000.ds, year) AS booking__ds__year + , DATETIME_TRUNC(bookings_source_src_28000.ds, day) AS booking__ds__day + , DATETIME_TRUNC(bookings_source_src_28000.ds, isoweek) AS booking__ds__week + , DATETIME_TRUNC(bookings_source_src_28000.ds, month) AS booking__ds__month + , DATETIME_TRUNC(bookings_source_src_28000.ds, quarter) AS booking__ds__quarter + , DATETIME_TRUNC(bookings_source_src_28000.ds, year) AS booking__ds__year , EXTRACT(year FROM bookings_source_src_28000.ds) AS booking__ds__extract_year , EXTRACT(quarter FROM bookings_source_src_28000.ds) AS booking__ds__extract_quarter , EXTRACT(month FROM bookings_source_src_28000.ds) AS booking__ds__extract_month , EXTRACT(day FROM bookings_source_src_28000.ds) AS booking__ds__extract_day , IF(EXTRACT(dayofweek FROM bookings_source_src_28000.ds) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_28000.ds) - 1) AS booking__ds__extract_dow , EXTRACT(dayofyear FROM bookings_source_src_28000.ds) AS booking__ds__extract_doy - , DATE_TRUNC(bookings_source_src_28000.ds_partitioned, day) AS booking__ds_partitioned__day - , DATE_TRUNC(bookings_source_src_28000.ds_partitioned, isoweek) AS booking__ds_partitioned__week - , DATE_TRUNC(bookings_source_src_28000.ds_partitioned, month) AS booking__ds_partitioned__month - , DATE_TRUNC(bookings_source_src_28000.ds_partitioned, quarter) AS booking__ds_partitioned__quarter - , DATE_TRUNC(bookings_source_src_28000.ds_partitioned, year) AS booking__ds_partitioned__year + , DATETIME_TRUNC(bookings_source_src_28000.ds_partitioned, day) AS booking__ds_partitioned__day + , DATETIME_TRUNC(bookings_source_src_28000.ds_partitioned, isoweek) AS booking__ds_partitioned__week + , DATETIME_TRUNC(bookings_source_src_28000.ds_partitioned, month) AS booking__ds_partitioned__month + , DATETIME_TRUNC(bookings_source_src_28000.ds_partitioned, quarter) AS booking__ds_partitioned__quarter + , DATETIME_TRUNC(bookings_source_src_28000.ds_partitioned, year) AS booking__ds_partitioned__year , EXTRACT(year FROM bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__extract_year , EXTRACT(quarter FROM bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__extract_quarter , EXTRACT(month FROM bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__extract_month , EXTRACT(day FROM bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__extract_day , IF(EXTRACT(dayofweek FROM bookings_source_src_28000.ds_partitioned) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_28000.ds_partitioned) - 1) AS booking__ds_partitioned__extract_dow , EXTRACT(dayofyear FROM bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__extract_doy - , DATE_TRUNC(bookings_source_src_28000.paid_at, day) AS booking__paid_at__day - , DATE_TRUNC(bookings_source_src_28000.paid_at, isoweek) AS booking__paid_at__week - , DATE_TRUNC(bookings_source_src_28000.paid_at, month) AS booking__paid_at__month - , DATE_TRUNC(bookings_source_src_28000.paid_at, quarter) AS booking__paid_at__quarter - , DATE_TRUNC(bookings_source_src_28000.paid_at, year) AS booking__paid_at__year + , DATETIME_TRUNC(bookings_source_src_28000.paid_at, day) AS booking__paid_at__day + , DATETIME_TRUNC(bookings_source_src_28000.paid_at, isoweek) AS booking__paid_at__week + , DATETIME_TRUNC(bookings_source_src_28000.paid_at, month) AS booking__paid_at__month + , DATETIME_TRUNC(bookings_source_src_28000.paid_at, quarter) AS booking__paid_at__quarter + , DATETIME_TRUNC(bookings_source_src_28000.paid_at, year) AS booking__paid_at__year , EXTRACT(year FROM bookings_source_src_28000.paid_at) AS booking__paid_at__extract_year , EXTRACT(quarter FROM bookings_source_src_28000.paid_at) AS booking__paid_at__extract_quarter , EXTRACT(month FROM bookings_source_src_28000.paid_at) AS booking__paid_at__extract_month @@ -141,33 +141,33 @@ FULL OUTER JOIN ( , bookings_source_src_28000.booking_value AS approximate_continuous_booking_value_p99 , bookings_source_src_28000.booking_value AS approximate_discrete_booking_value_p99 , bookings_source_src_28000.is_instant - , DATE_TRUNC(bookings_source_src_28000.ds, day) AS ds__day - , DATE_TRUNC(bookings_source_src_28000.ds, isoweek) AS ds__week - , DATE_TRUNC(bookings_source_src_28000.ds, month) AS ds__month - , DATE_TRUNC(bookings_source_src_28000.ds, quarter) AS ds__quarter - , DATE_TRUNC(bookings_source_src_28000.ds, year) AS ds__year + , DATETIME_TRUNC(bookings_source_src_28000.ds, day) AS ds__day + , DATETIME_TRUNC(bookings_source_src_28000.ds, isoweek) AS ds__week + , DATETIME_TRUNC(bookings_source_src_28000.ds, month) AS ds__month + , DATETIME_TRUNC(bookings_source_src_28000.ds, quarter) AS ds__quarter + , DATETIME_TRUNC(bookings_source_src_28000.ds, year) AS ds__year , EXTRACT(year FROM bookings_source_src_28000.ds) AS ds__extract_year , EXTRACT(quarter FROM bookings_source_src_28000.ds) AS ds__extract_quarter , EXTRACT(month FROM bookings_source_src_28000.ds) AS ds__extract_month , EXTRACT(day FROM bookings_source_src_28000.ds) AS ds__extract_day , IF(EXTRACT(dayofweek FROM bookings_source_src_28000.ds) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_28000.ds) - 1) AS ds__extract_dow , EXTRACT(dayofyear FROM bookings_source_src_28000.ds) AS ds__extract_doy - , DATE_TRUNC(bookings_source_src_28000.ds_partitioned, day) AS ds_partitioned__day - , DATE_TRUNC(bookings_source_src_28000.ds_partitioned, isoweek) AS ds_partitioned__week - , DATE_TRUNC(bookings_source_src_28000.ds_partitioned, month) AS ds_partitioned__month - , DATE_TRUNC(bookings_source_src_28000.ds_partitioned, quarter) AS ds_partitioned__quarter - , DATE_TRUNC(bookings_source_src_28000.ds_partitioned, year) AS ds_partitioned__year + , DATETIME_TRUNC(bookings_source_src_28000.ds_partitioned, day) AS ds_partitioned__day + , DATETIME_TRUNC(bookings_source_src_28000.ds_partitioned, isoweek) AS ds_partitioned__week + , DATETIME_TRUNC(bookings_source_src_28000.ds_partitioned, month) AS ds_partitioned__month + , DATETIME_TRUNC(bookings_source_src_28000.ds_partitioned, quarter) AS ds_partitioned__quarter + , DATETIME_TRUNC(bookings_source_src_28000.ds_partitioned, year) AS ds_partitioned__year , EXTRACT(year FROM bookings_source_src_28000.ds_partitioned) AS ds_partitioned__extract_year , EXTRACT(quarter FROM bookings_source_src_28000.ds_partitioned) AS ds_partitioned__extract_quarter , EXTRACT(month FROM bookings_source_src_28000.ds_partitioned) AS ds_partitioned__extract_month , EXTRACT(day FROM bookings_source_src_28000.ds_partitioned) AS ds_partitioned__extract_day , IF(EXTRACT(dayofweek FROM bookings_source_src_28000.ds_partitioned) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_28000.ds_partitioned) - 1) AS ds_partitioned__extract_dow , EXTRACT(dayofyear FROM bookings_source_src_28000.ds_partitioned) AS ds_partitioned__extract_doy - , DATE_TRUNC(bookings_source_src_28000.paid_at, day) AS paid_at__day - , DATE_TRUNC(bookings_source_src_28000.paid_at, isoweek) AS paid_at__week - , DATE_TRUNC(bookings_source_src_28000.paid_at, month) AS paid_at__month - , DATE_TRUNC(bookings_source_src_28000.paid_at, quarter) AS paid_at__quarter - , DATE_TRUNC(bookings_source_src_28000.paid_at, year) AS paid_at__year + , DATETIME_TRUNC(bookings_source_src_28000.paid_at, day) AS paid_at__day + , DATETIME_TRUNC(bookings_source_src_28000.paid_at, isoweek) AS paid_at__week + , DATETIME_TRUNC(bookings_source_src_28000.paid_at, month) AS paid_at__month + , DATETIME_TRUNC(bookings_source_src_28000.paid_at, quarter) AS paid_at__quarter + , DATETIME_TRUNC(bookings_source_src_28000.paid_at, year) AS paid_at__year , EXTRACT(year FROM bookings_source_src_28000.paid_at) AS paid_at__extract_year , EXTRACT(quarter FROM bookings_source_src_28000.paid_at) AS paid_at__extract_quarter , EXTRACT(month FROM bookings_source_src_28000.paid_at) AS paid_at__extract_month @@ -175,33 +175,33 @@ FULL OUTER JOIN ( , IF(EXTRACT(dayofweek FROM bookings_source_src_28000.paid_at) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_28000.paid_at) - 1) AS paid_at__extract_dow , EXTRACT(dayofyear FROM bookings_source_src_28000.paid_at) AS paid_at__extract_doy , bookings_source_src_28000.is_instant AS booking__is_instant - , DATE_TRUNC(bookings_source_src_28000.ds, day) AS booking__ds__day - , DATE_TRUNC(bookings_source_src_28000.ds, isoweek) AS booking__ds__week - , DATE_TRUNC(bookings_source_src_28000.ds, month) AS booking__ds__month - , DATE_TRUNC(bookings_source_src_28000.ds, quarter) AS booking__ds__quarter - , DATE_TRUNC(bookings_source_src_28000.ds, year) AS booking__ds__year + , DATETIME_TRUNC(bookings_source_src_28000.ds, day) AS booking__ds__day + , DATETIME_TRUNC(bookings_source_src_28000.ds, isoweek) AS booking__ds__week + , DATETIME_TRUNC(bookings_source_src_28000.ds, month) AS booking__ds__month + , DATETIME_TRUNC(bookings_source_src_28000.ds, quarter) AS booking__ds__quarter + , DATETIME_TRUNC(bookings_source_src_28000.ds, year) AS booking__ds__year , EXTRACT(year FROM bookings_source_src_28000.ds) AS booking__ds__extract_year , EXTRACT(quarter FROM bookings_source_src_28000.ds) AS booking__ds__extract_quarter , EXTRACT(month FROM bookings_source_src_28000.ds) AS booking__ds__extract_month , EXTRACT(day FROM bookings_source_src_28000.ds) AS booking__ds__extract_day , IF(EXTRACT(dayofweek FROM bookings_source_src_28000.ds) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_28000.ds) - 1) AS booking__ds__extract_dow , EXTRACT(dayofyear FROM bookings_source_src_28000.ds) AS booking__ds__extract_doy - , DATE_TRUNC(bookings_source_src_28000.ds_partitioned, day) AS booking__ds_partitioned__day - , DATE_TRUNC(bookings_source_src_28000.ds_partitioned, isoweek) AS booking__ds_partitioned__week - , DATE_TRUNC(bookings_source_src_28000.ds_partitioned, month) AS booking__ds_partitioned__month - , DATE_TRUNC(bookings_source_src_28000.ds_partitioned, quarter) AS booking__ds_partitioned__quarter - , DATE_TRUNC(bookings_source_src_28000.ds_partitioned, year) AS booking__ds_partitioned__year + , DATETIME_TRUNC(bookings_source_src_28000.ds_partitioned, day) AS booking__ds_partitioned__day + , DATETIME_TRUNC(bookings_source_src_28000.ds_partitioned, isoweek) AS booking__ds_partitioned__week + , DATETIME_TRUNC(bookings_source_src_28000.ds_partitioned, month) AS booking__ds_partitioned__month + , DATETIME_TRUNC(bookings_source_src_28000.ds_partitioned, quarter) AS booking__ds_partitioned__quarter + , DATETIME_TRUNC(bookings_source_src_28000.ds_partitioned, year) AS booking__ds_partitioned__year , EXTRACT(year FROM bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__extract_year , EXTRACT(quarter FROM bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__extract_quarter , EXTRACT(month FROM bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__extract_month , EXTRACT(day FROM bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__extract_day , IF(EXTRACT(dayofweek FROM bookings_source_src_28000.ds_partitioned) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_28000.ds_partitioned) - 1) AS booking__ds_partitioned__extract_dow , EXTRACT(dayofyear FROM bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__extract_doy - , DATE_TRUNC(bookings_source_src_28000.paid_at, day) AS booking__paid_at__day - , DATE_TRUNC(bookings_source_src_28000.paid_at, isoweek) AS booking__paid_at__week - , DATE_TRUNC(bookings_source_src_28000.paid_at, month) AS booking__paid_at__month - , DATE_TRUNC(bookings_source_src_28000.paid_at, quarter) AS booking__paid_at__quarter - , DATE_TRUNC(bookings_source_src_28000.paid_at, year) AS booking__paid_at__year + , DATETIME_TRUNC(bookings_source_src_28000.paid_at, day) AS booking__paid_at__day + , DATETIME_TRUNC(bookings_source_src_28000.paid_at, isoweek) AS booking__paid_at__week + , DATETIME_TRUNC(bookings_source_src_28000.paid_at, month) AS booking__paid_at__month + , DATETIME_TRUNC(bookings_source_src_28000.paid_at, quarter) AS booking__paid_at__quarter + , DATETIME_TRUNC(bookings_source_src_28000.paid_at, year) AS booking__paid_at__year , EXTRACT(year FROM bookings_source_src_28000.paid_at) AS booking__paid_at__extract_year , EXTRACT(quarter FROM bookings_source_src_28000.paid_at) AS booking__paid_at__extract_quarter , EXTRACT(month FROM bookings_source_src_28000.paid_at) AS booking__paid_at__extract_month diff --git a/tests_metricflow/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/BigQuery/test_compute_metrics_node__plan0.sql b/tests_metricflow/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/BigQuery/test_compute_metrics_node__plan0.sql index 1d9350f10b..3ea6e9c003 100644 --- a/tests_metricflow/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/BigQuery/test_compute_metrics_node__plan0.sql +++ b/tests_metricflow/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/BigQuery/test_compute_metrics_node__plan0.sql @@ -38,33 +38,33 @@ FROM ( , bookings_source_src_28000.booking_value AS approximate_continuous_booking_value_p99 , bookings_source_src_28000.booking_value AS approximate_discrete_booking_value_p99 , bookings_source_src_28000.is_instant - , DATE_TRUNC(bookings_source_src_28000.ds, day) AS ds__day - , DATE_TRUNC(bookings_source_src_28000.ds, isoweek) AS ds__week - , DATE_TRUNC(bookings_source_src_28000.ds, month) AS ds__month - , DATE_TRUNC(bookings_source_src_28000.ds, quarter) AS ds__quarter - , DATE_TRUNC(bookings_source_src_28000.ds, year) AS ds__year + , DATETIME_TRUNC(bookings_source_src_28000.ds, day) AS ds__day + , DATETIME_TRUNC(bookings_source_src_28000.ds, isoweek) AS ds__week + , DATETIME_TRUNC(bookings_source_src_28000.ds, month) AS ds__month + , DATETIME_TRUNC(bookings_source_src_28000.ds, quarter) AS ds__quarter + , DATETIME_TRUNC(bookings_source_src_28000.ds, year) AS ds__year , EXTRACT(year FROM bookings_source_src_28000.ds) AS ds__extract_year , EXTRACT(quarter FROM bookings_source_src_28000.ds) AS ds__extract_quarter , EXTRACT(month FROM bookings_source_src_28000.ds) AS ds__extract_month , EXTRACT(day FROM bookings_source_src_28000.ds) AS ds__extract_day , IF(EXTRACT(dayofweek FROM bookings_source_src_28000.ds) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_28000.ds) - 1) AS ds__extract_dow , EXTRACT(dayofyear FROM bookings_source_src_28000.ds) AS ds__extract_doy - , DATE_TRUNC(bookings_source_src_28000.ds_partitioned, day) AS ds_partitioned__day - , DATE_TRUNC(bookings_source_src_28000.ds_partitioned, isoweek) AS ds_partitioned__week - , DATE_TRUNC(bookings_source_src_28000.ds_partitioned, month) AS ds_partitioned__month - , DATE_TRUNC(bookings_source_src_28000.ds_partitioned, quarter) AS ds_partitioned__quarter - , DATE_TRUNC(bookings_source_src_28000.ds_partitioned, year) AS ds_partitioned__year + , DATETIME_TRUNC(bookings_source_src_28000.ds_partitioned, day) AS ds_partitioned__day + , DATETIME_TRUNC(bookings_source_src_28000.ds_partitioned, isoweek) AS ds_partitioned__week + , DATETIME_TRUNC(bookings_source_src_28000.ds_partitioned, month) AS ds_partitioned__month + , DATETIME_TRUNC(bookings_source_src_28000.ds_partitioned, quarter) AS ds_partitioned__quarter + , DATETIME_TRUNC(bookings_source_src_28000.ds_partitioned, year) AS ds_partitioned__year , EXTRACT(year FROM bookings_source_src_28000.ds_partitioned) AS ds_partitioned__extract_year , EXTRACT(quarter FROM bookings_source_src_28000.ds_partitioned) AS ds_partitioned__extract_quarter , EXTRACT(month FROM bookings_source_src_28000.ds_partitioned) AS ds_partitioned__extract_month , EXTRACT(day FROM bookings_source_src_28000.ds_partitioned) AS ds_partitioned__extract_day , IF(EXTRACT(dayofweek FROM bookings_source_src_28000.ds_partitioned) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_28000.ds_partitioned) - 1) AS ds_partitioned__extract_dow , EXTRACT(dayofyear FROM bookings_source_src_28000.ds_partitioned) AS ds_partitioned__extract_doy - , DATE_TRUNC(bookings_source_src_28000.paid_at, day) AS paid_at__day - , DATE_TRUNC(bookings_source_src_28000.paid_at, isoweek) AS paid_at__week - , DATE_TRUNC(bookings_source_src_28000.paid_at, month) AS paid_at__month - , DATE_TRUNC(bookings_source_src_28000.paid_at, quarter) AS paid_at__quarter - , DATE_TRUNC(bookings_source_src_28000.paid_at, year) AS paid_at__year + , DATETIME_TRUNC(bookings_source_src_28000.paid_at, day) AS paid_at__day + , DATETIME_TRUNC(bookings_source_src_28000.paid_at, isoweek) AS paid_at__week + , DATETIME_TRUNC(bookings_source_src_28000.paid_at, month) AS paid_at__month + , DATETIME_TRUNC(bookings_source_src_28000.paid_at, quarter) AS paid_at__quarter + , DATETIME_TRUNC(bookings_source_src_28000.paid_at, year) AS paid_at__year , EXTRACT(year FROM bookings_source_src_28000.paid_at) AS paid_at__extract_year , EXTRACT(quarter FROM bookings_source_src_28000.paid_at) AS paid_at__extract_quarter , EXTRACT(month FROM bookings_source_src_28000.paid_at) AS paid_at__extract_month @@ -72,33 +72,33 @@ FROM ( , IF(EXTRACT(dayofweek FROM bookings_source_src_28000.paid_at) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_28000.paid_at) - 1) AS paid_at__extract_dow , EXTRACT(dayofyear FROM bookings_source_src_28000.paid_at) AS paid_at__extract_doy , bookings_source_src_28000.is_instant AS booking__is_instant - , DATE_TRUNC(bookings_source_src_28000.ds, day) AS booking__ds__day - , DATE_TRUNC(bookings_source_src_28000.ds, isoweek) AS booking__ds__week - , DATE_TRUNC(bookings_source_src_28000.ds, month) AS booking__ds__month - , DATE_TRUNC(bookings_source_src_28000.ds, quarter) AS booking__ds__quarter - , DATE_TRUNC(bookings_source_src_28000.ds, year) AS booking__ds__year + , DATETIME_TRUNC(bookings_source_src_28000.ds, day) AS booking__ds__day + , DATETIME_TRUNC(bookings_source_src_28000.ds, isoweek) AS booking__ds__week + , DATETIME_TRUNC(bookings_source_src_28000.ds, month) AS booking__ds__month + , DATETIME_TRUNC(bookings_source_src_28000.ds, quarter) AS booking__ds__quarter + , DATETIME_TRUNC(bookings_source_src_28000.ds, year) AS booking__ds__year , EXTRACT(year FROM bookings_source_src_28000.ds) AS booking__ds__extract_year , EXTRACT(quarter FROM bookings_source_src_28000.ds) AS booking__ds__extract_quarter , EXTRACT(month FROM bookings_source_src_28000.ds) AS booking__ds__extract_month , EXTRACT(day FROM bookings_source_src_28000.ds) AS booking__ds__extract_day , IF(EXTRACT(dayofweek FROM bookings_source_src_28000.ds) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_28000.ds) - 1) AS booking__ds__extract_dow , EXTRACT(dayofyear FROM bookings_source_src_28000.ds) AS booking__ds__extract_doy - , DATE_TRUNC(bookings_source_src_28000.ds_partitioned, day) AS booking__ds_partitioned__day - , DATE_TRUNC(bookings_source_src_28000.ds_partitioned, isoweek) AS booking__ds_partitioned__week - , DATE_TRUNC(bookings_source_src_28000.ds_partitioned, month) AS booking__ds_partitioned__month - , DATE_TRUNC(bookings_source_src_28000.ds_partitioned, quarter) AS booking__ds_partitioned__quarter - , DATE_TRUNC(bookings_source_src_28000.ds_partitioned, year) AS booking__ds_partitioned__year + , DATETIME_TRUNC(bookings_source_src_28000.ds_partitioned, day) AS booking__ds_partitioned__day + , DATETIME_TRUNC(bookings_source_src_28000.ds_partitioned, isoweek) AS booking__ds_partitioned__week + , DATETIME_TRUNC(bookings_source_src_28000.ds_partitioned, month) AS booking__ds_partitioned__month + , DATETIME_TRUNC(bookings_source_src_28000.ds_partitioned, quarter) AS booking__ds_partitioned__quarter + , DATETIME_TRUNC(bookings_source_src_28000.ds_partitioned, year) AS booking__ds_partitioned__year , EXTRACT(year FROM bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__extract_year , EXTRACT(quarter FROM bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__extract_quarter , EXTRACT(month FROM bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__extract_month , EXTRACT(day FROM bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__extract_day , IF(EXTRACT(dayofweek FROM bookings_source_src_28000.ds_partitioned) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_28000.ds_partitioned) - 1) AS booking__ds_partitioned__extract_dow , EXTRACT(dayofyear FROM bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__extract_doy - , DATE_TRUNC(bookings_source_src_28000.paid_at, day) AS booking__paid_at__day - , DATE_TRUNC(bookings_source_src_28000.paid_at, isoweek) AS booking__paid_at__week - , DATE_TRUNC(bookings_source_src_28000.paid_at, month) AS booking__paid_at__month - , DATE_TRUNC(bookings_source_src_28000.paid_at, quarter) AS booking__paid_at__quarter - , DATE_TRUNC(bookings_source_src_28000.paid_at, year) AS booking__paid_at__year + , DATETIME_TRUNC(bookings_source_src_28000.paid_at, day) AS booking__paid_at__day + , DATETIME_TRUNC(bookings_source_src_28000.paid_at, isoweek) AS booking__paid_at__week + , DATETIME_TRUNC(bookings_source_src_28000.paid_at, month) AS booking__paid_at__month + , DATETIME_TRUNC(bookings_source_src_28000.paid_at, quarter) AS booking__paid_at__quarter + , DATETIME_TRUNC(bookings_source_src_28000.paid_at, year) AS booking__paid_at__year , EXTRACT(year FROM bookings_source_src_28000.paid_at) AS booking__paid_at__extract_year , EXTRACT(quarter FROM bookings_source_src_28000.paid_at) AS booking__paid_at__extract_quarter , EXTRACT(month FROM bookings_source_src_28000.paid_at) AS booking__paid_at__extract_month @@ -125,22 +125,22 @@ FROM ( 1 AS listings , listings_latest_src_28000.capacity AS largest_listing , listings_latest_src_28000.capacity AS smallest_listing - , DATE_TRUNC(listings_latest_src_28000.created_at, day) AS ds__day - , DATE_TRUNC(listings_latest_src_28000.created_at, isoweek) AS ds__week - , DATE_TRUNC(listings_latest_src_28000.created_at, month) AS ds__month - , DATE_TRUNC(listings_latest_src_28000.created_at, quarter) AS ds__quarter - , DATE_TRUNC(listings_latest_src_28000.created_at, year) AS ds__year + , DATETIME_TRUNC(listings_latest_src_28000.created_at, day) AS ds__day + , DATETIME_TRUNC(listings_latest_src_28000.created_at, isoweek) AS ds__week + , DATETIME_TRUNC(listings_latest_src_28000.created_at, month) AS ds__month + , DATETIME_TRUNC(listings_latest_src_28000.created_at, quarter) AS ds__quarter + , DATETIME_TRUNC(listings_latest_src_28000.created_at, year) AS ds__year , EXTRACT(year FROM listings_latest_src_28000.created_at) AS ds__extract_year , EXTRACT(quarter FROM listings_latest_src_28000.created_at) AS ds__extract_quarter , EXTRACT(month FROM listings_latest_src_28000.created_at) AS ds__extract_month , EXTRACT(day FROM listings_latest_src_28000.created_at) AS ds__extract_day , IF(EXTRACT(dayofweek FROM listings_latest_src_28000.created_at) = 1, 7, EXTRACT(dayofweek FROM listings_latest_src_28000.created_at) - 1) AS ds__extract_dow , EXTRACT(dayofyear FROM listings_latest_src_28000.created_at) AS ds__extract_doy - , DATE_TRUNC(listings_latest_src_28000.created_at, day) AS created_at__day - , DATE_TRUNC(listings_latest_src_28000.created_at, isoweek) AS created_at__week - , DATE_TRUNC(listings_latest_src_28000.created_at, month) AS created_at__month - , DATE_TRUNC(listings_latest_src_28000.created_at, quarter) AS created_at__quarter - , DATE_TRUNC(listings_latest_src_28000.created_at, year) AS created_at__year + , DATETIME_TRUNC(listings_latest_src_28000.created_at, day) AS created_at__day + , DATETIME_TRUNC(listings_latest_src_28000.created_at, isoweek) AS created_at__week + , DATETIME_TRUNC(listings_latest_src_28000.created_at, month) AS created_at__month + , DATETIME_TRUNC(listings_latest_src_28000.created_at, quarter) AS created_at__quarter + , DATETIME_TRUNC(listings_latest_src_28000.created_at, year) AS created_at__year , EXTRACT(year FROM listings_latest_src_28000.created_at) AS created_at__extract_year , EXTRACT(quarter FROM listings_latest_src_28000.created_at) AS created_at__extract_quarter , EXTRACT(month FROM listings_latest_src_28000.created_at) AS created_at__extract_month @@ -150,22 +150,22 @@ FROM ( , listings_latest_src_28000.country AS country_latest , listings_latest_src_28000.is_lux AS is_lux_latest , listings_latest_src_28000.capacity AS capacity_latest - , DATE_TRUNC(listings_latest_src_28000.created_at, day) AS listing__ds__day - , DATE_TRUNC(listings_latest_src_28000.created_at, isoweek) AS listing__ds__week - , DATE_TRUNC(listings_latest_src_28000.created_at, month) AS listing__ds__month - , DATE_TRUNC(listings_latest_src_28000.created_at, quarter) AS listing__ds__quarter - , DATE_TRUNC(listings_latest_src_28000.created_at, year) AS listing__ds__year + , DATETIME_TRUNC(listings_latest_src_28000.created_at, day) AS listing__ds__day + , DATETIME_TRUNC(listings_latest_src_28000.created_at, isoweek) AS listing__ds__week + , DATETIME_TRUNC(listings_latest_src_28000.created_at, month) AS listing__ds__month + , DATETIME_TRUNC(listings_latest_src_28000.created_at, quarter) AS listing__ds__quarter + , DATETIME_TRUNC(listings_latest_src_28000.created_at, year) AS listing__ds__year , EXTRACT(year FROM listings_latest_src_28000.created_at) AS listing__ds__extract_year , EXTRACT(quarter FROM listings_latest_src_28000.created_at) AS listing__ds__extract_quarter , EXTRACT(month FROM listings_latest_src_28000.created_at) AS listing__ds__extract_month , EXTRACT(day FROM listings_latest_src_28000.created_at) AS listing__ds__extract_day , IF(EXTRACT(dayofweek FROM listings_latest_src_28000.created_at) = 1, 7, EXTRACT(dayofweek FROM listings_latest_src_28000.created_at) - 1) AS listing__ds__extract_dow , EXTRACT(dayofyear FROM listings_latest_src_28000.created_at) AS listing__ds__extract_doy - , DATE_TRUNC(listings_latest_src_28000.created_at, day) AS listing__created_at__day - , DATE_TRUNC(listings_latest_src_28000.created_at, isoweek) AS listing__created_at__week - , DATE_TRUNC(listings_latest_src_28000.created_at, month) AS listing__created_at__month - , DATE_TRUNC(listings_latest_src_28000.created_at, quarter) AS listing__created_at__quarter - , DATE_TRUNC(listings_latest_src_28000.created_at, year) AS listing__created_at__year + , DATETIME_TRUNC(listings_latest_src_28000.created_at, day) AS listing__created_at__day + , DATETIME_TRUNC(listings_latest_src_28000.created_at, isoweek) AS listing__created_at__week + , DATETIME_TRUNC(listings_latest_src_28000.created_at, month) AS listing__created_at__month + , DATETIME_TRUNC(listings_latest_src_28000.created_at, quarter) AS listing__created_at__quarter + , DATETIME_TRUNC(listings_latest_src_28000.created_at, year) AS listing__created_at__year , EXTRACT(year FROM listings_latest_src_28000.created_at) AS listing__created_at__extract_year , EXTRACT(quarter FROM listings_latest_src_28000.created_at) AS listing__created_at__extract_quarter , EXTRACT(month FROM listings_latest_src_28000.created_at) AS listing__created_at__extract_month diff --git a/tests_metricflow/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/BigQuery/test_compute_metrics_node_ratio_from_multiple_semantic_models__plan0.sql b/tests_metricflow/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/BigQuery/test_compute_metrics_node_ratio_from_multiple_semantic_models__plan0.sql index 8cb6091547..91f5187a93 100644 --- a/tests_metricflow/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/BigQuery/test_compute_metrics_node_ratio_from_multiple_semantic_models__plan0.sql +++ b/tests_metricflow/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/BigQuery/test_compute_metrics_node_ratio_from_multiple_semantic_models__plan0.sql @@ -160,33 +160,33 @@ FROM ( , bookings_source_src_28000.booking_value AS approximate_continuous_booking_value_p99 , bookings_source_src_28000.booking_value AS approximate_discrete_booking_value_p99 , bookings_source_src_28000.is_instant - , DATE_TRUNC(bookings_source_src_28000.ds, day) AS ds__day - , DATE_TRUNC(bookings_source_src_28000.ds, isoweek) AS ds__week - , DATE_TRUNC(bookings_source_src_28000.ds, month) AS ds__month - , DATE_TRUNC(bookings_source_src_28000.ds, quarter) AS ds__quarter - , DATE_TRUNC(bookings_source_src_28000.ds, year) AS ds__year + , DATETIME_TRUNC(bookings_source_src_28000.ds, day) AS ds__day + , DATETIME_TRUNC(bookings_source_src_28000.ds, isoweek) AS ds__week + , DATETIME_TRUNC(bookings_source_src_28000.ds, month) AS ds__month + , DATETIME_TRUNC(bookings_source_src_28000.ds, quarter) AS ds__quarter + , DATETIME_TRUNC(bookings_source_src_28000.ds, year) AS ds__year , EXTRACT(year FROM bookings_source_src_28000.ds) AS ds__extract_year , EXTRACT(quarter FROM bookings_source_src_28000.ds) AS ds__extract_quarter , EXTRACT(month FROM bookings_source_src_28000.ds) AS ds__extract_month , EXTRACT(day FROM bookings_source_src_28000.ds) AS ds__extract_day , IF(EXTRACT(dayofweek FROM bookings_source_src_28000.ds) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_28000.ds) - 1) AS ds__extract_dow , EXTRACT(dayofyear FROM bookings_source_src_28000.ds) AS ds__extract_doy - , DATE_TRUNC(bookings_source_src_28000.ds_partitioned, day) AS ds_partitioned__day - , DATE_TRUNC(bookings_source_src_28000.ds_partitioned, isoweek) AS ds_partitioned__week - , DATE_TRUNC(bookings_source_src_28000.ds_partitioned, month) AS ds_partitioned__month - , DATE_TRUNC(bookings_source_src_28000.ds_partitioned, quarter) AS ds_partitioned__quarter - , DATE_TRUNC(bookings_source_src_28000.ds_partitioned, year) AS ds_partitioned__year + , DATETIME_TRUNC(bookings_source_src_28000.ds_partitioned, day) AS ds_partitioned__day + , DATETIME_TRUNC(bookings_source_src_28000.ds_partitioned, isoweek) AS ds_partitioned__week + , DATETIME_TRUNC(bookings_source_src_28000.ds_partitioned, month) AS ds_partitioned__month + , DATETIME_TRUNC(bookings_source_src_28000.ds_partitioned, quarter) AS ds_partitioned__quarter + , DATETIME_TRUNC(bookings_source_src_28000.ds_partitioned, year) AS ds_partitioned__year , EXTRACT(year FROM bookings_source_src_28000.ds_partitioned) AS ds_partitioned__extract_year , EXTRACT(quarter FROM bookings_source_src_28000.ds_partitioned) AS ds_partitioned__extract_quarter , EXTRACT(month FROM bookings_source_src_28000.ds_partitioned) AS ds_partitioned__extract_month , EXTRACT(day FROM bookings_source_src_28000.ds_partitioned) AS ds_partitioned__extract_day , IF(EXTRACT(dayofweek FROM bookings_source_src_28000.ds_partitioned) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_28000.ds_partitioned) - 1) AS ds_partitioned__extract_dow , EXTRACT(dayofyear FROM bookings_source_src_28000.ds_partitioned) AS ds_partitioned__extract_doy - , DATE_TRUNC(bookings_source_src_28000.paid_at, day) AS paid_at__day - , DATE_TRUNC(bookings_source_src_28000.paid_at, isoweek) AS paid_at__week - , DATE_TRUNC(bookings_source_src_28000.paid_at, month) AS paid_at__month - , DATE_TRUNC(bookings_source_src_28000.paid_at, quarter) AS paid_at__quarter - , DATE_TRUNC(bookings_source_src_28000.paid_at, year) AS paid_at__year + , DATETIME_TRUNC(bookings_source_src_28000.paid_at, day) AS paid_at__day + , DATETIME_TRUNC(bookings_source_src_28000.paid_at, isoweek) AS paid_at__week + , DATETIME_TRUNC(bookings_source_src_28000.paid_at, month) AS paid_at__month + , DATETIME_TRUNC(bookings_source_src_28000.paid_at, quarter) AS paid_at__quarter + , DATETIME_TRUNC(bookings_source_src_28000.paid_at, year) AS paid_at__year , EXTRACT(year FROM bookings_source_src_28000.paid_at) AS paid_at__extract_year , EXTRACT(quarter FROM bookings_source_src_28000.paid_at) AS paid_at__extract_quarter , EXTRACT(month FROM bookings_source_src_28000.paid_at) AS paid_at__extract_month @@ -194,33 +194,33 @@ FROM ( , IF(EXTRACT(dayofweek FROM bookings_source_src_28000.paid_at) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_28000.paid_at) - 1) AS paid_at__extract_dow , EXTRACT(dayofyear FROM bookings_source_src_28000.paid_at) AS paid_at__extract_doy , bookings_source_src_28000.is_instant AS booking__is_instant - , DATE_TRUNC(bookings_source_src_28000.ds, day) AS booking__ds__day - , DATE_TRUNC(bookings_source_src_28000.ds, isoweek) AS booking__ds__week - , DATE_TRUNC(bookings_source_src_28000.ds, month) AS booking__ds__month - , DATE_TRUNC(bookings_source_src_28000.ds, quarter) AS booking__ds__quarter - , DATE_TRUNC(bookings_source_src_28000.ds, year) AS booking__ds__year + , DATETIME_TRUNC(bookings_source_src_28000.ds, day) AS booking__ds__day + , DATETIME_TRUNC(bookings_source_src_28000.ds, isoweek) AS booking__ds__week + , DATETIME_TRUNC(bookings_source_src_28000.ds, month) AS booking__ds__month + , DATETIME_TRUNC(bookings_source_src_28000.ds, quarter) AS booking__ds__quarter + , DATETIME_TRUNC(bookings_source_src_28000.ds, year) AS booking__ds__year , EXTRACT(year FROM bookings_source_src_28000.ds) AS booking__ds__extract_year , EXTRACT(quarter FROM bookings_source_src_28000.ds) AS booking__ds__extract_quarter , EXTRACT(month FROM bookings_source_src_28000.ds) AS booking__ds__extract_month , EXTRACT(day FROM bookings_source_src_28000.ds) AS booking__ds__extract_day , IF(EXTRACT(dayofweek FROM bookings_source_src_28000.ds) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_28000.ds) - 1) AS booking__ds__extract_dow , EXTRACT(dayofyear FROM bookings_source_src_28000.ds) AS booking__ds__extract_doy - , DATE_TRUNC(bookings_source_src_28000.ds_partitioned, day) AS booking__ds_partitioned__day - , DATE_TRUNC(bookings_source_src_28000.ds_partitioned, isoweek) AS booking__ds_partitioned__week - , DATE_TRUNC(bookings_source_src_28000.ds_partitioned, month) AS booking__ds_partitioned__month - , DATE_TRUNC(bookings_source_src_28000.ds_partitioned, quarter) AS booking__ds_partitioned__quarter - , DATE_TRUNC(bookings_source_src_28000.ds_partitioned, year) AS booking__ds_partitioned__year + , DATETIME_TRUNC(bookings_source_src_28000.ds_partitioned, day) AS booking__ds_partitioned__day + , DATETIME_TRUNC(bookings_source_src_28000.ds_partitioned, isoweek) AS booking__ds_partitioned__week + , DATETIME_TRUNC(bookings_source_src_28000.ds_partitioned, month) AS booking__ds_partitioned__month + , DATETIME_TRUNC(bookings_source_src_28000.ds_partitioned, quarter) AS booking__ds_partitioned__quarter + , DATETIME_TRUNC(bookings_source_src_28000.ds_partitioned, year) AS booking__ds_partitioned__year , EXTRACT(year FROM bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__extract_year , EXTRACT(quarter FROM bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__extract_quarter , EXTRACT(month FROM bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__extract_month , EXTRACT(day FROM bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__extract_day , IF(EXTRACT(dayofweek FROM bookings_source_src_28000.ds_partitioned) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_28000.ds_partitioned) - 1) AS booking__ds_partitioned__extract_dow , EXTRACT(dayofyear FROM bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__extract_doy - , DATE_TRUNC(bookings_source_src_28000.paid_at, day) AS booking__paid_at__day - , DATE_TRUNC(bookings_source_src_28000.paid_at, isoweek) AS booking__paid_at__week - , DATE_TRUNC(bookings_source_src_28000.paid_at, month) AS booking__paid_at__month - , DATE_TRUNC(bookings_source_src_28000.paid_at, quarter) AS booking__paid_at__quarter - , DATE_TRUNC(bookings_source_src_28000.paid_at, year) AS booking__paid_at__year + , DATETIME_TRUNC(bookings_source_src_28000.paid_at, day) AS booking__paid_at__day + , DATETIME_TRUNC(bookings_source_src_28000.paid_at, isoweek) AS booking__paid_at__week + , DATETIME_TRUNC(bookings_source_src_28000.paid_at, month) AS booking__paid_at__month + , DATETIME_TRUNC(bookings_source_src_28000.paid_at, quarter) AS booking__paid_at__quarter + , DATETIME_TRUNC(bookings_source_src_28000.paid_at, year) AS booking__paid_at__year , EXTRACT(year FROM bookings_source_src_28000.paid_at) AS booking__paid_at__extract_year , EXTRACT(quarter FROM bookings_source_src_28000.paid_at) AS booking__paid_at__extract_quarter , EXTRACT(month FROM bookings_source_src_28000.paid_at) AS booking__paid_at__extract_month @@ -318,22 +318,22 @@ FROM ( 1 AS listings , listings_latest_src_28000.capacity AS largest_listing , listings_latest_src_28000.capacity AS smallest_listing - , DATE_TRUNC(listings_latest_src_28000.created_at, day) AS ds__day - , DATE_TRUNC(listings_latest_src_28000.created_at, isoweek) AS ds__week - , DATE_TRUNC(listings_latest_src_28000.created_at, month) AS ds__month - , DATE_TRUNC(listings_latest_src_28000.created_at, quarter) AS ds__quarter - , DATE_TRUNC(listings_latest_src_28000.created_at, year) AS ds__year + , DATETIME_TRUNC(listings_latest_src_28000.created_at, day) AS ds__day + , DATETIME_TRUNC(listings_latest_src_28000.created_at, isoweek) AS ds__week + , DATETIME_TRUNC(listings_latest_src_28000.created_at, month) AS ds__month + , DATETIME_TRUNC(listings_latest_src_28000.created_at, quarter) AS ds__quarter + , DATETIME_TRUNC(listings_latest_src_28000.created_at, year) AS ds__year , EXTRACT(year FROM listings_latest_src_28000.created_at) AS ds__extract_year , EXTRACT(quarter FROM listings_latest_src_28000.created_at) AS ds__extract_quarter , EXTRACT(month FROM listings_latest_src_28000.created_at) AS ds__extract_month , EXTRACT(day FROM listings_latest_src_28000.created_at) AS ds__extract_day , IF(EXTRACT(dayofweek FROM listings_latest_src_28000.created_at) = 1, 7, EXTRACT(dayofweek FROM listings_latest_src_28000.created_at) - 1) AS ds__extract_dow , EXTRACT(dayofyear FROM listings_latest_src_28000.created_at) AS ds__extract_doy - , DATE_TRUNC(listings_latest_src_28000.created_at, day) AS created_at__day - , DATE_TRUNC(listings_latest_src_28000.created_at, isoweek) AS created_at__week - , DATE_TRUNC(listings_latest_src_28000.created_at, month) AS created_at__month - , DATE_TRUNC(listings_latest_src_28000.created_at, quarter) AS created_at__quarter - , DATE_TRUNC(listings_latest_src_28000.created_at, year) AS created_at__year + , DATETIME_TRUNC(listings_latest_src_28000.created_at, day) AS created_at__day + , DATETIME_TRUNC(listings_latest_src_28000.created_at, isoweek) AS created_at__week + , DATETIME_TRUNC(listings_latest_src_28000.created_at, month) AS created_at__month + , DATETIME_TRUNC(listings_latest_src_28000.created_at, quarter) AS created_at__quarter + , DATETIME_TRUNC(listings_latest_src_28000.created_at, year) AS created_at__year , EXTRACT(year FROM listings_latest_src_28000.created_at) AS created_at__extract_year , EXTRACT(quarter FROM listings_latest_src_28000.created_at) AS created_at__extract_quarter , EXTRACT(month FROM listings_latest_src_28000.created_at) AS created_at__extract_month @@ -343,22 +343,22 @@ FROM ( , listings_latest_src_28000.country AS country_latest , listings_latest_src_28000.is_lux AS is_lux_latest , listings_latest_src_28000.capacity AS capacity_latest - , DATE_TRUNC(listings_latest_src_28000.created_at, day) AS listing__ds__day - , DATE_TRUNC(listings_latest_src_28000.created_at, isoweek) AS listing__ds__week - , DATE_TRUNC(listings_latest_src_28000.created_at, month) AS listing__ds__month - , DATE_TRUNC(listings_latest_src_28000.created_at, quarter) AS listing__ds__quarter - , DATE_TRUNC(listings_latest_src_28000.created_at, year) AS listing__ds__year + , DATETIME_TRUNC(listings_latest_src_28000.created_at, day) AS listing__ds__day + , DATETIME_TRUNC(listings_latest_src_28000.created_at, isoweek) AS listing__ds__week + , DATETIME_TRUNC(listings_latest_src_28000.created_at, month) AS listing__ds__month + , DATETIME_TRUNC(listings_latest_src_28000.created_at, quarter) AS listing__ds__quarter + , DATETIME_TRUNC(listings_latest_src_28000.created_at, year) AS listing__ds__year , EXTRACT(year FROM listings_latest_src_28000.created_at) AS listing__ds__extract_year , EXTRACT(quarter FROM listings_latest_src_28000.created_at) AS listing__ds__extract_quarter , EXTRACT(month FROM listings_latest_src_28000.created_at) AS listing__ds__extract_month , EXTRACT(day FROM listings_latest_src_28000.created_at) AS listing__ds__extract_day , IF(EXTRACT(dayofweek FROM listings_latest_src_28000.created_at) = 1, 7, EXTRACT(dayofweek FROM listings_latest_src_28000.created_at) - 1) AS listing__ds__extract_dow , EXTRACT(dayofyear FROM listings_latest_src_28000.created_at) AS listing__ds__extract_doy - , DATE_TRUNC(listings_latest_src_28000.created_at, day) AS listing__created_at__day - , DATE_TRUNC(listings_latest_src_28000.created_at, isoweek) AS listing__created_at__week - , DATE_TRUNC(listings_latest_src_28000.created_at, month) AS listing__created_at__month - , DATE_TRUNC(listings_latest_src_28000.created_at, quarter) AS listing__created_at__quarter - , DATE_TRUNC(listings_latest_src_28000.created_at, year) AS listing__created_at__year + , DATETIME_TRUNC(listings_latest_src_28000.created_at, day) AS listing__created_at__day + , DATETIME_TRUNC(listings_latest_src_28000.created_at, isoweek) AS listing__created_at__week + , DATETIME_TRUNC(listings_latest_src_28000.created_at, month) AS listing__created_at__month + , DATETIME_TRUNC(listings_latest_src_28000.created_at, quarter) AS listing__created_at__quarter + , DATETIME_TRUNC(listings_latest_src_28000.created_at, year) AS listing__created_at__year , EXTRACT(year FROM listings_latest_src_28000.created_at) AS listing__created_at__extract_year , EXTRACT(quarter FROM listings_latest_src_28000.created_at) AS listing__created_at__extract_quarter , EXTRACT(month FROM listings_latest_src_28000.created_at) AS listing__created_at__extract_month @@ -482,44 +482,44 @@ FROM ( -- Read Elements From Semantic Model 'views_source' SELECT 1 AS views - , DATE_TRUNC(views_source_src_28000.ds, day) AS ds__day - , DATE_TRUNC(views_source_src_28000.ds, isoweek) AS ds__week - , DATE_TRUNC(views_source_src_28000.ds, month) AS ds__month - , DATE_TRUNC(views_source_src_28000.ds, quarter) AS ds__quarter - , DATE_TRUNC(views_source_src_28000.ds, year) AS ds__year + , DATETIME_TRUNC(views_source_src_28000.ds, day) AS ds__day + , DATETIME_TRUNC(views_source_src_28000.ds, isoweek) AS ds__week + , DATETIME_TRUNC(views_source_src_28000.ds, month) AS ds__month + , DATETIME_TRUNC(views_source_src_28000.ds, quarter) AS ds__quarter + , DATETIME_TRUNC(views_source_src_28000.ds, year) AS ds__year , EXTRACT(year FROM views_source_src_28000.ds) AS ds__extract_year , EXTRACT(quarter FROM views_source_src_28000.ds) AS ds__extract_quarter , EXTRACT(month FROM views_source_src_28000.ds) AS ds__extract_month , EXTRACT(day FROM views_source_src_28000.ds) AS ds__extract_day , IF(EXTRACT(dayofweek FROM views_source_src_28000.ds) = 1, 7, EXTRACT(dayofweek FROM views_source_src_28000.ds) - 1) AS ds__extract_dow , EXTRACT(dayofyear FROM views_source_src_28000.ds) AS ds__extract_doy - , DATE_TRUNC(views_source_src_28000.ds_partitioned, day) AS ds_partitioned__day - , DATE_TRUNC(views_source_src_28000.ds_partitioned, isoweek) AS ds_partitioned__week - , DATE_TRUNC(views_source_src_28000.ds_partitioned, month) AS ds_partitioned__month - , DATE_TRUNC(views_source_src_28000.ds_partitioned, quarter) AS ds_partitioned__quarter - , DATE_TRUNC(views_source_src_28000.ds_partitioned, year) AS ds_partitioned__year + , DATETIME_TRUNC(views_source_src_28000.ds_partitioned, day) AS ds_partitioned__day + , DATETIME_TRUNC(views_source_src_28000.ds_partitioned, isoweek) AS ds_partitioned__week + , DATETIME_TRUNC(views_source_src_28000.ds_partitioned, month) AS ds_partitioned__month + , DATETIME_TRUNC(views_source_src_28000.ds_partitioned, quarter) AS ds_partitioned__quarter + , DATETIME_TRUNC(views_source_src_28000.ds_partitioned, year) AS ds_partitioned__year , EXTRACT(year FROM views_source_src_28000.ds_partitioned) AS ds_partitioned__extract_year , EXTRACT(quarter FROM views_source_src_28000.ds_partitioned) AS ds_partitioned__extract_quarter , EXTRACT(month FROM views_source_src_28000.ds_partitioned) AS ds_partitioned__extract_month , EXTRACT(day FROM views_source_src_28000.ds_partitioned) AS ds_partitioned__extract_day , IF(EXTRACT(dayofweek FROM views_source_src_28000.ds_partitioned) = 1, 7, EXTRACT(dayofweek FROM views_source_src_28000.ds_partitioned) - 1) AS ds_partitioned__extract_dow , EXTRACT(dayofyear FROM views_source_src_28000.ds_partitioned) AS ds_partitioned__extract_doy - , DATE_TRUNC(views_source_src_28000.ds, day) AS view__ds__day - , DATE_TRUNC(views_source_src_28000.ds, isoweek) AS view__ds__week - , DATE_TRUNC(views_source_src_28000.ds, month) AS view__ds__month - , DATE_TRUNC(views_source_src_28000.ds, quarter) AS view__ds__quarter - , DATE_TRUNC(views_source_src_28000.ds, year) AS view__ds__year + , DATETIME_TRUNC(views_source_src_28000.ds, day) AS view__ds__day + , DATETIME_TRUNC(views_source_src_28000.ds, isoweek) AS view__ds__week + , DATETIME_TRUNC(views_source_src_28000.ds, month) AS view__ds__month + , DATETIME_TRUNC(views_source_src_28000.ds, quarter) AS view__ds__quarter + , DATETIME_TRUNC(views_source_src_28000.ds, year) AS view__ds__year , EXTRACT(year FROM views_source_src_28000.ds) AS view__ds__extract_year , EXTRACT(quarter FROM views_source_src_28000.ds) AS view__ds__extract_quarter , EXTRACT(month FROM views_source_src_28000.ds) AS view__ds__extract_month , EXTRACT(day FROM views_source_src_28000.ds) AS view__ds__extract_day , IF(EXTRACT(dayofweek FROM views_source_src_28000.ds) = 1, 7, EXTRACT(dayofweek FROM views_source_src_28000.ds) - 1) AS view__ds__extract_dow , EXTRACT(dayofyear FROM views_source_src_28000.ds) AS view__ds__extract_doy - , DATE_TRUNC(views_source_src_28000.ds_partitioned, day) AS view__ds_partitioned__day - , DATE_TRUNC(views_source_src_28000.ds_partitioned, isoweek) AS view__ds_partitioned__week - , DATE_TRUNC(views_source_src_28000.ds_partitioned, month) AS view__ds_partitioned__month - , DATE_TRUNC(views_source_src_28000.ds_partitioned, quarter) AS view__ds_partitioned__quarter - , DATE_TRUNC(views_source_src_28000.ds_partitioned, year) AS view__ds_partitioned__year + , DATETIME_TRUNC(views_source_src_28000.ds_partitioned, day) AS view__ds_partitioned__day + , DATETIME_TRUNC(views_source_src_28000.ds_partitioned, isoweek) AS view__ds_partitioned__week + , DATETIME_TRUNC(views_source_src_28000.ds_partitioned, month) AS view__ds_partitioned__month + , DATETIME_TRUNC(views_source_src_28000.ds_partitioned, quarter) AS view__ds_partitioned__quarter + , DATETIME_TRUNC(views_source_src_28000.ds_partitioned, year) AS view__ds_partitioned__year , EXTRACT(year FROM views_source_src_28000.ds_partitioned) AS view__ds_partitioned__extract_year , EXTRACT(quarter FROM views_source_src_28000.ds_partitioned) AS view__ds_partitioned__extract_quarter , EXTRACT(month FROM views_source_src_28000.ds_partitioned) AS view__ds_partitioned__extract_month @@ -615,22 +615,22 @@ FROM ( 1 AS listings , listings_latest_src_28000.capacity AS largest_listing , listings_latest_src_28000.capacity AS smallest_listing - , DATE_TRUNC(listings_latest_src_28000.created_at, day) AS ds__day - , DATE_TRUNC(listings_latest_src_28000.created_at, isoweek) AS ds__week - , DATE_TRUNC(listings_latest_src_28000.created_at, month) AS ds__month - , DATE_TRUNC(listings_latest_src_28000.created_at, quarter) AS ds__quarter - , DATE_TRUNC(listings_latest_src_28000.created_at, year) AS ds__year + , DATETIME_TRUNC(listings_latest_src_28000.created_at, day) AS ds__day + , DATETIME_TRUNC(listings_latest_src_28000.created_at, isoweek) AS ds__week + , DATETIME_TRUNC(listings_latest_src_28000.created_at, month) AS ds__month + , DATETIME_TRUNC(listings_latest_src_28000.created_at, quarter) AS ds__quarter + , DATETIME_TRUNC(listings_latest_src_28000.created_at, year) AS ds__year , EXTRACT(year FROM listings_latest_src_28000.created_at) AS ds__extract_year , EXTRACT(quarter FROM listings_latest_src_28000.created_at) AS ds__extract_quarter , EXTRACT(month FROM listings_latest_src_28000.created_at) AS ds__extract_month , EXTRACT(day FROM listings_latest_src_28000.created_at) AS ds__extract_day , IF(EXTRACT(dayofweek FROM listings_latest_src_28000.created_at) = 1, 7, EXTRACT(dayofweek FROM listings_latest_src_28000.created_at) - 1) AS ds__extract_dow , EXTRACT(dayofyear FROM listings_latest_src_28000.created_at) AS ds__extract_doy - , DATE_TRUNC(listings_latest_src_28000.created_at, day) AS created_at__day - , DATE_TRUNC(listings_latest_src_28000.created_at, isoweek) AS created_at__week - , DATE_TRUNC(listings_latest_src_28000.created_at, month) AS created_at__month - , DATE_TRUNC(listings_latest_src_28000.created_at, quarter) AS created_at__quarter - , DATE_TRUNC(listings_latest_src_28000.created_at, year) AS created_at__year + , DATETIME_TRUNC(listings_latest_src_28000.created_at, day) AS created_at__day + , DATETIME_TRUNC(listings_latest_src_28000.created_at, isoweek) AS created_at__week + , DATETIME_TRUNC(listings_latest_src_28000.created_at, month) AS created_at__month + , DATETIME_TRUNC(listings_latest_src_28000.created_at, quarter) AS created_at__quarter + , DATETIME_TRUNC(listings_latest_src_28000.created_at, year) AS created_at__year , EXTRACT(year FROM listings_latest_src_28000.created_at) AS created_at__extract_year , EXTRACT(quarter FROM listings_latest_src_28000.created_at) AS created_at__extract_quarter , EXTRACT(month FROM listings_latest_src_28000.created_at) AS created_at__extract_month @@ -640,22 +640,22 @@ FROM ( , listings_latest_src_28000.country AS country_latest , listings_latest_src_28000.is_lux AS is_lux_latest , listings_latest_src_28000.capacity AS capacity_latest - , DATE_TRUNC(listings_latest_src_28000.created_at, day) AS listing__ds__day - , DATE_TRUNC(listings_latest_src_28000.created_at, isoweek) AS listing__ds__week - , DATE_TRUNC(listings_latest_src_28000.created_at, month) AS listing__ds__month - , DATE_TRUNC(listings_latest_src_28000.created_at, quarter) AS listing__ds__quarter - , DATE_TRUNC(listings_latest_src_28000.created_at, year) AS listing__ds__year + , DATETIME_TRUNC(listings_latest_src_28000.created_at, day) AS listing__ds__day + , DATETIME_TRUNC(listings_latest_src_28000.created_at, isoweek) AS listing__ds__week + , DATETIME_TRUNC(listings_latest_src_28000.created_at, month) AS listing__ds__month + , DATETIME_TRUNC(listings_latest_src_28000.created_at, quarter) AS listing__ds__quarter + , DATETIME_TRUNC(listings_latest_src_28000.created_at, year) AS listing__ds__year , EXTRACT(year FROM listings_latest_src_28000.created_at) AS listing__ds__extract_year , EXTRACT(quarter FROM listings_latest_src_28000.created_at) AS listing__ds__extract_quarter , EXTRACT(month FROM listings_latest_src_28000.created_at) AS listing__ds__extract_month , EXTRACT(day FROM listings_latest_src_28000.created_at) AS listing__ds__extract_day , IF(EXTRACT(dayofweek FROM listings_latest_src_28000.created_at) = 1, 7, EXTRACT(dayofweek FROM listings_latest_src_28000.created_at) - 1) AS listing__ds__extract_dow , EXTRACT(dayofyear FROM listings_latest_src_28000.created_at) AS listing__ds__extract_doy - , DATE_TRUNC(listings_latest_src_28000.created_at, day) AS listing__created_at__day - , DATE_TRUNC(listings_latest_src_28000.created_at, isoweek) AS listing__created_at__week - , DATE_TRUNC(listings_latest_src_28000.created_at, month) AS listing__created_at__month - , DATE_TRUNC(listings_latest_src_28000.created_at, quarter) AS listing__created_at__quarter - , DATE_TRUNC(listings_latest_src_28000.created_at, year) AS listing__created_at__year + , DATETIME_TRUNC(listings_latest_src_28000.created_at, day) AS listing__created_at__day + , DATETIME_TRUNC(listings_latest_src_28000.created_at, isoweek) AS listing__created_at__week + , DATETIME_TRUNC(listings_latest_src_28000.created_at, month) AS listing__created_at__month + , DATETIME_TRUNC(listings_latest_src_28000.created_at, quarter) AS listing__created_at__quarter + , DATETIME_TRUNC(listings_latest_src_28000.created_at, year) AS listing__created_at__year , EXTRACT(year FROM listings_latest_src_28000.created_at) AS listing__created_at__extract_year , EXTRACT(quarter FROM listings_latest_src_28000.created_at) AS listing__created_at__extract_quarter , EXTRACT(month FROM listings_latest_src_28000.created_at) AS listing__created_at__extract_month diff --git a/tests_metricflow/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/BigQuery/test_compute_metrics_node_ratio_from_multiple_semantic_models__plan0_optimized.sql b/tests_metricflow/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/BigQuery/test_compute_metrics_node_ratio_from_multiple_semantic_models__plan0_optimized.sql index 1e8f092074..89de78b140 100644 --- a/tests_metricflow/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/BigQuery/test_compute_metrics_node_ratio_from_multiple_semantic_models__plan0_optimized.sql +++ b/tests_metricflow/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/BigQuery/test_compute_metrics_node_ratio_from_multiple_semantic_models__plan0_optimized.sql @@ -24,7 +24,7 @@ FROM ( -- Metric Time Dimension 'ds' -- Pass Only Elements: ['bookings', 'ds__day', 'listing'] SELECT - DATE_TRUNC(ds, day) AS ds__day + DATETIME_TRUNC(ds, day) AS ds__day , listing_id AS listing , 1 AS bookings FROM ***************************.fct_bookings bookings_source_src_28000 @@ -51,7 +51,7 @@ FROM ( -- Metric Time Dimension 'ds' -- Pass Only Elements: ['views', 'ds__day', 'listing'] SELECT - DATE_TRUNC(ds, day) AS ds__day + DATETIME_TRUNC(ds, day) AS ds__day , listing_id AS listing , 1 AS views FROM ***************************.fct_views views_source_src_28000 diff --git a/tests_metricflow/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/BigQuery/test_compute_metrics_node_ratio_from_single_semantic_model__plan0.sql b/tests_metricflow/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/BigQuery/test_compute_metrics_node_ratio_from_single_semantic_model__plan0.sql index 53c5458c05..780bfddd2f 100644 --- a/tests_metricflow/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/BigQuery/test_compute_metrics_node_ratio_from_single_semantic_model__plan0.sql +++ b/tests_metricflow/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/BigQuery/test_compute_metrics_node_ratio_from_single_semantic_model__plan0.sql @@ -41,33 +41,33 @@ FROM ( , bookings_source_src_28000.booking_value AS approximate_continuous_booking_value_p99 , bookings_source_src_28000.booking_value AS approximate_discrete_booking_value_p99 , bookings_source_src_28000.is_instant - , DATE_TRUNC(bookings_source_src_28000.ds, day) AS ds__day - , DATE_TRUNC(bookings_source_src_28000.ds, isoweek) AS ds__week - , DATE_TRUNC(bookings_source_src_28000.ds, month) AS ds__month - , DATE_TRUNC(bookings_source_src_28000.ds, quarter) AS ds__quarter - , DATE_TRUNC(bookings_source_src_28000.ds, year) AS ds__year + , DATETIME_TRUNC(bookings_source_src_28000.ds, day) AS ds__day + , DATETIME_TRUNC(bookings_source_src_28000.ds, isoweek) AS ds__week + , DATETIME_TRUNC(bookings_source_src_28000.ds, month) AS ds__month + , DATETIME_TRUNC(bookings_source_src_28000.ds, quarter) AS ds__quarter + , DATETIME_TRUNC(bookings_source_src_28000.ds, year) AS ds__year , EXTRACT(year FROM bookings_source_src_28000.ds) AS ds__extract_year , EXTRACT(quarter FROM bookings_source_src_28000.ds) AS ds__extract_quarter , EXTRACT(month FROM bookings_source_src_28000.ds) AS ds__extract_month , EXTRACT(day FROM bookings_source_src_28000.ds) AS ds__extract_day , IF(EXTRACT(dayofweek FROM bookings_source_src_28000.ds) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_28000.ds) - 1) AS ds__extract_dow , EXTRACT(dayofyear FROM bookings_source_src_28000.ds) AS ds__extract_doy - , DATE_TRUNC(bookings_source_src_28000.ds_partitioned, day) AS ds_partitioned__day - , DATE_TRUNC(bookings_source_src_28000.ds_partitioned, isoweek) AS ds_partitioned__week - , DATE_TRUNC(bookings_source_src_28000.ds_partitioned, month) AS ds_partitioned__month - , DATE_TRUNC(bookings_source_src_28000.ds_partitioned, quarter) AS ds_partitioned__quarter - , DATE_TRUNC(bookings_source_src_28000.ds_partitioned, year) AS ds_partitioned__year + , DATETIME_TRUNC(bookings_source_src_28000.ds_partitioned, day) AS ds_partitioned__day + , DATETIME_TRUNC(bookings_source_src_28000.ds_partitioned, isoweek) AS ds_partitioned__week + , DATETIME_TRUNC(bookings_source_src_28000.ds_partitioned, month) AS ds_partitioned__month + , DATETIME_TRUNC(bookings_source_src_28000.ds_partitioned, quarter) AS ds_partitioned__quarter + , DATETIME_TRUNC(bookings_source_src_28000.ds_partitioned, year) AS ds_partitioned__year , EXTRACT(year FROM bookings_source_src_28000.ds_partitioned) AS ds_partitioned__extract_year , EXTRACT(quarter FROM bookings_source_src_28000.ds_partitioned) AS ds_partitioned__extract_quarter , EXTRACT(month FROM bookings_source_src_28000.ds_partitioned) AS ds_partitioned__extract_month , EXTRACT(day FROM bookings_source_src_28000.ds_partitioned) AS ds_partitioned__extract_day , IF(EXTRACT(dayofweek FROM bookings_source_src_28000.ds_partitioned) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_28000.ds_partitioned) - 1) AS ds_partitioned__extract_dow , EXTRACT(dayofyear FROM bookings_source_src_28000.ds_partitioned) AS ds_partitioned__extract_doy - , DATE_TRUNC(bookings_source_src_28000.paid_at, day) AS paid_at__day - , DATE_TRUNC(bookings_source_src_28000.paid_at, isoweek) AS paid_at__week - , DATE_TRUNC(bookings_source_src_28000.paid_at, month) AS paid_at__month - , DATE_TRUNC(bookings_source_src_28000.paid_at, quarter) AS paid_at__quarter - , DATE_TRUNC(bookings_source_src_28000.paid_at, year) AS paid_at__year + , DATETIME_TRUNC(bookings_source_src_28000.paid_at, day) AS paid_at__day + , DATETIME_TRUNC(bookings_source_src_28000.paid_at, isoweek) AS paid_at__week + , DATETIME_TRUNC(bookings_source_src_28000.paid_at, month) AS paid_at__month + , DATETIME_TRUNC(bookings_source_src_28000.paid_at, quarter) AS paid_at__quarter + , DATETIME_TRUNC(bookings_source_src_28000.paid_at, year) AS paid_at__year , EXTRACT(year FROM bookings_source_src_28000.paid_at) AS paid_at__extract_year , EXTRACT(quarter FROM bookings_source_src_28000.paid_at) AS paid_at__extract_quarter , EXTRACT(month FROM bookings_source_src_28000.paid_at) AS paid_at__extract_month @@ -75,33 +75,33 @@ FROM ( , IF(EXTRACT(dayofweek FROM bookings_source_src_28000.paid_at) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_28000.paid_at) - 1) AS paid_at__extract_dow , EXTRACT(dayofyear FROM bookings_source_src_28000.paid_at) AS paid_at__extract_doy , bookings_source_src_28000.is_instant AS booking__is_instant - , DATE_TRUNC(bookings_source_src_28000.ds, day) AS booking__ds__day - , DATE_TRUNC(bookings_source_src_28000.ds, isoweek) AS booking__ds__week - , DATE_TRUNC(bookings_source_src_28000.ds, month) AS booking__ds__month - , DATE_TRUNC(bookings_source_src_28000.ds, quarter) AS booking__ds__quarter - , DATE_TRUNC(bookings_source_src_28000.ds, year) AS booking__ds__year + , DATETIME_TRUNC(bookings_source_src_28000.ds, day) AS booking__ds__day + , DATETIME_TRUNC(bookings_source_src_28000.ds, isoweek) AS booking__ds__week + , DATETIME_TRUNC(bookings_source_src_28000.ds, month) AS booking__ds__month + , DATETIME_TRUNC(bookings_source_src_28000.ds, quarter) AS booking__ds__quarter + , DATETIME_TRUNC(bookings_source_src_28000.ds, year) AS booking__ds__year , EXTRACT(year FROM bookings_source_src_28000.ds) AS booking__ds__extract_year , EXTRACT(quarter FROM bookings_source_src_28000.ds) AS booking__ds__extract_quarter , EXTRACT(month FROM bookings_source_src_28000.ds) AS booking__ds__extract_month , EXTRACT(day FROM bookings_source_src_28000.ds) AS booking__ds__extract_day , IF(EXTRACT(dayofweek FROM bookings_source_src_28000.ds) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_28000.ds) - 1) AS booking__ds__extract_dow , EXTRACT(dayofyear FROM bookings_source_src_28000.ds) AS booking__ds__extract_doy - , DATE_TRUNC(bookings_source_src_28000.ds_partitioned, day) AS booking__ds_partitioned__day - , DATE_TRUNC(bookings_source_src_28000.ds_partitioned, isoweek) AS booking__ds_partitioned__week - , DATE_TRUNC(bookings_source_src_28000.ds_partitioned, month) AS booking__ds_partitioned__month - , DATE_TRUNC(bookings_source_src_28000.ds_partitioned, quarter) AS booking__ds_partitioned__quarter - , DATE_TRUNC(bookings_source_src_28000.ds_partitioned, year) AS booking__ds_partitioned__year + , DATETIME_TRUNC(bookings_source_src_28000.ds_partitioned, day) AS booking__ds_partitioned__day + , DATETIME_TRUNC(bookings_source_src_28000.ds_partitioned, isoweek) AS booking__ds_partitioned__week + , DATETIME_TRUNC(bookings_source_src_28000.ds_partitioned, month) AS booking__ds_partitioned__month + , DATETIME_TRUNC(bookings_source_src_28000.ds_partitioned, quarter) AS booking__ds_partitioned__quarter + , DATETIME_TRUNC(bookings_source_src_28000.ds_partitioned, year) AS booking__ds_partitioned__year , EXTRACT(year FROM bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__extract_year , EXTRACT(quarter FROM bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__extract_quarter , EXTRACT(month FROM bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__extract_month , EXTRACT(day FROM bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__extract_day , IF(EXTRACT(dayofweek FROM bookings_source_src_28000.ds_partitioned) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_28000.ds_partitioned) - 1) AS booking__ds_partitioned__extract_dow , EXTRACT(dayofyear FROM bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__extract_doy - , DATE_TRUNC(bookings_source_src_28000.paid_at, day) AS booking__paid_at__day - , DATE_TRUNC(bookings_source_src_28000.paid_at, isoweek) AS booking__paid_at__week - , DATE_TRUNC(bookings_source_src_28000.paid_at, month) AS booking__paid_at__month - , DATE_TRUNC(bookings_source_src_28000.paid_at, quarter) AS booking__paid_at__quarter - , DATE_TRUNC(bookings_source_src_28000.paid_at, year) AS booking__paid_at__year + , DATETIME_TRUNC(bookings_source_src_28000.paid_at, day) AS booking__paid_at__day + , DATETIME_TRUNC(bookings_source_src_28000.paid_at, isoweek) AS booking__paid_at__week + , DATETIME_TRUNC(bookings_source_src_28000.paid_at, month) AS booking__paid_at__month + , DATETIME_TRUNC(bookings_source_src_28000.paid_at, quarter) AS booking__paid_at__quarter + , DATETIME_TRUNC(bookings_source_src_28000.paid_at, year) AS booking__paid_at__year , EXTRACT(year FROM bookings_source_src_28000.paid_at) AS booking__paid_at__extract_year , EXTRACT(quarter FROM bookings_source_src_28000.paid_at) AS booking__paid_at__extract_quarter , EXTRACT(month FROM bookings_source_src_28000.paid_at) AS booking__paid_at__extract_month @@ -128,22 +128,22 @@ FROM ( 1 AS listings , listings_latest_src_28000.capacity AS largest_listing , listings_latest_src_28000.capacity AS smallest_listing - , DATE_TRUNC(listings_latest_src_28000.created_at, day) AS ds__day - , DATE_TRUNC(listings_latest_src_28000.created_at, isoweek) AS ds__week - , DATE_TRUNC(listings_latest_src_28000.created_at, month) AS ds__month - , DATE_TRUNC(listings_latest_src_28000.created_at, quarter) AS ds__quarter - , DATE_TRUNC(listings_latest_src_28000.created_at, year) AS ds__year + , DATETIME_TRUNC(listings_latest_src_28000.created_at, day) AS ds__day + , DATETIME_TRUNC(listings_latest_src_28000.created_at, isoweek) AS ds__week + , DATETIME_TRUNC(listings_latest_src_28000.created_at, month) AS ds__month + , DATETIME_TRUNC(listings_latest_src_28000.created_at, quarter) AS ds__quarter + , DATETIME_TRUNC(listings_latest_src_28000.created_at, year) AS ds__year , EXTRACT(year FROM listings_latest_src_28000.created_at) AS ds__extract_year , EXTRACT(quarter FROM listings_latest_src_28000.created_at) AS ds__extract_quarter , EXTRACT(month FROM listings_latest_src_28000.created_at) AS ds__extract_month , EXTRACT(day FROM listings_latest_src_28000.created_at) AS ds__extract_day , IF(EXTRACT(dayofweek FROM listings_latest_src_28000.created_at) = 1, 7, EXTRACT(dayofweek FROM listings_latest_src_28000.created_at) - 1) AS ds__extract_dow , EXTRACT(dayofyear FROM listings_latest_src_28000.created_at) AS ds__extract_doy - , DATE_TRUNC(listings_latest_src_28000.created_at, day) AS created_at__day - , DATE_TRUNC(listings_latest_src_28000.created_at, isoweek) AS created_at__week - , DATE_TRUNC(listings_latest_src_28000.created_at, month) AS created_at__month - , DATE_TRUNC(listings_latest_src_28000.created_at, quarter) AS created_at__quarter - , DATE_TRUNC(listings_latest_src_28000.created_at, year) AS created_at__year + , DATETIME_TRUNC(listings_latest_src_28000.created_at, day) AS created_at__day + , DATETIME_TRUNC(listings_latest_src_28000.created_at, isoweek) AS created_at__week + , DATETIME_TRUNC(listings_latest_src_28000.created_at, month) AS created_at__month + , DATETIME_TRUNC(listings_latest_src_28000.created_at, quarter) AS created_at__quarter + , DATETIME_TRUNC(listings_latest_src_28000.created_at, year) AS created_at__year , EXTRACT(year FROM listings_latest_src_28000.created_at) AS created_at__extract_year , EXTRACT(quarter FROM listings_latest_src_28000.created_at) AS created_at__extract_quarter , EXTRACT(month FROM listings_latest_src_28000.created_at) AS created_at__extract_month @@ -153,22 +153,22 @@ FROM ( , listings_latest_src_28000.country AS country_latest , listings_latest_src_28000.is_lux AS is_lux_latest , listings_latest_src_28000.capacity AS capacity_latest - , DATE_TRUNC(listings_latest_src_28000.created_at, day) AS listing__ds__day - , DATE_TRUNC(listings_latest_src_28000.created_at, isoweek) AS listing__ds__week - , DATE_TRUNC(listings_latest_src_28000.created_at, month) AS listing__ds__month - , DATE_TRUNC(listings_latest_src_28000.created_at, quarter) AS listing__ds__quarter - , DATE_TRUNC(listings_latest_src_28000.created_at, year) AS listing__ds__year + , DATETIME_TRUNC(listings_latest_src_28000.created_at, day) AS listing__ds__day + , DATETIME_TRUNC(listings_latest_src_28000.created_at, isoweek) AS listing__ds__week + , DATETIME_TRUNC(listings_latest_src_28000.created_at, month) AS listing__ds__month + , DATETIME_TRUNC(listings_latest_src_28000.created_at, quarter) AS listing__ds__quarter + , DATETIME_TRUNC(listings_latest_src_28000.created_at, year) AS listing__ds__year , EXTRACT(year FROM listings_latest_src_28000.created_at) AS listing__ds__extract_year , EXTRACT(quarter FROM listings_latest_src_28000.created_at) AS listing__ds__extract_quarter , EXTRACT(month FROM listings_latest_src_28000.created_at) AS listing__ds__extract_month , EXTRACT(day FROM listings_latest_src_28000.created_at) AS listing__ds__extract_day , IF(EXTRACT(dayofweek FROM listings_latest_src_28000.created_at) = 1, 7, EXTRACT(dayofweek FROM listings_latest_src_28000.created_at) - 1) AS listing__ds__extract_dow , EXTRACT(dayofyear FROM listings_latest_src_28000.created_at) AS listing__ds__extract_doy - , DATE_TRUNC(listings_latest_src_28000.created_at, day) AS listing__created_at__day - , DATE_TRUNC(listings_latest_src_28000.created_at, isoweek) AS listing__created_at__week - , DATE_TRUNC(listings_latest_src_28000.created_at, month) AS listing__created_at__month - , DATE_TRUNC(listings_latest_src_28000.created_at, quarter) AS listing__created_at__quarter - , DATE_TRUNC(listings_latest_src_28000.created_at, year) AS listing__created_at__year + , DATETIME_TRUNC(listings_latest_src_28000.created_at, day) AS listing__created_at__day + , DATETIME_TRUNC(listings_latest_src_28000.created_at, isoweek) AS listing__created_at__week + , DATETIME_TRUNC(listings_latest_src_28000.created_at, month) AS listing__created_at__month + , DATETIME_TRUNC(listings_latest_src_28000.created_at, quarter) AS listing__created_at__quarter + , DATETIME_TRUNC(listings_latest_src_28000.created_at, year) AS listing__created_at__year , EXTRACT(year FROM listings_latest_src_28000.created_at) AS listing__created_at__extract_year , EXTRACT(quarter FROM listings_latest_src_28000.created_at) AS listing__created_at__extract_quarter , EXTRACT(month FROM listings_latest_src_28000.created_at) AS listing__created_at__extract_month diff --git a/tests_metricflow/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/BigQuery/test_compute_metrics_node_simple_expr__plan0.sql b/tests_metricflow/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/BigQuery/test_compute_metrics_node_simple_expr__plan0.sql index bb6a7cc7c8..6240b480e5 100644 --- a/tests_metricflow/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/BigQuery/test_compute_metrics_node_simple_expr__plan0.sql +++ b/tests_metricflow/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/BigQuery/test_compute_metrics_node_simple_expr__plan0.sql @@ -38,33 +38,33 @@ FROM ( , bookings_source_src_28000.booking_value AS approximate_continuous_booking_value_p99 , bookings_source_src_28000.booking_value AS approximate_discrete_booking_value_p99 , bookings_source_src_28000.is_instant - , DATE_TRUNC(bookings_source_src_28000.ds, day) AS ds__day - , DATE_TRUNC(bookings_source_src_28000.ds, isoweek) AS ds__week - , DATE_TRUNC(bookings_source_src_28000.ds, month) AS ds__month - , DATE_TRUNC(bookings_source_src_28000.ds, quarter) AS ds__quarter - , DATE_TRUNC(bookings_source_src_28000.ds, year) AS ds__year + , DATETIME_TRUNC(bookings_source_src_28000.ds, day) AS ds__day + , DATETIME_TRUNC(bookings_source_src_28000.ds, isoweek) AS ds__week + , DATETIME_TRUNC(bookings_source_src_28000.ds, month) AS ds__month + , DATETIME_TRUNC(bookings_source_src_28000.ds, quarter) AS ds__quarter + , DATETIME_TRUNC(bookings_source_src_28000.ds, year) AS ds__year , EXTRACT(year FROM bookings_source_src_28000.ds) AS ds__extract_year , EXTRACT(quarter FROM bookings_source_src_28000.ds) AS ds__extract_quarter , EXTRACT(month FROM bookings_source_src_28000.ds) AS ds__extract_month , EXTRACT(day FROM bookings_source_src_28000.ds) AS ds__extract_day , IF(EXTRACT(dayofweek FROM bookings_source_src_28000.ds) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_28000.ds) - 1) AS ds__extract_dow , EXTRACT(dayofyear FROM bookings_source_src_28000.ds) AS ds__extract_doy - , DATE_TRUNC(bookings_source_src_28000.ds_partitioned, day) AS ds_partitioned__day - , DATE_TRUNC(bookings_source_src_28000.ds_partitioned, isoweek) AS ds_partitioned__week - , DATE_TRUNC(bookings_source_src_28000.ds_partitioned, month) AS ds_partitioned__month - , DATE_TRUNC(bookings_source_src_28000.ds_partitioned, quarter) AS ds_partitioned__quarter - , DATE_TRUNC(bookings_source_src_28000.ds_partitioned, year) AS ds_partitioned__year + , DATETIME_TRUNC(bookings_source_src_28000.ds_partitioned, day) AS ds_partitioned__day + , DATETIME_TRUNC(bookings_source_src_28000.ds_partitioned, isoweek) AS ds_partitioned__week + , DATETIME_TRUNC(bookings_source_src_28000.ds_partitioned, month) AS ds_partitioned__month + , DATETIME_TRUNC(bookings_source_src_28000.ds_partitioned, quarter) AS ds_partitioned__quarter + , DATETIME_TRUNC(bookings_source_src_28000.ds_partitioned, year) AS ds_partitioned__year , EXTRACT(year FROM bookings_source_src_28000.ds_partitioned) AS ds_partitioned__extract_year , EXTRACT(quarter FROM bookings_source_src_28000.ds_partitioned) AS ds_partitioned__extract_quarter , EXTRACT(month FROM bookings_source_src_28000.ds_partitioned) AS ds_partitioned__extract_month , EXTRACT(day FROM bookings_source_src_28000.ds_partitioned) AS ds_partitioned__extract_day , IF(EXTRACT(dayofweek FROM bookings_source_src_28000.ds_partitioned) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_28000.ds_partitioned) - 1) AS ds_partitioned__extract_dow , EXTRACT(dayofyear FROM bookings_source_src_28000.ds_partitioned) AS ds_partitioned__extract_doy - , DATE_TRUNC(bookings_source_src_28000.paid_at, day) AS paid_at__day - , DATE_TRUNC(bookings_source_src_28000.paid_at, isoweek) AS paid_at__week - , DATE_TRUNC(bookings_source_src_28000.paid_at, month) AS paid_at__month - , DATE_TRUNC(bookings_source_src_28000.paid_at, quarter) AS paid_at__quarter - , DATE_TRUNC(bookings_source_src_28000.paid_at, year) AS paid_at__year + , DATETIME_TRUNC(bookings_source_src_28000.paid_at, day) AS paid_at__day + , DATETIME_TRUNC(bookings_source_src_28000.paid_at, isoweek) AS paid_at__week + , DATETIME_TRUNC(bookings_source_src_28000.paid_at, month) AS paid_at__month + , DATETIME_TRUNC(bookings_source_src_28000.paid_at, quarter) AS paid_at__quarter + , DATETIME_TRUNC(bookings_source_src_28000.paid_at, year) AS paid_at__year , EXTRACT(year FROM bookings_source_src_28000.paid_at) AS paid_at__extract_year , EXTRACT(quarter FROM bookings_source_src_28000.paid_at) AS paid_at__extract_quarter , EXTRACT(month FROM bookings_source_src_28000.paid_at) AS paid_at__extract_month @@ -72,33 +72,33 @@ FROM ( , IF(EXTRACT(dayofweek FROM bookings_source_src_28000.paid_at) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_28000.paid_at) - 1) AS paid_at__extract_dow , EXTRACT(dayofyear FROM bookings_source_src_28000.paid_at) AS paid_at__extract_doy , bookings_source_src_28000.is_instant AS booking__is_instant - , DATE_TRUNC(bookings_source_src_28000.ds, day) AS booking__ds__day - , DATE_TRUNC(bookings_source_src_28000.ds, isoweek) AS booking__ds__week - , DATE_TRUNC(bookings_source_src_28000.ds, month) AS booking__ds__month - , DATE_TRUNC(bookings_source_src_28000.ds, quarter) AS booking__ds__quarter - , DATE_TRUNC(bookings_source_src_28000.ds, year) AS booking__ds__year + , DATETIME_TRUNC(bookings_source_src_28000.ds, day) AS booking__ds__day + , DATETIME_TRUNC(bookings_source_src_28000.ds, isoweek) AS booking__ds__week + , DATETIME_TRUNC(bookings_source_src_28000.ds, month) AS booking__ds__month + , DATETIME_TRUNC(bookings_source_src_28000.ds, quarter) AS booking__ds__quarter + , DATETIME_TRUNC(bookings_source_src_28000.ds, year) AS booking__ds__year , EXTRACT(year FROM bookings_source_src_28000.ds) AS booking__ds__extract_year , EXTRACT(quarter FROM bookings_source_src_28000.ds) AS booking__ds__extract_quarter , EXTRACT(month FROM bookings_source_src_28000.ds) AS booking__ds__extract_month , EXTRACT(day FROM bookings_source_src_28000.ds) AS booking__ds__extract_day , IF(EXTRACT(dayofweek FROM bookings_source_src_28000.ds) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_28000.ds) - 1) AS booking__ds__extract_dow , EXTRACT(dayofyear FROM bookings_source_src_28000.ds) AS booking__ds__extract_doy - , DATE_TRUNC(bookings_source_src_28000.ds_partitioned, day) AS booking__ds_partitioned__day - , DATE_TRUNC(bookings_source_src_28000.ds_partitioned, isoweek) AS booking__ds_partitioned__week - , DATE_TRUNC(bookings_source_src_28000.ds_partitioned, month) AS booking__ds_partitioned__month - , DATE_TRUNC(bookings_source_src_28000.ds_partitioned, quarter) AS booking__ds_partitioned__quarter - , DATE_TRUNC(bookings_source_src_28000.ds_partitioned, year) AS booking__ds_partitioned__year + , DATETIME_TRUNC(bookings_source_src_28000.ds_partitioned, day) AS booking__ds_partitioned__day + , DATETIME_TRUNC(bookings_source_src_28000.ds_partitioned, isoweek) AS booking__ds_partitioned__week + , DATETIME_TRUNC(bookings_source_src_28000.ds_partitioned, month) AS booking__ds_partitioned__month + , DATETIME_TRUNC(bookings_source_src_28000.ds_partitioned, quarter) AS booking__ds_partitioned__quarter + , DATETIME_TRUNC(bookings_source_src_28000.ds_partitioned, year) AS booking__ds_partitioned__year , EXTRACT(year FROM bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__extract_year , EXTRACT(quarter FROM bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__extract_quarter , EXTRACT(month FROM bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__extract_month , EXTRACT(day FROM bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__extract_day , IF(EXTRACT(dayofweek FROM bookings_source_src_28000.ds_partitioned) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_28000.ds_partitioned) - 1) AS booking__ds_partitioned__extract_dow , EXTRACT(dayofyear FROM bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__extract_doy - , DATE_TRUNC(bookings_source_src_28000.paid_at, day) AS booking__paid_at__day - , DATE_TRUNC(bookings_source_src_28000.paid_at, isoweek) AS booking__paid_at__week - , DATE_TRUNC(bookings_source_src_28000.paid_at, month) AS booking__paid_at__month - , DATE_TRUNC(bookings_source_src_28000.paid_at, quarter) AS booking__paid_at__quarter - , DATE_TRUNC(bookings_source_src_28000.paid_at, year) AS booking__paid_at__year + , DATETIME_TRUNC(bookings_source_src_28000.paid_at, day) AS booking__paid_at__day + , DATETIME_TRUNC(bookings_source_src_28000.paid_at, isoweek) AS booking__paid_at__week + , DATETIME_TRUNC(bookings_source_src_28000.paid_at, month) AS booking__paid_at__month + , DATETIME_TRUNC(bookings_source_src_28000.paid_at, quarter) AS booking__paid_at__quarter + , DATETIME_TRUNC(bookings_source_src_28000.paid_at, year) AS booking__paid_at__year , EXTRACT(year FROM bookings_source_src_28000.paid_at) AS booking__paid_at__extract_year , EXTRACT(quarter FROM bookings_source_src_28000.paid_at) AS booking__paid_at__extract_quarter , EXTRACT(month FROM bookings_source_src_28000.paid_at) AS booking__paid_at__extract_month @@ -125,22 +125,22 @@ FROM ( 1 AS listings , listings_latest_src_28000.capacity AS largest_listing , listings_latest_src_28000.capacity AS smallest_listing - , DATE_TRUNC(listings_latest_src_28000.created_at, day) AS ds__day - , DATE_TRUNC(listings_latest_src_28000.created_at, isoweek) AS ds__week - , DATE_TRUNC(listings_latest_src_28000.created_at, month) AS ds__month - , DATE_TRUNC(listings_latest_src_28000.created_at, quarter) AS ds__quarter - , DATE_TRUNC(listings_latest_src_28000.created_at, year) AS ds__year + , DATETIME_TRUNC(listings_latest_src_28000.created_at, day) AS ds__day + , DATETIME_TRUNC(listings_latest_src_28000.created_at, isoweek) AS ds__week + , DATETIME_TRUNC(listings_latest_src_28000.created_at, month) AS ds__month + , DATETIME_TRUNC(listings_latest_src_28000.created_at, quarter) AS ds__quarter + , DATETIME_TRUNC(listings_latest_src_28000.created_at, year) AS ds__year , EXTRACT(year FROM listings_latest_src_28000.created_at) AS ds__extract_year , EXTRACT(quarter FROM listings_latest_src_28000.created_at) AS ds__extract_quarter , EXTRACT(month FROM listings_latest_src_28000.created_at) AS ds__extract_month , EXTRACT(day FROM listings_latest_src_28000.created_at) AS ds__extract_day , IF(EXTRACT(dayofweek FROM listings_latest_src_28000.created_at) = 1, 7, EXTRACT(dayofweek FROM listings_latest_src_28000.created_at) - 1) AS ds__extract_dow , EXTRACT(dayofyear FROM listings_latest_src_28000.created_at) AS ds__extract_doy - , DATE_TRUNC(listings_latest_src_28000.created_at, day) AS created_at__day - , DATE_TRUNC(listings_latest_src_28000.created_at, isoweek) AS created_at__week - , DATE_TRUNC(listings_latest_src_28000.created_at, month) AS created_at__month - , DATE_TRUNC(listings_latest_src_28000.created_at, quarter) AS created_at__quarter - , DATE_TRUNC(listings_latest_src_28000.created_at, year) AS created_at__year + , DATETIME_TRUNC(listings_latest_src_28000.created_at, day) AS created_at__day + , DATETIME_TRUNC(listings_latest_src_28000.created_at, isoweek) AS created_at__week + , DATETIME_TRUNC(listings_latest_src_28000.created_at, month) AS created_at__month + , DATETIME_TRUNC(listings_latest_src_28000.created_at, quarter) AS created_at__quarter + , DATETIME_TRUNC(listings_latest_src_28000.created_at, year) AS created_at__year , EXTRACT(year FROM listings_latest_src_28000.created_at) AS created_at__extract_year , EXTRACT(quarter FROM listings_latest_src_28000.created_at) AS created_at__extract_quarter , EXTRACT(month FROM listings_latest_src_28000.created_at) AS created_at__extract_month @@ -150,22 +150,22 @@ FROM ( , listings_latest_src_28000.country AS country_latest , listings_latest_src_28000.is_lux AS is_lux_latest , listings_latest_src_28000.capacity AS capacity_latest - , DATE_TRUNC(listings_latest_src_28000.created_at, day) AS listing__ds__day - , DATE_TRUNC(listings_latest_src_28000.created_at, isoweek) AS listing__ds__week - , DATE_TRUNC(listings_latest_src_28000.created_at, month) AS listing__ds__month - , DATE_TRUNC(listings_latest_src_28000.created_at, quarter) AS listing__ds__quarter - , DATE_TRUNC(listings_latest_src_28000.created_at, year) AS listing__ds__year + , DATETIME_TRUNC(listings_latest_src_28000.created_at, day) AS listing__ds__day + , DATETIME_TRUNC(listings_latest_src_28000.created_at, isoweek) AS listing__ds__week + , DATETIME_TRUNC(listings_latest_src_28000.created_at, month) AS listing__ds__month + , DATETIME_TRUNC(listings_latest_src_28000.created_at, quarter) AS listing__ds__quarter + , DATETIME_TRUNC(listings_latest_src_28000.created_at, year) AS listing__ds__year , EXTRACT(year FROM listings_latest_src_28000.created_at) AS listing__ds__extract_year , EXTRACT(quarter FROM listings_latest_src_28000.created_at) AS listing__ds__extract_quarter , EXTRACT(month FROM listings_latest_src_28000.created_at) AS listing__ds__extract_month , EXTRACT(day FROM listings_latest_src_28000.created_at) AS listing__ds__extract_day , IF(EXTRACT(dayofweek FROM listings_latest_src_28000.created_at) = 1, 7, EXTRACT(dayofweek FROM listings_latest_src_28000.created_at) - 1) AS listing__ds__extract_dow , EXTRACT(dayofyear FROM listings_latest_src_28000.created_at) AS listing__ds__extract_doy - , DATE_TRUNC(listings_latest_src_28000.created_at, day) AS listing__created_at__day - , DATE_TRUNC(listings_latest_src_28000.created_at, isoweek) AS listing__created_at__week - , DATE_TRUNC(listings_latest_src_28000.created_at, month) AS listing__created_at__month - , DATE_TRUNC(listings_latest_src_28000.created_at, quarter) AS listing__created_at__quarter - , DATE_TRUNC(listings_latest_src_28000.created_at, year) AS listing__created_at__year + , DATETIME_TRUNC(listings_latest_src_28000.created_at, day) AS listing__created_at__day + , DATETIME_TRUNC(listings_latest_src_28000.created_at, isoweek) AS listing__created_at__week + , DATETIME_TRUNC(listings_latest_src_28000.created_at, month) AS listing__created_at__month + , DATETIME_TRUNC(listings_latest_src_28000.created_at, quarter) AS listing__created_at__quarter + , DATETIME_TRUNC(listings_latest_src_28000.created_at, year) AS listing__created_at__year , EXTRACT(year FROM listings_latest_src_28000.created_at) AS listing__created_at__extract_year , EXTRACT(quarter FROM listings_latest_src_28000.created_at) AS listing__created_at__extract_quarter , EXTRACT(month FROM listings_latest_src_28000.created_at) AS listing__created_at__extract_month diff --git a/tests_metricflow/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/BigQuery/test_constrain_time_range_node__plan0.sql b/tests_metricflow/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/BigQuery/test_constrain_time_range_node__plan0.sql index f35d50cc54..e8dee856fb 100644 --- a/tests_metricflow/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/BigQuery/test_constrain_time_range_node__plan0.sql +++ b/tests_metricflow/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/BigQuery/test_constrain_time_range_node__plan0.sql @@ -32,33 +32,33 @@ FROM ( , bookings_source_src_28000.booking_value AS approximate_continuous_booking_value_p99 , bookings_source_src_28000.booking_value AS approximate_discrete_booking_value_p99 , bookings_source_src_28000.is_instant - , DATE_TRUNC(bookings_source_src_28000.ds, day) AS ds__day - , DATE_TRUNC(bookings_source_src_28000.ds, isoweek) AS ds__week - , DATE_TRUNC(bookings_source_src_28000.ds, month) AS ds__month - , DATE_TRUNC(bookings_source_src_28000.ds, quarter) AS ds__quarter - , DATE_TRUNC(bookings_source_src_28000.ds, year) AS ds__year + , DATETIME_TRUNC(bookings_source_src_28000.ds, day) AS ds__day + , DATETIME_TRUNC(bookings_source_src_28000.ds, isoweek) AS ds__week + , DATETIME_TRUNC(bookings_source_src_28000.ds, month) AS ds__month + , DATETIME_TRUNC(bookings_source_src_28000.ds, quarter) AS ds__quarter + , DATETIME_TRUNC(bookings_source_src_28000.ds, year) AS ds__year , EXTRACT(year FROM bookings_source_src_28000.ds) AS ds__extract_year , EXTRACT(quarter FROM bookings_source_src_28000.ds) AS ds__extract_quarter , EXTRACT(month FROM bookings_source_src_28000.ds) AS ds__extract_month , EXTRACT(day FROM bookings_source_src_28000.ds) AS ds__extract_day , IF(EXTRACT(dayofweek FROM bookings_source_src_28000.ds) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_28000.ds) - 1) AS ds__extract_dow , EXTRACT(dayofyear FROM bookings_source_src_28000.ds) AS ds__extract_doy - , DATE_TRUNC(bookings_source_src_28000.ds_partitioned, day) AS ds_partitioned__day - , DATE_TRUNC(bookings_source_src_28000.ds_partitioned, isoweek) AS ds_partitioned__week - , DATE_TRUNC(bookings_source_src_28000.ds_partitioned, month) AS ds_partitioned__month - , DATE_TRUNC(bookings_source_src_28000.ds_partitioned, quarter) AS ds_partitioned__quarter - , DATE_TRUNC(bookings_source_src_28000.ds_partitioned, year) AS ds_partitioned__year + , DATETIME_TRUNC(bookings_source_src_28000.ds_partitioned, day) AS ds_partitioned__day + , DATETIME_TRUNC(bookings_source_src_28000.ds_partitioned, isoweek) AS ds_partitioned__week + , DATETIME_TRUNC(bookings_source_src_28000.ds_partitioned, month) AS ds_partitioned__month + , DATETIME_TRUNC(bookings_source_src_28000.ds_partitioned, quarter) AS ds_partitioned__quarter + , DATETIME_TRUNC(bookings_source_src_28000.ds_partitioned, year) AS ds_partitioned__year , EXTRACT(year FROM bookings_source_src_28000.ds_partitioned) AS ds_partitioned__extract_year , EXTRACT(quarter FROM bookings_source_src_28000.ds_partitioned) AS ds_partitioned__extract_quarter , EXTRACT(month FROM bookings_source_src_28000.ds_partitioned) AS ds_partitioned__extract_month , EXTRACT(day FROM bookings_source_src_28000.ds_partitioned) AS ds_partitioned__extract_day , IF(EXTRACT(dayofweek FROM bookings_source_src_28000.ds_partitioned) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_28000.ds_partitioned) - 1) AS ds_partitioned__extract_dow , EXTRACT(dayofyear FROM bookings_source_src_28000.ds_partitioned) AS ds_partitioned__extract_doy - , DATE_TRUNC(bookings_source_src_28000.paid_at, day) AS paid_at__day - , DATE_TRUNC(bookings_source_src_28000.paid_at, isoweek) AS paid_at__week - , DATE_TRUNC(bookings_source_src_28000.paid_at, month) AS paid_at__month - , DATE_TRUNC(bookings_source_src_28000.paid_at, quarter) AS paid_at__quarter - , DATE_TRUNC(bookings_source_src_28000.paid_at, year) AS paid_at__year + , DATETIME_TRUNC(bookings_source_src_28000.paid_at, day) AS paid_at__day + , DATETIME_TRUNC(bookings_source_src_28000.paid_at, isoweek) AS paid_at__week + , DATETIME_TRUNC(bookings_source_src_28000.paid_at, month) AS paid_at__month + , DATETIME_TRUNC(bookings_source_src_28000.paid_at, quarter) AS paid_at__quarter + , DATETIME_TRUNC(bookings_source_src_28000.paid_at, year) AS paid_at__year , EXTRACT(year FROM bookings_source_src_28000.paid_at) AS paid_at__extract_year , EXTRACT(quarter FROM bookings_source_src_28000.paid_at) AS paid_at__extract_quarter , EXTRACT(month FROM bookings_source_src_28000.paid_at) AS paid_at__extract_month @@ -66,33 +66,33 @@ FROM ( , IF(EXTRACT(dayofweek FROM bookings_source_src_28000.paid_at) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_28000.paid_at) - 1) AS paid_at__extract_dow , EXTRACT(dayofyear FROM bookings_source_src_28000.paid_at) AS paid_at__extract_doy , bookings_source_src_28000.is_instant AS booking__is_instant - , DATE_TRUNC(bookings_source_src_28000.ds, day) AS booking__ds__day - , DATE_TRUNC(bookings_source_src_28000.ds, isoweek) AS booking__ds__week - , DATE_TRUNC(bookings_source_src_28000.ds, month) AS booking__ds__month - , DATE_TRUNC(bookings_source_src_28000.ds, quarter) AS booking__ds__quarter - , DATE_TRUNC(bookings_source_src_28000.ds, year) AS booking__ds__year + , DATETIME_TRUNC(bookings_source_src_28000.ds, day) AS booking__ds__day + , DATETIME_TRUNC(bookings_source_src_28000.ds, isoweek) AS booking__ds__week + , DATETIME_TRUNC(bookings_source_src_28000.ds, month) AS booking__ds__month + , DATETIME_TRUNC(bookings_source_src_28000.ds, quarter) AS booking__ds__quarter + , DATETIME_TRUNC(bookings_source_src_28000.ds, year) AS booking__ds__year , EXTRACT(year FROM bookings_source_src_28000.ds) AS booking__ds__extract_year , EXTRACT(quarter FROM bookings_source_src_28000.ds) AS booking__ds__extract_quarter , EXTRACT(month FROM bookings_source_src_28000.ds) AS booking__ds__extract_month , EXTRACT(day FROM bookings_source_src_28000.ds) AS booking__ds__extract_day , IF(EXTRACT(dayofweek FROM bookings_source_src_28000.ds) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_28000.ds) - 1) AS booking__ds__extract_dow , EXTRACT(dayofyear FROM bookings_source_src_28000.ds) AS booking__ds__extract_doy - , DATE_TRUNC(bookings_source_src_28000.ds_partitioned, day) AS booking__ds_partitioned__day - , DATE_TRUNC(bookings_source_src_28000.ds_partitioned, isoweek) AS booking__ds_partitioned__week - , DATE_TRUNC(bookings_source_src_28000.ds_partitioned, month) AS booking__ds_partitioned__month - , DATE_TRUNC(bookings_source_src_28000.ds_partitioned, quarter) AS booking__ds_partitioned__quarter - , DATE_TRUNC(bookings_source_src_28000.ds_partitioned, year) AS booking__ds_partitioned__year + , DATETIME_TRUNC(bookings_source_src_28000.ds_partitioned, day) AS booking__ds_partitioned__day + , DATETIME_TRUNC(bookings_source_src_28000.ds_partitioned, isoweek) AS booking__ds_partitioned__week + , DATETIME_TRUNC(bookings_source_src_28000.ds_partitioned, month) AS booking__ds_partitioned__month + , DATETIME_TRUNC(bookings_source_src_28000.ds_partitioned, quarter) AS booking__ds_partitioned__quarter + , DATETIME_TRUNC(bookings_source_src_28000.ds_partitioned, year) AS booking__ds_partitioned__year , EXTRACT(year FROM bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__extract_year , EXTRACT(quarter FROM bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__extract_quarter , EXTRACT(month FROM bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__extract_month , EXTRACT(day FROM bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__extract_day , IF(EXTRACT(dayofweek FROM bookings_source_src_28000.ds_partitioned) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_28000.ds_partitioned) - 1) AS booking__ds_partitioned__extract_dow , EXTRACT(dayofyear FROM bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__extract_doy - , DATE_TRUNC(bookings_source_src_28000.paid_at, day) AS booking__paid_at__day - , DATE_TRUNC(bookings_source_src_28000.paid_at, isoweek) AS booking__paid_at__week - , DATE_TRUNC(bookings_source_src_28000.paid_at, month) AS booking__paid_at__month - , DATE_TRUNC(bookings_source_src_28000.paid_at, quarter) AS booking__paid_at__quarter - , DATE_TRUNC(bookings_source_src_28000.paid_at, year) AS booking__paid_at__year + , DATETIME_TRUNC(bookings_source_src_28000.paid_at, day) AS booking__paid_at__day + , DATETIME_TRUNC(bookings_source_src_28000.paid_at, isoweek) AS booking__paid_at__week + , DATETIME_TRUNC(bookings_source_src_28000.paid_at, month) AS booking__paid_at__month + , DATETIME_TRUNC(bookings_source_src_28000.paid_at, quarter) AS booking__paid_at__quarter + , DATETIME_TRUNC(bookings_source_src_28000.paid_at, year) AS booking__paid_at__year , EXTRACT(year FROM bookings_source_src_28000.paid_at) AS booking__paid_at__extract_year , EXTRACT(quarter FROM bookings_source_src_28000.paid_at) AS booking__paid_at__extract_quarter , EXTRACT(month FROM bookings_source_src_28000.paid_at) AS booking__paid_at__extract_month diff --git a/tests_metricflow/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/BigQuery/test_constrain_time_range_node__plan0_optimized.sql b/tests_metricflow/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/BigQuery/test_constrain_time_range_node__plan0_optimized.sql index 9c5e3ef726..f76c3fea12 100644 --- a/tests_metricflow/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/BigQuery/test_constrain_time_range_node__plan0_optimized.sql +++ b/tests_metricflow/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/BigQuery/test_constrain_time_range_node__plan0_optimized.sql @@ -3,8 +3,8 @@ -- Metric Time Dimension 'ds' -- Constrain Time Range to [2020-01-01T00:00:00, 2020-01-02T00:00:00] SELECT - DATE_TRUNC(ds, day) AS ds__day - , DATE_TRUNC(ds, day) AS metric_time__day + DATETIME_TRUNC(ds, day) AS ds__day + , DATETIME_TRUNC(ds, day) AS metric_time__day , 1 AS bookings FROM ***************************.fct_bookings bookings_source_src_28000 -WHERE DATE_TRUNC(ds, day) BETWEEN '2020-01-01' AND '2020-01-02' +WHERE DATETIME_TRUNC(ds, day) BETWEEN '2020-01-01' AND '2020-01-02' diff --git a/tests_metricflow/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/BigQuery/test_dimension_with_joined_where_constraint__plan0.sql b/tests_metricflow/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/BigQuery/test_dimension_with_joined_where_constraint__plan0.sql index 4da4d7d82c..68a23dbf9e 100644 --- a/tests_metricflow/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/BigQuery/test_dimension_with_joined_where_constraint__plan0.sql +++ b/tests_metricflow/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/BigQuery/test_dimension_with_joined_where_constraint__plan0.sql @@ -127,22 +127,22 @@ FROM ( 1 AS listings , listings_latest_src_28000.capacity AS largest_listing , listings_latest_src_28000.capacity AS smallest_listing - , DATE_TRUNC(listings_latest_src_28000.created_at, day) AS ds__day - , DATE_TRUNC(listings_latest_src_28000.created_at, isoweek) AS ds__week - , DATE_TRUNC(listings_latest_src_28000.created_at, month) AS ds__month - , DATE_TRUNC(listings_latest_src_28000.created_at, quarter) AS ds__quarter - , DATE_TRUNC(listings_latest_src_28000.created_at, year) AS ds__year + , DATETIME_TRUNC(listings_latest_src_28000.created_at, day) AS ds__day + , DATETIME_TRUNC(listings_latest_src_28000.created_at, isoweek) AS ds__week + , DATETIME_TRUNC(listings_latest_src_28000.created_at, month) AS ds__month + , DATETIME_TRUNC(listings_latest_src_28000.created_at, quarter) AS ds__quarter + , DATETIME_TRUNC(listings_latest_src_28000.created_at, year) AS ds__year , EXTRACT(year FROM listings_latest_src_28000.created_at) AS ds__extract_year , EXTRACT(quarter FROM listings_latest_src_28000.created_at) AS ds__extract_quarter , EXTRACT(month FROM listings_latest_src_28000.created_at) AS ds__extract_month , EXTRACT(day FROM listings_latest_src_28000.created_at) AS ds__extract_day , IF(EXTRACT(dayofweek FROM listings_latest_src_28000.created_at) = 1, 7, EXTRACT(dayofweek FROM listings_latest_src_28000.created_at) - 1) AS ds__extract_dow , EXTRACT(dayofyear FROM listings_latest_src_28000.created_at) AS ds__extract_doy - , DATE_TRUNC(listings_latest_src_28000.created_at, day) AS created_at__day - , DATE_TRUNC(listings_latest_src_28000.created_at, isoweek) AS created_at__week - , DATE_TRUNC(listings_latest_src_28000.created_at, month) AS created_at__month - , DATE_TRUNC(listings_latest_src_28000.created_at, quarter) AS created_at__quarter - , DATE_TRUNC(listings_latest_src_28000.created_at, year) AS created_at__year + , DATETIME_TRUNC(listings_latest_src_28000.created_at, day) AS created_at__day + , DATETIME_TRUNC(listings_latest_src_28000.created_at, isoweek) AS created_at__week + , DATETIME_TRUNC(listings_latest_src_28000.created_at, month) AS created_at__month + , DATETIME_TRUNC(listings_latest_src_28000.created_at, quarter) AS created_at__quarter + , DATETIME_TRUNC(listings_latest_src_28000.created_at, year) AS created_at__year , EXTRACT(year FROM listings_latest_src_28000.created_at) AS created_at__extract_year , EXTRACT(quarter FROM listings_latest_src_28000.created_at) AS created_at__extract_quarter , EXTRACT(month FROM listings_latest_src_28000.created_at) AS created_at__extract_month @@ -152,22 +152,22 @@ FROM ( , listings_latest_src_28000.country AS country_latest , listings_latest_src_28000.is_lux AS is_lux_latest , listings_latest_src_28000.capacity AS capacity_latest - , DATE_TRUNC(listings_latest_src_28000.created_at, day) AS listing__ds__day - , DATE_TRUNC(listings_latest_src_28000.created_at, isoweek) AS listing__ds__week - , DATE_TRUNC(listings_latest_src_28000.created_at, month) AS listing__ds__month - , DATE_TRUNC(listings_latest_src_28000.created_at, quarter) AS listing__ds__quarter - , DATE_TRUNC(listings_latest_src_28000.created_at, year) AS listing__ds__year + , DATETIME_TRUNC(listings_latest_src_28000.created_at, day) AS listing__ds__day + , DATETIME_TRUNC(listings_latest_src_28000.created_at, isoweek) AS listing__ds__week + , DATETIME_TRUNC(listings_latest_src_28000.created_at, month) AS listing__ds__month + , DATETIME_TRUNC(listings_latest_src_28000.created_at, quarter) AS listing__ds__quarter + , DATETIME_TRUNC(listings_latest_src_28000.created_at, year) AS listing__ds__year , EXTRACT(year FROM listings_latest_src_28000.created_at) AS listing__ds__extract_year , EXTRACT(quarter FROM listings_latest_src_28000.created_at) AS listing__ds__extract_quarter , EXTRACT(month FROM listings_latest_src_28000.created_at) AS listing__ds__extract_month , EXTRACT(day FROM listings_latest_src_28000.created_at) AS listing__ds__extract_day , IF(EXTRACT(dayofweek FROM listings_latest_src_28000.created_at) = 1, 7, EXTRACT(dayofweek FROM listings_latest_src_28000.created_at) - 1) AS listing__ds__extract_dow , EXTRACT(dayofyear FROM listings_latest_src_28000.created_at) AS listing__ds__extract_doy - , DATE_TRUNC(listings_latest_src_28000.created_at, day) AS listing__created_at__day - , DATE_TRUNC(listings_latest_src_28000.created_at, isoweek) AS listing__created_at__week - , DATE_TRUNC(listings_latest_src_28000.created_at, month) AS listing__created_at__month - , DATE_TRUNC(listings_latest_src_28000.created_at, quarter) AS listing__created_at__quarter - , DATE_TRUNC(listings_latest_src_28000.created_at, year) AS listing__created_at__year + , DATETIME_TRUNC(listings_latest_src_28000.created_at, day) AS listing__created_at__day + , DATETIME_TRUNC(listings_latest_src_28000.created_at, isoweek) AS listing__created_at__week + , DATETIME_TRUNC(listings_latest_src_28000.created_at, month) AS listing__created_at__month + , DATETIME_TRUNC(listings_latest_src_28000.created_at, quarter) AS listing__created_at__quarter + , DATETIME_TRUNC(listings_latest_src_28000.created_at, year) AS listing__created_at__year , EXTRACT(year FROM listings_latest_src_28000.created_at) AS listing__created_at__extract_year , EXTRACT(quarter FROM listings_latest_src_28000.created_at) AS listing__created_at__extract_quarter , EXTRACT(month FROM listings_latest_src_28000.created_at) AS listing__created_at__extract_month @@ -190,11 +190,11 @@ FROM ( FROM ( -- Read Elements From Semantic Model 'users_latest' SELECT - DATE_TRUNC(users_latest_src_28000.ds, day) AS ds_latest__day - , DATE_TRUNC(users_latest_src_28000.ds, isoweek) AS ds_latest__week - , DATE_TRUNC(users_latest_src_28000.ds, month) AS ds_latest__month - , DATE_TRUNC(users_latest_src_28000.ds, quarter) AS ds_latest__quarter - , DATE_TRUNC(users_latest_src_28000.ds, year) AS ds_latest__year + DATETIME_TRUNC(users_latest_src_28000.ds, day) AS ds_latest__day + , DATETIME_TRUNC(users_latest_src_28000.ds, isoweek) AS ds_latest__week + , DATETIME_TRUNC(users_latest_src_28000.ds, month) AS ds_latest__month + , DATETIME_TRUNC(users_latest_src_28000.ds, quarter) AS ds_latest__quarter + , DATETIME_TRUNC(users_latest_src_28000.ds, year) AS ds_latest__year , EXTRACT(year FROM users_latest_src_28000.ds) AS ds_latest__extract_year , EXTRACT(quarter FROM users_latest_src_28000.ds) AS ds_latest__extract_quarter , EXTRACT(month FROM users_latest_src_28000.ds) AS ds_latest__extract_month @@ -202,11 +202,11 @@ FROM ( , IF(EXTRACT(dayofweek FROM users_latest_src_28000.ds) = 1, 7, EXTRACT(dayofweek FROM users_latest_src_28000.ds) - 1) AS ds_latest__extract_dow , EXTRACT(dayofyear FROM users_latest_src_28000.ds) AS ds_latest__extract_doy , users_latest_src_28000.home_state_latest - , DATE_TRUNC(users_latest_src_28000.ds, day) AS user__ds_latest__day - , DATE_TRUNC(users_latest_src_28000.ds, isoweek) AS user__ds_latest__week - , DATE_TRUNC(users_latest_src_28000.ds, month) AS user__ds_latest__month - , DATE_TRUNC(users_latest_src_28000.ds, quarter) AS user__ds_latest__quarter - , DATE_TRUNC(users_latest_src_28000.ds, year) AS user__ds_latest__year + , DATETIME_TRUNC(users_latest_src_28000.ds, day) AS user__ds_latest__day + , DATETIME_TRUNC(users_latest_src_28000.ds, isoweek) AS user__ds_latest__week + , DATETIME_TRUNC(users_latest_src_28000.ds, month) AS user__ds_latest__month + , DATETIME_TRUNC(users_latest_src_28000.ds, quarter) AS user__ds_latest__quarter + , DATETIME_TRUNC(users_latest_src_28000.ds, year) AS user__ds_latest__year , EXTRACT(year FROM users_latest_src_28000.ds) AS user__ds_latest__extract_year , EXTRACT(quarter FROM users_latest_src_28000.ds) AS user__ds_latest__extract_quarter , EXTRACT(month FROM users_latest_src_28000.ds) AS user__ds_latest__extract_month diff --git a/tests_metricflow/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/BigQuery/test_dimensions_requiring_join__plan0.sql b/tests_metricflow/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/BigQuery/test_dimensions_requiring_join__plan0.sql index ebe3631edd..f112ad4699 100644 --- a/tests_metricflow/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/BigQuery/test_dimensions_requiring_join__plan0.sql +++ b/tests_metricflow/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/BigQuery/test_dimensions_requiring_join__plan0.sql @@ -68,22 +68,22 @@ FROM ( 1 AS listings , listings_latest_src_28000.capacity AS largest_listing , listings_latest_src_28000.capacity AS smallest_listing - , DATE_TRUNC(listings_latest_src_28000.created_at, day) AS ds__day - , DATE_TRUNC(listings_latest_src_28000.created_at, isoweek) AS ds__week - , DATE_TRUNC(listings_latest_src_28000.created_at, month) AS ds__month - , DATE_TRUNC(listings_latest_src_28000.created_at, quarter) AS ds__quarter - , DATE_TRUNC(listings_latest_src_28000.created_at, year) AS ds__year + , DATETIME_TRUNC(listings_latest_src_28000.created_at, day) AS ds__day + , DATETIME_TRUNC(listings_latest_src_28000.created_at, isoweek) AS ds__week + , DATETIME_TRUNC(listings_latest_src_28000.created_at, month) AS ds__month + , DATETIME_TRUNC(listings_latest_src_28000.created_at, quarter) AS ds__quarter + , DATETIME_TRUNC(listings_latest_src_28000.created_at, year) AS ds__year , EXTRACT(year FROM listings_latest_src_28000.created_at) AS ds__extract_year , EXTRACT(quarter FROM listings_latest_src_28000.created_at) AS ds__extract_quarter , EXTRACT(month FROM listings_latest_src_28000.created_at) AS ds__extract_month , EXTRACT(day FROM listings_latest_src_28000.created_at) AS ds__extract_day , IF(EXTRACT(dayofweek FROM listings_latest_src_28000.created_at) = 1, 7, EXTRACT(dayofweek FROM listings_latest_src_28000.created_at) - 1) AS ds__extract_dow , EXTRACT(dayofyear FROM listings_latest_src_28000.created_at) AS ds__extract_doy - , DATE_TRUNC(listings_latest_src_28000.created_at, day) AS created_at__day - , DATE_TRUNC(listings_latest_src_28000.created_at, isoweek) AS created_at__week - , DATE_TRUNC(listings_latest_src_28000.created_at, month) AS created_at__month - , DATE_TRUNC(listings_latest_src_28000.created_at, quarter) AS created_at__quarter - , DATE_TRUNC(listings_latest_src_28000.created_at, year) AS created_at__year + , DATETIME_TRUNC(listings_latest_src_28000.created_at, day) AS created_at__day + , DATETIME_TRUNC(listings_latest_src_28000.created_at, isoweek) AS created_at__week + , DATETIME_TRUNC(listings_latest_src_28000.created_at, month) AS created_at__month + , DATETIME_TRUNC(listings_latest_src_28000.created_at, quarter) AS created_at__quarter + , DATETIME_TRUNC(listings_latest_src_28000.created_at, year) AS created_at__year , EXTRACT(year FROM listings_latest_src_28000.created_at) AS created_at__extract_year , EXTRACT(quarter FROM listings_latest_src_28000.created_at) AS created_at__extract_quarter , EXTRACT(month FROM listings_latest_src_28000.created_at) AS created_at__extract_month @@ -93,22 +93,22 @@ FROM ( , listings_latest_src_28000.country AS country_latest , listings_latest_src_28000.is_lux AS is_lux_latest , listings_latest_src_28000.capacity AS capacity_latest - , DATE_TRUNC(listings_latest_src_28000.created_at, day) AS listing__ds__day - , DATE_TRUNC(listings_latest_src_28000.created_at, isoweek) AS listing__ds__week - , DATE_TRUNC(listings_latest_src_28000.created_at, month) AS listing__ds__month - , DATE_TRUNC(listings_latest_src_28000.created_at, quarter) AS listing__ds__quarter - , DATE_TRUNC(listings_latest_src_28000.created_at, year) AS listing__ds__year + , DATETIME_TRUNC(listings_latest_src_28000.created_at, day) AS listing__ds__day + , DATETIME_TRUNC(listings_latest_src_28000.created_at, isoweek) AS listing__ds__week + , DATETIME_TRUNC(listings_latest_src_28000.created_at, month) AS listing__ds__month + , DATETIME_TRUNC(listings_latest_src_28000.created_at, quarter) AS listing__ds__quarter + , DATETIME_TRUNC(listings_latest_src_28000.created_at, year) AS listing__ds__year , EXTRACT(year FROM listings_latest_src_28000.created_at) AS listing__ds__extract_year , EXTRACT(quarter FROM listings_latest_src_28000.created_at) AS listing__ds__extract_quarter , EXTRACT(month FROM listings_latest_src_28000.created_at) AS listing__ds__extract_month , EXTRACT(day FROM listings_latest_src_28000.created_at) AS listing__ds__extract_day , IF(EXTRACT(dayofweek FROM listings_latest_src_28000.created_at) = 1, 7, EXTRACT(dayofweek FROM listings_latest_src_28000.created_at) - 1) AS listing__ds__extract_dow , EXTRACT(dayofyear FROM listings_latest_src_28000.created_at) AS listing__ds__extract_doy - , DATE_TRUNC(listings_latest_src_28000.created_at, day) AS listing__created_at__day - , DATE_TRUNC(listings_latest_src_28000.created_at, isoweek) AS listing__created_at__week - , DATE_TRUNC(listings_latest_src_28000.created_at, month) AS listing__created_at__month - , DATE_TRUNC(listings_latest_src_28000.created_at, quarter) AS listing__created_at__quarter - , DATE_TRUNC(listings_latest_src_28000.created_at, year) AS listing__created_at__year + , DATETIME_TRUNC(listings_latest_src_28000.created_at, day) AS listing__created_at__day + , DATETIME_TRUNC(listings_latest_src_28000.created_at, isoweek) AS listing__created_at__week + , DATETIME_TRUNC(listings_latest_src_28000.created_at, month) AS listing__created_at__month + , DATETIME_TRUNC(listings_latest_src_28000.created_at, quarter) AS listing__created_at__quarter + , DATETIME_TRUNC(listings_latest_src_28000.created_at, year) AS listing__created_at__year , EXTRACT(year FROM listings_latest_src_28000.created_at) AS listing__created_at__extract_year , EXTRACT(quarter FROM listings_latest_src_28000.created_at) AS listing__created_at__extract_quarter , EXTRACT(month FROM listings_latest_src_28000.created_at) AS listing__created_at__extract_month @@ -131,11 +131,11 @@ FROM ( FROM ( -- Read Elements From Semantic Model 'users_latest' SELECT - DATE_TRUNC(users_latest_src_28000.ds, day) AS ds_latest__day - , DATE_TRUNC(users_latest_src_28000.ds, isoweek) AS ds_latest__week - , DATE_TRUNC(users_latest_src_28000.ds, month) AS ds_latest__month - , DATE_TRUNC(users_latest_src_28000.ds, quarter) AS ds_latest__quarter - , DATE_TRUNC(users_latest_src_28000.ds, year) AS ds_latest__year + DATETIME_TRUNC(users_latest_src_28000.ds, day) AS ds_latest__day + , DATETIME_TRUNC(users_latest_src_28000.ds, isoweek) AS ds_latest__week + , DATETIME_TRUNC(users_latest_src_28000.ds, month) AS ds_latest__month + , DATETIME_TRUNC(users_latest_src_28000.ds, quarter) AS ds_latest__quarter + , DATETIME_TRUNC(users_latest_src_28000.ds, year) AS ds_latest__year , EXTRACT(year FROM users_latest_src_28000.ds) AS ds_latest__extract_year , EXTRACT(quarter FROM users_latest_src_28000.ds) AS ds_latest__extract_quarter , EXTRACT(month FROM users_latest_src_28000.ds) AS ds_latest__extract_month @@ -143,11 +143,11 @@ FROM ( , IF(EXTRACT(dayofweek FROM users_latest_src_28000.ds) = 1, 7, EXTRACT(dayofweek FROM users_latest_src_28000.ds) - 1) AS ds_latest__extract_dow , EXTRACT(dayofyear FROM users_latest_src_28000.ds) AS ds_latest__extract_doy , users_latest_src_28000.home_state_latest - , DATE_TRUNC(users_latest_src_28000.ds, day) AS user__ds_latest__day - , DATE_TRUNC(users_latest_src_28000.ds, isoweek) AS user__ds_latest__week - , DATE_TRUNC(users_latest_src_28000.ds, month) AS user__ds_latest__month - , DATE_TRUNC(users_latest_src_28000.ds, quarter) AS user__ds_latest__quarter - , DATE_TRUNC(users_latest_src_28000.ds, year) AS user__ds_latest__year + , DATETIME_TRUNC(users_latest_src_28000.ds, day) AS user__ds_latest__day + , DATETIME_TRUNC(users_latest_src_28000.ds, isoweek) AS user__ds_latest__week + , DATETIME_TRUNC(users_latest_src_28000.ds, month) AS user__ds_latest__month + , DATETIME_TRUNC(users_latest_src_28000.ds, quarter) AS user__ds_latest__quarter + , DATETIME_TRUNC(users_latest_src_28000.ds, year) AS user__ds_latest__year , EXTRACT(year FROM users_latest_src_28000.ds) AS user__ds_latest__extract_year , EXTRACT(quarter FROM users_latest_src_28000.ds) AS user__ds_latest__extract_quarter , EXTRACT(month FROM users_latest_src_28000.ds) AS user__ds_latest__extract_month diff --git a/tests_metricflow/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/BigQuery/test_filter_node__plan0.sql b/tests_metricflow/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/BigQuery/test_filter_node__plan0.sql index b5ff0578b8..30145bdd46 100644 --- a/tests_metricflow/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/BigQuery/test_filter_node__plan0.sql +++ b/tests_metricflow/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/BigQuery/test_filter_node__plan0.sql @@ -19,33 +19,33 @@ FROM ( , bookings_source_src_28000.booking_value AS approximate_continuous_booking_value_p99 , bookings_source_src_28000.booking_value AS approximate_discrete_booking_value_p99 , bookings_source_src_28000.is_instant - , DATE_TRUNC(bookings_source_src_28000.ds, day) AS ds__day - , DATE_TRUNC(bookings_source_src_28000.ds, isoweek) AS ds__week - , DATE_TRUNC(bookings_source_src_28000.ds, month) AS ds__month - , DATE_TRUNC(bookings_source_src_28000.ds, quarter) AS ds__quarter - , DATE_TRUNC(bookings_source_src_28000.ds, year) AS ds__year + , DATETIME_TRUNC(bookings_source_src_28000.ds, day) AS ds__day + , DATETIME_TRUNC(bookings_source_src_28000.ds, isoweek) AS ds__week + , DATETIME_TRUNC(bookings_source_src_28000.ds, month) AS ds__month + , DATETIME_TRUNC(bookings_source_src_28000.ds, quarter) AS ds__quarter + , DATETIME_TRUNC(bookings_source_src_28000.ds, year) AS ds__year , EXTRACT(year FROM bookings_source_src_28000.ds) AS ds__extract_year , EXTRACT(quarter FROM bookings_source_src_28000.ds) AS ds__extract_quarter , EXTRACT(month FROM bookings_source_src_28000.ds) AS ds__extract_month , EXTRACT(day FROM bookings_source_src_28000.ds) AS ds__extract_day , IF(EXTRACT(dayofweek FROM bookings_source_src_28000.ds) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_28000.ds) - 1) AS ds__extract_dow , EXTRACT(dayofyear FROM bookings_source_src_28000.ds) AS ds__extract_doy - , DATE_TRUNC(bookings_source_src_28000.ds_partitioned, day) AS ds_partitioned__day - , DATE_TRUNC(bookings_source_src_28000.ds_partitioned, isoweek) AS ds_partitioned__week - , DATE_TRUNC(bookings_source_src_28000.ds_partitioned, month) AS ds_partitioned__month - , DATE_TRUNC(bookings_source_src_28000.ds_partitioned, quarter) AS ds_partitioned__quarter - , DATE_TRUNC(bookings_source_src_28000.ds_partitioned, year) AS ds_partitioned__year + , DATETIME_TRUNC(bookings_source_src_28000.ds_partitioned, day) AS ds_partitioned__day + , DATETIME_TRUNC(bookings_source_src_28000.ds_partitioned, isoweek) AS ds_partitioned__week + , DATETIME_TRUNC(bookings_source_src_28000.ds_partitioned, month) AS ds_partitioned__month + , DATETIME_TRUNC(bookings_source_src_28000.ds_partitioned, quarter) AS ds_partitioned__quarter + , DATETIME_TRUNC(bookings_source_src_28000.ds_partitioned, year) AS ds_partitioned__year , EXTRACT(year FROM bookings_source_src_28000.ds_partitioned) AS ds_partitioned__extract_year , EXTRACT(quarter FROM bookings_source_src_28000.ds_partitioned) AS ds_partitioned__extract_quarter , EXTRACT(month FROM bookings_source_src_28000.ds_partitioned) AS ds_partitioned__extract_month , EXTRACT(day FROM bookings_source_src_28000.ds_partitioned) AS ds_partitioned__extract_day , IF(EXTRACT(dayofweek FROM bookings_source_src_28000.ds_partitioned) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_28000.ds_partitioned) - 1) AS ds_partitioned__extract_dow , EXTRACT(dayofyear FROM bookings_source_src_28000.ds_partitioned) AS ds_partitioned__extract_doy - , DATE_TRUNC(bookings_source_src_28000.paid_at, day) AS paid_at__day - , DATE_TRUNC(bookings_source_src_28000.paid_at, isoweek) AS paid_at__week - , DATE_TRUNC(bookings_source_src_28000.paid_at, month) AS paid_at__month - , DATE_TRUNC(bookings_source_src_28000.paid_at, quarter) AS paid_at__quarter - , DATE_TRUNC(bookings_source_src_28000.paid_at, year) AS paid_at__year + , DATETIME_TRUNC(bookings_source_src_28000.paid_at, day) AS paid_at__day + , DATETIME_TRUNC(bookings_source_src_28000.paid_at, isoweek) AS paid_at__week + , DATETIME_TRUNC(bookings_source_src_28000.paid_at, month) AS paid_at__month + , DATETIME_TRUNC(bookings_source_src_28000.paid_at, quarter) AS paid_at__quarter + , DATETIME_TRUNC(bookings_source_src_28000.paid_at, year) AS paid_at__year , EXTRACT(year FROM bookings_source_src_28000.paid_at) AS paid_at__extract_year , EXTRACT(quarter FROM bookings_source_src_28000.paid_at) AS paid_at__extract_quarter , EXTRACT(month FROM bookings_source_src_28000.paid_at) AS paid_at__extract_month @@ -53,33 +53,33 @@ FROM ( , IF(EXTRACT(dayofweek FROM bookings_source_src_28000.paid_at) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_28000.paid_at) - 1) AS paid_at__extract_dow , EXTRACT(dayofyear FROM bookings_source_src_28000.paid_at) AS paid_at__extract_doy , bookings_source_src_28000.is_instant AS booking__is_instant - , DATE_TRUNC(bookings_source_src_28000.ds, day) AS booking__ds__day - , DATE_TRUNC(bookings_source_src_28000.ds, isoweek) AS booking__ds__week - , DATE_TRUNC(bookings_source_src_28000.ds, month) AS booking__ds__month - , DATE_TRUNC(bookings_source_src_28000.ds, quarter) AS booking__ds__quarter - , DATE_TRUNC(bookings_source_src_28000.ds, year) AS booking__ds__year + , DATETIME_TRUNC(bookings_source_src_28000.ds, day) AS booking__ds__day + , DATETIME_TRUNC(bookings_source_src_28000.ds, isoweek) AS booking__ds__week + , DATETIME_TRUNC(bookings_source_src_28000.ds, month) AS booking__ds__month + , DATETIME_TRUNC(bookings_source_src_28000.ds, quarter) AS booking__ds__quarter + , DATETIME_TRUNC(bookings_source_src_28000.ds, year) AS booking__ds__year , EXTRACT(year FROM bookings_source_src_28000.ds) AS booking__ds__extract_year , EXTRACT(quarter FROM bookings_source_src_28000.ds) AS booking__ds__extract_quarter , EXTRACT(month FROM bookings_source_src_28000.ds) AS booking__ds__extract_month , EXTRACT(day FROM bookings_source_src_28000.ds) AS booking__ds__extract_day , IF(EXTRACT(dayofweek FROM bookings_source_src_28000.ds) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_28000.ds) - 1) AS booking__ds__extract_dow , EXTRACT(dayofyear FROM bookings_source_src_28000.ds) AS booking__ds__extract_doy - , DATE_TRUNC(bookings_source_src_28000.ds_partitioned, day) AS booking__ds_partitioned__day - , DATE_TRUNC(bookings_source_src_28000.ds_partitioned, isoweek) AS booking__ds_partitioned__week - , DATE_TRUNC(bookings_source_src_28000.ds_partitioned, month) AS booking__ds_partitioned__month - , DATE_TRUNC(bookings_source_src_28000.ds_partitioned, quarter) AS booking__ds_partitioned__quarter - , DATE_TRUNC(bookings_source_src_28000.ds_partitioned, year) AS booking__ds_partitioned__year + , DATETIME_TRUNC(bookings_source_src_28000.ds_partitioned, day) AS booking__ds_partitioned__day + , DATETIME_TRUNC(bookings_source_src_28000.ds_partitioned, isoweek) AS booking__ds_partitioned__week + , DATETIME_TRUNC(bookings_source_src_28000.ds_partitioned, month) AS booking__ds_partitioned__month + , DATETIME_TRUNC(bookings_source_src_28000.ds_partitioned, quarter) AS booking__ds_partitioned__quarter + , DATETIME_TRUNC(bookings_source_src_28000.ds_partitioned, year) AS booking__ds_partitioned__year , EXTRACT(year FROM bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__extract_year , EXTRACT(quarter FROM bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__extract_quarter , EXTRACT(month FROM bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__extract_month , EXTRACT(day FROM bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__extract_day , IF(EXTRACT(dayofweek FROM bookings_source_src_28000.ds_partitioned) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_28000.ds_partitioned) - 1) AS booking__ds_partitioned__extract_dow , EXTRACT(dayofyear FROM bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__extract_doy - , DATE_TRUNC(bookings_source_src_28000.paid_at, day) AS booking__paid_at__day - , DATE_TRUNC(bookings_source_src_28000.paid_at, isoweek) AS booking__paid_at__week - , DATE_TRUNC(bookings_source_src_28000.paid_at, month) AS booking__paid_at__month - , DATE_TRUNC(bookings_source_src_28000.paid_at, quarter) AS booking__paid_at__quarter - , DATE_TRUNC(bookings_source_src_28000.paid_at, year) AS booking__paid_at__year + , DATETIME_TRUNC(bookings_source_src_28000.paid_at, day) AS booking__paid_at__day + , DATETIME_TRUNC(bookings_source_src_28000.paid_at, isoweek) AS booking__paid_at__week + , DATETIME_TRUNC(bookings_source_src_28000.paid_at, month) AS booking__paid_at__month + , DATETIME_TRUNC(bookings_source_src_28000.paid_at, quarter) AS booking__paid_at__quarter + , DATETIME_TRUNC(bookings_source_src_28000.paid_at, year) AS booking__paid_at__year , EXTRACT(year FROM bookings_source_src_28000.paid_at) AS booking__paid_at__extract_year , EXTRACT(quarter FROM bookings_source_src_28000.paid_at) AS booking__paid_at__extract_quarter , EXTRACT(month FROM bookings_source_src_28000.paid_at) AS booking__paid_at__extract_month diff --git a/tests_metricflow/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/BigQuery/test_filter_with_where_constraint_node__plan0.sql b/tests_metricflow/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/BigQuery/test_filter_with_where_constraint_node__plan0.sql index c6f25b8c6b..e9ea9b6f20 100644 --- a/tests_metricflow/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/BigQuery/test_filter_with_where_constraint_node__plan0.sql +++ b/tests_metricflow/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/BigQuery/test_filter_with_where_constraint_node__plan0.sql @@ -25,33 +25,33 @@ FROM ( , bookings_source_src_28000.booking_value AS approximate_continuous_booking_value_p99 , bookings_source_src_28000.booking_value AS approximate_discrete_booking_value_p99 , bookings_source_src_28000.is_instant - , DATE_TRUNC(bookings_source_src_28000.ds, day) AS ds__day - , DATE_TRUNC(bookings_source_src_28000.ds, isoweek) AS ds__week - , DATE_TRUNC(bookings_source_src_28000.ds, month) AS ds__month - , DATE_TRUNC(bookings_source_src_28000.ds, quarter) AS ds__quarter - , DATE_TRUNC(bookings_source_src_28000.ds, year) AS ds__year + , DATETIME_TRUNC(bookings_source_src_28000.ds, day) AS ds__day + , DATETIME_TRUNC(bookings_source_src_28000.ds, isoweek) AS ds__week + , DATETIME_TRUNC(bookings_source_src_28000.ds, month) AS ds__month + , DATETIME_TRUNC(bookings_source_src_28000.ds, quarter) AS ds__quarter + , DATETIME_TRUNC(bookings_source_src_28000.ds, year) AS ds__year , EXTRACT(year FROM bookings_source_src_28000.ds) AS ds__extract_year , EXTRACT(quarter FROM bookings_source_src_28000.ds) AS ds__extract_quarter , EXTRACT(month FROM bookings_source_src_28000.ds) AS ds__extract_month , EXTRACT(day FROM bookings_source_src_28000.ds) AS ds__extract_day , IF(EXTRACT(dayofweek FROM bookings_source_src_28000.ds) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_28000.ds) - 1) AS ds__extract_dow , EXTRACT(dayofyear FROM bookings_source_src_28000.ds) AS ds__extract_doy - , DATE_TRUNC(bookings_source_src_28000.ds_partitioned, day) AS ds_partitioned__day - , DATE_TRUNC(bookings_source_src_28000.ds_partitioned, isoweek) AS ds_partitioned__week - , DATE_TRUNC(bookings_source_src_28000.ds_partitioned, month) AS ds_partitioned__month - , DATE_TRUNC(bookings_source_src_28000.ds_partitioned, quarter) AS ds_partitioned__quarter - , DATE_TRUNC(bookings_source_src_28000.ds_partitioned, year) AS ds_partitioned__year + , DATETIME_TRUNC(bookings_source_src_28000.ds_partitioned, day) AS ds_partitioned__day + , DATETIME_TRUNC(bookings_source_src_28000.ds_partitioned, isoweek) AS ds_partitioned__week + , DATETIME_TRUNC(bookings_source_src_28000.ds_partitioned, month) AS ds_partitioned__month + , DATETIME_TRUNC(bookings_source_src_28000.ds_partitioned, quarter) AS ds_partitioned__quarter + , DATETIME_TRUNC(bookings_source_src_28000.ds_partitioned, year) AS ds_partitioned__year , EXTRACT(year FROM bookings_source_src_28000.ds_partitioned) AS ds_partitioned__extract_year , EXTRACT(quarter FROM bookings_source_src_28000.ds_partitioned) AS ds_partitioned__extract_quarter , EXTRACT(month FROM bookings_source_src_28000.ds_partitioned) AS ds_partitioned__extract_month , EXTRACT(day FROM bookings_source_src_28000.ds_partitioned) AS ds_partitioned__extract_day , IF(EXTRACT(dayofweek FROM bookings_source_src_28000.ds_partitioned) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_28000.ds_partitioned) - 1) AS ds_partitioned__extract_dow , EXTRACT(dayofyear FROM bookings_source_src_28000.ds_partitioned) AS ds_partitioned__extract_doy - , DATE_TRUNC(bookings_source_src_28000.paid_at, day) AS paid_at__day - , DATE_TRUNC(bookings_source_src_28000.paid_at, isoweek) AS paid_at__week - , DATE_TRUNC(bookings_source_src_28000.paid_at, month) AS paid_at__month - , DATE_TRUNC(bookings_source_src_28000.paid_at, quarter) AS paid_at__quarter - , DATE_TRUNC(bookings_source_src_28000.paid_at, year) AS paid_at__year + , DATETIME_TRUNC(bookings_source_src_28000.paid_at, day) AS paid_at__day + , DATETIME_TRUNC(bookings_source_src_28000.paid_at, isoweek) AS paid_at__week + , DATETIME_TRUNC(bookings_source_src_28000.paid_at, month) AS paid_at__month + , DATETIME_TRUNC(bookings_source_src_28000.paid_at, quarter) AS paid_at__quarter + , DATETIME_TRUNC(bookings_source_src_28000.paid_at, year) AS paid_at__year , EXTRACT(year FROM bookings_source_src_28000.paid_at) AS paid_at__extract_year , EXTRACT(quarter FROM bookings_source_src_28000.paid_at) AS paid_at__extract_quarter , EXTRACT(month FROM bookings_source_src_28000.paid_at) AS paid_at__extract_month @@ -59,33 +59,33 @@ FROM ( , IF(EXTRACT(dayofweek FROM bookings_source_src_28000.paid_at) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_28000.paid_at) - 1) AS paid_at__extract_dow , EXTRACT(dayofyear FROM bookings_source_src_28000.paid_at) AS paid_at__extract_doy , bookings_source_src_28000.is_instant AS booking__is_instant - , DATE_TRUNC(bookings_source_src_28000.ds, day) AS booking__ds__day - , DATE_TRUNC(bookings_source_src_28000.ds, isoweek) AS booking__ds__week - , DATE_TRUNC(bookings_source_src_28000.ds, month) AS booking__ds__month - , DATE_TRUNC(bookings_source_src_28000.ds, quarter) AS booking__ds__quarter - , DATE_TRUNC(bookings_source_src_28000.ds, year) AS booking__ds__year + , DATETIME_TRUNC(bookings_source_src_28000.ds, day) AS booking__ds__day + , DATETIME_TRUNC(bookings_source_src_28000.ds, isoweek) AS booking__ds__week + , DATETIME_TRUNC(bookings_source_src_28000.ds, month) AS booking__ds__month + , DATETIME_TRUNC(bookings_source_src_28000.ds, quarter) AS booking__ds__quarter + , DATETIME_TRUNC(bookings_source_src_28000.ds, year) AS booking__ds__year , EXTRACT(year FROM bookings_source_src_28000.ds) AS booking__ds__extract_year , EXTRACT(quarter FROM bookings_source_src_28000.ds) AS booking__ds__extract_quarter , EXTRACT(month FROM bookings_source_src_28000.ds) AS booking__ds__extract_month , EXTRACT(day FROM bookings_source_src_28000.ds) AS booking__ds__extract_day , IF(EXTRACT(dayofweek FROM bookings_source_src_28000.ds) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_28000.ds) - 1) AS booking__ds__extract_dow , EXTRACT(dayofyear FROM bookings_source_src_28000.ds) AS booking__ds__extract_doy - , DATE_TRUNC(bookings_source_src_28000.ds_partitioned, day) AS booking__ds_partitioned__day - , DATE_TRUNC(bookings_source_src_28000.ds_partitioned, isoweek) AS booking__ds_partitioned__week - , DATE_TRUNC(bookings_source_src_28000.ds_partitioned, month) AS booking__ds_partitioned__month - , DATE_TRUNC(bookings_source_src_28000.ds_partitioned, quarter) AS booking__ds_partitioned__quarter - , DATE_TRUNC(bookings_source_src_28000.ds_partitioned, year) AS booking__ds_partitioned__year + , DATETIME_TRUNC(bookings_source_src_28000.ds_partitioned, day) AS booking__ds_partitioned__day + , DATETIME_TRUNC(bookings_source_src_28000.ds_partitioned, isoweek) AS booking__ds_partitioned__week + , DATETIME_TRUNC(bookings_source_src_28000.ds_partitioned, month) AS booking__ds_partitioned__month + , DATETIME_TRUNC(bookings_source_src_28000.ds_partitioned, quarter) AS booking__ds_partitioned__quarter + , DATETIME_TRUNC(bookings_source_src_28000.ds_partitioned, year) AS booking__ds_partitioned__year , EXTRACT(year FROM bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__extract_year , EXTRACT(quarter FROM bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__extract_quarter , EXTRACT(month FROM bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__extract_month , EXTRACT(day FROM bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__extract_day , IF(EXTRACT(dayofweek FROM bookings_source_src_28000.ds_partitioned) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_28000.ds_partitioned) - 1) AS booking__ds_partitioned__extract_dow , EXTRACT(dayofyear FROM bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__extract_doy - , DATE_TRUNC(bookings_source_src_28000.paid_at, day) AS booking__paid_at__day - , DATE_TRUNC(bookings_source_src_28000.paid_at, isoweek) AS booking__paid_at__week - , DATE_TRUNC(bookings_source_src_28000.paid_at, month) AS booking__paid_at__month - , DATE_TRUNC(bookings_source_src_28000.paid_at, quarter) AS booking__paid_at__quarter - , DATE_TRUNC(bookings_source_src_28000.paid_at, year) AS booking__paid_at__year + , DATETIME_TRUNC(bookings_source_src_28000.paid_at, day) AS booking__paid_at__day + , DATETIME_TRUNC(bookings_source_src_28000.paid_at, isoweek) AS booking__paid_at__week + , DATETIME_TRUNC(bookings_source_src_28000.paid_at, month) AS booking__paid_at__month + , DATETIME_TRUNC(bookings_source_src_28000.paid_at, quarter) AS booking__paid_at__quarter + , DATETIME_TRUNC(bookings_source_src_28000.paid_at, year) AS booking__paid_at__year , EXTRACT(year FROM bookings_source_src_28000.paid_at) AS booking__paid_at__extract_year , EXTRACT(quarter FROM bookings_source_src_28000.paid_at) AS booking__paid_at__extract_quarter , EXTRACT(month FROM bookings_source_src_28000.paid_at) AS booking__paid_at__extract_month diff --git a/tests_metricflow/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/BigQuery/test_filter_with_where_constraint_node__plan0_optimized.sql b/tests_metricflow/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/BigQuery/test_filter_with_where_constraint_node__plan0_optimized.sql index 2ab56070e3..ef47de77ef 100644 --- a/tests_metricflow/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/BigQuery/test_filter_with_where_constraint_node__plan0_optimized.sql +++ b/tests_metricflow/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/BigQuery/test_filter_with_where_constraint_node__plan0_optimized.sql @@ -6,7 +6,7 @@ FROM ( -- Read Elements From Semantic Model 'bookings_source' -- Pass Only Elements: ['bookings', 'ds__day'] SELECT - DATE_TRUNC(ds, day) AS ds__day + DATETIME_TRUNC(ds, day) AS ds__day , 1 AS bookings FROM ***************************.fct_bookings bookings_source_src_28000 ) subq_3 diff --git a/tests_metricflow/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/BigQuery/test_join_to_time_spine_node_with_offset_to_grain__plan0.sql b/tests_metricflow/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/BigQuery/test_join_to_time_spine_node_with_offset_to_grain__plan0.sql index 52483571be..ea342dd3b9 100644 --- a/tests_metricflow/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/BigQuery/test_join_to_time_spine_node_with_offset_to_grain__plan0.sql +++ b/tests_metricflow/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/BigQuery/test_join_to_time_spine_node_with_offset_to_grain__plan0.sql @@ -147,33 +147,33 @@ INNER JOIN ( , bookings_source_src_28000.booking_value AS approximate_continuous_booking_value_p99 , bookings_source_src_28000.booking_value AS approximate_discrete_booking_value_p99 , bookings_source_src_28000.is_instant - , DATE_TRUNC(bookings_source_src_28000.ds, day) AS ds__day - , DATE_TRUNC(bookings_source_src_28000.ds, isoweek) AS ds__week - , DATE_TRUNC(bookings_source_src_28000.ds, month) AS ds__month - , DATE_TRUNC(bookings_source_src_28000.ds, quarter) AS ds__quarter - , DATE_TRUNC(bookings_source_src_28000.ds, year) AS ds__year + , DATETIME_TRUNC(bookings_source_src_28000.ds, day) AS ds__day + , DATETIME_TRUNC(bookings_source_src_28000.ds, isoweek) AS ds__week + , DATETIME_TRUNC(bookings_source_src_28000.ds, month) AS ds__month + , DATETIME_TRUNC(bookings_source_src_28000.ds, quarter) AS ds__quarter + , DATETIME_TRUNC(bookings_source_src_28000.ds, year) AS ds__year , EXTRACT(year FROM bookings_source_src_28000.ds) AS ds__extract_year , EXTRACT(quarter FROM bookings_source_src_28000.ds) AS ds__extract_quarter , EXTRACT(month FROM bookings_source_src_28000.ds) AS ds__extract_month , EXTRACT(day FROM bookings_source_src_28000.ds) AS ds__extract_day , IF(EXTRACT(dayofweek FROM bookings_source_src_28000.ds) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_28000.ds) - 1) AS ds__extract_dow , EXTRACT(dayofyear FROM bookings_source_src_28000.ds) AS ds__extract_doy - , DATE_TRUNC(bookings_source_src_28000.ds_partitioned, day) AS ds_partitioned__day - , DATE_TRUNC(bookings_source_src_28000.ds_partitioned, isoweek) AS ds_partitioned__week - , DATE_TRUNC(bookings_source_src_28000.ds_partitioned, month) AS ds_partitioned__month - , DATE_TRUNC(bookings_source_src_28000.ds_partitioned, quarter) AS ds_partitioned__quarter - , DATE_TRUNC(bookings_source_src_28000.ds_partitioned, year) AS ds_partitioned__year + , DATETIME_TRUNC(bookings_source_src_28000.ds_partitioned, day) AS ds_partitioned__day + , DATETIME_TRUNC(bookings_source_src_28000.ds_partitioned, isoweek) AS ds_partitioned__week + , DATETIME_TRUNC(bookings_source_src_28000.ds_partitioned, month) AS ds_partitioned__month + , DATETIME_TRUNC(bookings_source_src_28000.ds_partitioned, quarter) AS ds_partitioned__quarter + , DATETIME_TRUNC(bookings_source_src_28000.ds_partitioned, year) AS ds_partitioned__year , EXTRACT(year FROM bookings_source_src_28000.ds_partitioned) AS ds_partitioned__extract_year , EXTRACT(quarter FROM bookings_source_src_28000.ds_partitioned) AS ds_partitioned__extract_quarter , EXTRACT(month FROM bookings_source_src_28000.ds_partitioned) AS ds_partitioned__extract_month , EXTRACT(day FROM bookings_source_src_28000.ds_partitioned) AS ds_partitioned__extract_day , IF(EXTRACT(dayofweek FROM bookings_source_src_28000.ds_partitioned) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_28000.ds_partitioned) - 1) AS ds_partitioned__extract_dow , EXTRACT(dayofyear FROM bookings_source_src_28000.ds_partitioned) AS ds_partitioned__extract_doy - , DATE_TRUNC(bookings_source_src_28000.paid_at, day) AS paid_at__day - , DATE_TRUNC(bookings_source_src_28000.paid_at, isoweek) AS paid_at__week - , DATE_TRUNC(bookings_source_src_28000.paid_at, month) AS paid_at__month - , DATE_TRUNC(bookings_source_src_28000.paid_at, quarter) AS paid_at__quarter - , DATE_TRUNC(bookings_source_src_28000.paid_at, year) AS paid_at__year + , DATETIME_TRUNC(bookings_source_src_28000.paid_at, day) AS paid_at__day + , DATETIME_TRUNC(bookings_source_src_28000.paid_at, isoweek) AS paid_at__week + , DATETIME_TRUNC(bookings_source_src_28000.paid_at, month) AS paid_at__month + , DATETIME_TRUNC(bookings_source_src_28000.paid_at, quarter) AS paid_at__quarter + , DATETIME_TRUNC(bookings_source_src_28000.paid_at, year) AS paid_at__year , EXTRACT(year FROM bookings_source_src_28000.paid_at) AS paid_at__extract_year , EXTRACT(quarter FROM bookings_source_src_28000.paid_at) AS paid_at__extract_quarter , EXTRACT(month FROM bookings_source_src_28000.paid_at) AS paid_at__extract_month @@ -181,33 +181,33 @@ INNER JOIN ( , IF(EXTRACT(dayofweek FROM bookings_source_src_28000.paid_at) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_28000.paid_at) - 1) AS paid_at__extract_dow , EXTRACT(dayofyear FROM bookings_source_src_28000.paid_at) AS paid_at__extract_doy , bookings_source_src_28000.is_instant AS booking__is_instant - , DATE_TRUNC(bookings_source_src_28000.ds, day) AS booking__ds__day - , DATE_TRUNC(bookings_source_src_28000.ds, isoweek) AS booking__ds__week - , DATE_TRUNC(bookings_source_src_28000.ds, month) AS booking__ds__month - , DATE_TRUNC(bookings_source_src_28000.ds, quarter) AS booking__ds__quarter - , DATE_TRUNC(bookings_source_src_28000.ds, year) AS booking__ds__year + , DATETIME_TRUNC(bookings_source_src_28000.ds, day) AS booking__ds__day + , DATETIME_TRUNC(bookings_source_src_28000.ds, isoweek) AS booking__ds__week + , DATETIME_TRUNC(bookings_source_src_28000.ds, month) AS booking__ds__month + , DATETIME_TRUNC(bookings_source_src_28000.ds, quarter) AS booking__ds__quarter + , DATETIME_TRUNC(bookings_source_src_28000.ds, year) AS booking__ds__year , EXTRACT(year FROM bookings_source_src_28000.ds) AS booking__ds__extract_year , EXTRACT(quarter FROM bookings_source_src_28000.ds) AS booking__ds__extract_quarter , EXTRACT(month FROM bookings_source_src_28000.ds) AS booking__ds__extract_month , EXTRACT(day FROM bookings_source_src_28000.ds) AS booking__ds__extract_day , IF(EXTRACT(dayofweek FROM bookings_source_src_28000.ds) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_28000.ds) - 1) AS booking__ds__extract_dow , EXTRACT(dayofyear FROM bookings_source_src_28000.ds) AS booking__ds__extract_doy - , DATE_TRUNC(bookings_source_src_28000.ds_partitioned, day) AS booking__ds_partitioned__day - , DATE_TRUNC(bookings_source_src_28000.ds_partitioned, isoweek) AS booking__ds_partitioned__week - , DATE_TRUNC(bookings_source_src_28000.ds_partitioned, month) AS booking__ds_partitioned__month - , DATE_TRUNC(bookings_source_src_28000.ds_partitioned, quarter) AS booking__ds_partitioned__quarter - , DATE_TRUNC(bookings_source_src_28000.ds_partitioned, year) AS booking__ds_partitioned__year + , DATETIME_TRUNC(bookings_source_src_28000.ds_partitioned, day) AS booking__ds_partitioned__day + , DATETIME_TRUNC(bookings_source_src_28000.ds_partitioned, isoweek) AS booking__ds_partitioned__week + , DATETIME_TRUNC(bookings_source_src_28000.ds_partitioned, month) AS booking__ds_partitioned__month + , DATETIME_TRUNC(bookings_source_src_28000.ds_partitioned, quarter) AS booking__ds_partitioned__quarter + , DATETIME_TRUNC(bookings_source_src_28000.ds_partitioned, year) AS booking__ds_partitioned__year , EXTRACT(year FROM bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__extract_year , EXTRACT(quarter FROM bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__extract_quarter , EXTRACT(month FROM bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__extract_month , EXTRACT(day FROM bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__extract_day , IF(EXTRACT(dayofweek FROM bookings_source_src_28000.ds_partitioned) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_28000.ds_partitioned) - 1) AS booking__ds_partitioned__extract_dow , EXTRACT(dayofyear FROM bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__extract_doy - , DATE_TRUNC(bookings_source_src_28000.paid_at, day) AS booking__paid_at__day - , DATE_TRUNC(bookings_source_src_28000.paid_at, isoweek) AS booking__paid_at__week - , DATE_TRUNC(bookings_source_src_28000.paid_at, month) AS booking__paid_at__month - , DATE_TRUNC(bookings_source_src_28000.paid_at, quarter) AS booking__paid_at__quarter - , DATE_TRUNC(bookings_source_src_28000.paid_at, year) AS booking__paid_at__year + , DATETIME_TRUNC(bookings_source_src_28000.paid_at, day) AS booking__paid_at__day + , DATETIME_TRUNC(bookings_source_src_28000.paid_at, isoweek) AS booking__paid_at__week + , DATETIME_TRUNC(bookings_source_src_28000.paid_at, month) AS booking__paid_at__month + , DATETIME_TRUNC(bookings_source_src_28000.paid_at, quarter) AS booking__paid_at__quarter + , DATETIME_TRUNC(bookings_source_src_28000.paid_at, year) AS booking__paid_at__year , EXTRACT(year FROM bookings_source_src_28000.paid_at) AS booking__paid_at__extract_year , EXTRACT(quarter FROM bookings_source_src_28000.paid_at) AS booking__paid_at__extract_quarter , EXTRACT(month FROM bookings_source_src_28000.paid_at) AS booking__paid_at__extract_month @@ -230,4 +230,4 @@ INNER JOIN ( ) subq_3 ) subq_4 ON - DATE_TRUNC(subq_5.metric_time__day, month) = subq_4.metric_time__day + DATETIME_TRUNC(subq_5.metric_time__day, month) = subq_4.metric_time__day diff --git a/tests_metricflow/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/BigQuery/test_join_to_time_spine_node_with_offset_to_grain__plan0_optimized.sql b/tests_metricflow/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/BigQuery/test_join_to_time_spine_node_with_offset_to_grain__plan0_optimized.sql index de1c51339b..c13f6cf11d 100644 --- a/tests_metricflow/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/BigQuery/test_join_to_time_spine_node_with_offset_to_grain__plan0_optimized.sql +++ b/tests_metricflow/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/BigQuery/test_join_to_time_spine_node_with_offset_to_grain__plan0_optimized.sql @@ -22,7 +22,7 @@ INNER JOIN ( -- Pass Only Elements: ['booking_value', 'metric_time__day', 'listing'] -- Aggregate Measures SELECT - DATE_TRUNC(ds, day) AS metric_time__day + DATETIME_TRUNC(ds, day) AS metric_time__day , listing_id AS listing , SUM(booking_value) AS booking_value FROM ***************************.fct_bookings bookings_source_src_28000 @@ -32,4 +32,4 @@ INNER JOIN ( ) subq_10 ) subq_11 ON - DATE_TRUNC(subq_12.metric_time__day, month) = subq_11.metric_time__day + DATETIME_TRUNC(subq_12.metric_time__day, month) = subq_11.metric_time__day diff --git a/tests_metricflow/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/BigQuery/test_join_to_time_spine_node_with_offset_window__plan0.sql b/tests_metricflow/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/BigQuery/test_join_to_time_spine_node_with_offset_window__plan0.sql index 4d85900d84..9594d9ef88 100644 --- a/tests_metricflow/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/BigQuery/test_join_to_time_spine_node_with_offset_window__plan0.sql +++ b/tests_metricflow/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/BigQuery/test_join_to_time_spine_node_with_offset_window__plan0.sql @@ -147,33 +147,33 @@ INNER JOIN ( , bookings_source_src_28000.booking_value AS approximate_continuous_booking_value_p99 , bookings_source_src_28000.booking_value AS approximate_discrete_booking_value_p99 , bookings_source_src_28000.is_instant - , DATE_TRUNC(bookings_source_src_28000.ds, day) AS ds__day - , DATE_TRUNC(bookings_source_src_28000.ds, isoweek) AS ds__week - , DATE_TRUNC(bookings_source_src_28000.ds, month) AS ds__month - , DATE_TRUNC(bookings_source_src_28000.ds, quarter) AS ds__quarter - , DATE_TRUNC(bookings_source_src_28000.ds, year) AS ds__year + , DATETIME_TRUNC(bookings_source_src_28000.ds, day) AS ds__day + , DATETIME_TRUNC(bookings_source_src_28000.ds, isoweek) AS ds__week + , DATETIME_TRUNC(bookings_source_src_28000.ds, month) AS ds__month + , DATETIME_TRUNC(bookings_source_src_28000.ds, quarter) AS ds__quarter + , DATETIME_TRUNC(bookings_source_src_28000.ds, year) AS ds__year , EXTRACT(year FROM bookings_source_src_28000.ds) AS ds__extract_year , EXTRACT(quarter FROM bookings_source_src_28000.ds) AS ds__extract_quarter , EXTRACT(month FROM bookings_source_src_28000.ds) AS ds__extract_month , EXTRACT(day FROM bookings_source_src_28000.ds) AS ds__extract_day , IF(EXTRACT(dayofweek FROM bookings_source_src_28000.ds) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_28000.ds) - 1) AS ds__extract_dow , EXTRACT(dayofyear FROM bookings_source_src_28000.ds) AS ds__extract_doy - , DATE_TRUNC(bookings_source_src_28000.ds_partitioned, day) AS ds_partitioned__day - , DATE_TRUNC(bookings_source_src_28000.ds_partitioned, isoweek) AS ds_partitioned__week - , DATE_TRUNC(bookings_source_src_28000.ds_partitioned, month) AS ds_partitioned__month - , DATE_TRUNC(bookings_source_src_28000.ds_partitioned, quarter) AS ds_partitioned__quarter - , DATE_TRUNC(bookings_source_src_28000.ds_partitioned, year) AS ds_partitioned__year + , DATETIME_TRUNC(bookings_source_src_28000.ds_partitioned, day) AS ds_partitioned__day + , DATETIME_TRUNC(bookings_source_src_28000.ds_partitioned, isoweek) AS ds_partitioned__week + , DATETIME_TRUNC(bookings_source_src_28000.ds_partitioned, month) AS ds_partitioned__month + , DATETIME_TRUNC(bookings_source_src_28000.ds_partitioned, quarter) AS ds_partitioned__quarter + , DATETIME_TRUNC(bookings_source_src_28000.ds_partitioned, year) AS ds_partitioned__year , EXTRACT(year FROM bookings_source_src_28000.ds_partitioned) AS ds_partitioned__extract_year , EXTRACT(quarter FROM bookings_source_src_28000.ds_partitioned) AS ds_partitioned__extract_quarter , EXTRACT(month FROM bookings_source_src_28000.ds_partitioned) AS ds_partitioned__extract_month , EXTRACT(day FROM bookings_source_src_28000.ds_partitioned) AS ds_partitioned__extract_day , IF(EXTRACT(dayofweek FROM bookings_source_src_28000.ds_partitioned) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_28000.ds_partitioned) - 1) AS ds_partitioned__extract_dow , EXTRACT(dayofyear FROM bookings_source_src_28000.ds_partitioned) AS ds_partitioned__extract_doy - , DATE_TRUNC(bookings_source_src_28000.paid_at, day) AS paid_at__day - , DATE_TRUNC(bookings_source_src_28000.paid_at, isoweek) AS paid_at__week - , DATE_TRUNC(bookings_source_src_28000.paid_at, month) AS paid_at__month - , DATE_TRUNC(bookings_source_src_28000.paid_at, quarter) AS paid_at__quarter - , DATE_TRUNC(bookings_source_src_28000.paid_at, year) AS paid_at__year + , DATETIME_TRUNC(bookings_source_src_28000.paid_at, day) AS paid_at__day + , DATETIME_TRUNC(bookings_source_src_28000.paid_at, isoweek) AS paid_at__week + , DATETIME_TRUNC(bookings_source_src_28000.paid_at, month) AS paid_at__month + , DATETIME_TRUNC(bookings_source_src_28000.paid_at, quarter) AS paid_at__quarter + , DATETIME_TRUNC(bookings_source_src_28000.paid_at, year) AS paid_at__year , EXTRACT(year FROM bookings_source_src_28000.paid_at) AS paid_at__extract_year , EXTRACT(quarter FROM bookings_source_src_28000.paid_at) AS paid_at__extract_quarter , EXTRACT(month FROM bookings_source_src_28000.paid_at) AS paid_at__extract_month @@ -181,33 +181,33 @@ INNER JOIN ( , IF(EXTRACT(dayofweek FROM bookings_source_src_28000.paid_at) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_28000.paid_at) - 1) AS paid_at__extract_dow , EXTRACT(dayofyear FROM bookings_source_src_28000.paid_at) AS paid_at__extract_doy , bookings_source_src_28000.is_instant AS booking__is_instant - , DATE_TRUNC(bookings_source_src_28000.ds, day) AS booking__ds__day - , DATE_TRUNC(bookings_source_src_28000.ds, isoweek) AS booking__ds__week - , DATE_TRUNC(bookings_source_src_28000.ds, month) AS booking__ds__month - , DATE_TRUNC(bookings_source_src_28000.ds, quarter) AS booking__ds__quarter - , DATE_TRUNC(bookings_source_src_28000.ds, year) AS booking__ds__year + , DATETIME_TRUNC(bookings_source_src_28000.ds, day) AS booking__ds__day + , DATETIME_TRUNC(bookings_source_src_28000.ds, isoweek) AS booking__ds__week + , DATETIME_TRUNC(bookings_source_src_28000.ds, month) AS booking__ds__month + , DATETIME_TRUNC(bookings_source_src_28000.ds, quarter) AS booking__ds__quarter + , DATETIME_TRUNC(bookings_source_src_28000.ds, year) AS booking__ds__year , EXTRACT(year FROM bookings_source_src_28000.ds) AS booking__ds__extract_year , EXTRACT(quarter FROM bookings_source_src_28000.ds) AS booking__ds__extract_quarter , EXTRACT(month FROM bookings_source_src_28000.ds) AS booking__ds__extract_month , EXTRACT(day FROM bookings_source_src_28000.ds) AS booking__ds__extract_day , IF(EXTRACT(dayofweek FROM bookings_source_src_28000.ds) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_28000.ds) - 1) AS booking__ds__extract_dow , EXTRACT(dayofyear FROM bookings_source_src_28000.ds) AS booking__ds__extract_doy - , DATE_TRUNC(bookings_source_src_28000.ds_partitioned, day) AS booking__ds_partitioned__day - , DATE_TRUNC(bookings_source_src_28000.ds_partitioned, isoweek) AS booking__ds_partitioned__week - , DATE_TRUNC(bookings_source_src_28000.ds_partitioned, month) AS booking__ds_partitioned__month - , DATE_TRUNC(bookings_source_src_28000.ds_partitioned, quarter) AS booking__ds_partitioned__quarter - , DATE_TRUNC(bookings_source_src_28000.ds_partitioned, year) AS booking__ds_partitioned__year + , DATETIME_TRUNC(bookings_source_src_28000.ds_partitioned, day) AS booking__ds_partitioned__day + , DATETIME_TRUNC(bookings_source_src_28000.ds_partitioned, isoweek) AS booking__ds_partitioned__week + , DATETIME_TRUNC(bookings_source_src_28000.ds_partitioned, month) AS booking__ds_partitioned__month + , DATETIME_TRUNC(bookings_source_src_28000.ds_partitioned, quarter) AS booking__ds_partitioned__quarter + , DATETIME_TRUNC(bookings_source_src_28000.ds_partitioned, year) AS booking__ds_partitioned__year , EXTRACT(year FROM bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__extract_year , EXTRACT(quarter FROM bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__extract_quarter , EXTRACT(month FROM bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__extract_month , EXTRACT(day FROM bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__extract_day , IF(EXTRACT(dayofweek FROM bookings_source_src_28000.ds_partitioned) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_28000.ds_partitioned) - 1) AS booking__ds_partitioned__extract_dow , EXTRACT(dayofyear FROM bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__extract_doy - , DATE_TRUNC(bookings_source_src_28000.paid_at, day) AS booking__paid_at__day - , DATE_TRUNC(bookings_source_src_28000.paid_at, isoweek) AS booking__paid_at__week - , DATE_TRUNC(bookings_source_src_28000.paid_at, month) AS booking__paid_at__month - , DATE_TRUNC(bookings_source_src_28000.paid_at, quarter) AS booking__paid_at__quarter - , DATE_TRUNC(bookings_source_src_28000.paid_at, year) AS booking__paid_at__year + , DATETIME_TRUNC(bookings_source_src_28000.paid_at, day) AS booking__paid_at__day + , DATETIME_TRUNC(bookings_source_src_28000.paid_at, isoweek) AS booking__paid_at__week + , DATETIME_TRUNC(bookings_source_src_28000.paid_at, month) AS booking__paid_at__month + , DATETIME_TRUNC(bookings_source_src_28000.paid_at, quarter) AS booking__paid_at__quarter + , DATETIME_TRUNC(bookings_source_src_28000.paid_at, year) AS booking__paid_at__year , EXTRACT(year FROM bookings_source_src_28000.paid_at) AS booking__paid_at__extract_year , EXTRACT(quarter FROM bookings_source_src_28000.paid_at) AS booking__paid_at__extract_quarter , EXTRACT(month FROM bookings_source_src_28000.paid_at) AS booking__paid_at__extract_month diff --git a/tests_metricflow/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/BigQuery/test_join_to_time_spine_node_with_offset_window__plan0_optimized.sql b/tests_metricflow/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/BigQuery/test_join_to_time_spine_node_with_offset_window__plan0_optimized.sql index 33bf45f967..b86e41cd63 100644 --- a/tests_metricflow/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/BigQuery/test_join_to_time_spine_node_with_offset_window__plan0_optimized.sql +++ b/tests_metricflow/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/BigQuery/test_join_to_time_spine_node_with_offset_window__plan0_optimized.sql @@ -22,7 +22,7 @@ INNER JOIN ( -- Pass Only Elements: ['booking_value', 'metric_time__day', 'listing'] -- Aggregate Measures SELECT - DATE_TRUNC(ds, day) AS metric_time__day + DATETIME_TRUNC(ds, day) AS metric_time__day , listing_id AS listing , SUM(booking_value) AS booking_value FROM ***************************.fct_bookings bookings_source_src_28000 diff --git a/tests_metricflow/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/BigQuery/test_join_to_time_spine_node_without_offset__plan0.sql b/tests_metricflow/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/BigQuery/test_join_to_time_spine_node_without_offset__plan0.sql index b890725bb3..3d64a5d15d 100644 --- a/tests_metricflow/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/BigQuery/test_join_to_time_spine_node_without_offset__plan0.sql +++ b/tests_metricflow/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/BigQuery/test_join_to_time_spine_node_without_offset__plan0.sql @@ -147,33 +147,33 @@ INNER JOIN ( , bookings_source_src_28000.booking_value AS approximate_continuous_booking_value_p99 , bookings_source_src_28000.booking_value AS approximate_discrete_booking_value_p99 , bookings_source_src_28000.is_instant - , DATE_TRUNC(bookings_source_src_28000.ds, day) AS ds__day - , DATE_TRUNC(bookings_source_src_28000.ds, isoweek) AS ds__week - , DATE_TRUNC(bookings_source_src_28000.ds, month) AS ds__month - , DATE_TRUNC(bookings_source_src_28000.ds, quarter) AS ds__quarter - , DATE_TRUNC(bookings_source_src_28000.ds, year) AS ds__year + , DATETIME_TRUNC(bookings_source_src_28000.ds, day) AS ds__day + , DATETIME_TRUNC(bookings_source_src_28000.ds, isoweek) AS ds__week + , DATETIME_TRUNC(bookings_source_src_28000.ds, month) AS ds__month + , DATETIME_TRUNC(bookings_source_src_28000.ds, quarter) AS ds__quarter + , DATETIME_TRUNC(bookings_source_src_28000.ds, year) AS ds__year , EXTRACT(year FROM bookings_source_src_28000.ds) AS ds__extract_year , EXTRACT(quarter FROM bookings_source_src_28000.ds) AS ds__extract_quarter , EXTRACT(month FROM bookings_source_src_28000.ds) AS ds__extract_month , EXTRACT(day FROM bookings_source_src_28000.ds) AS ds__extract_day , IF(EXTRACT(dayofweek FROM bookings_source_src_28000.ds) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_28000.ds) - 1) AS ds__extract_dow , EXTRACT(dayofyear FROM bookings_source_src_28000.ds) AS ds__extract_doy - , DATE_TRUNC(bookings_source_src_28000.ds_partitioned, day) AS ds_partitioned__day - , DATE_TRUNC(bookings_source_src_28000.ds_partitioned, isoweek) AS ds_partitioned__week - , DATE_TRUNC(bookings_source_src_28000.ds_partitioned, month) AS ds_partitioned__month - , DATE_TRUNC(bookings_source_src_28000.ds_partitioned, quarter) AS ds_partitioned__quarter - , DATE_TRUNC(bookings_source_src_28000.ds_partitioned, year) AS ds_partitioned__year + , DATETIME_TRUNC(bookings_source_src_28000.ds_partitioned, day) AS ds_partitioned__day + , DATETIME_TRUNC(bookings_source_src_28000.ds_partitioned, isoweek) AS ds_partitioned__week + , DATETIME_TRUNC(bookings_source_src_28000.ds_partitioned, month) AS ds_partitioned__month + , DATETIME_TRUNC(bookings_source_src_28000.ds_partitioned, quarter) AS ds_partitioned__quarter + , DATETIME_TRUNC(bookings_source_src_28000.ds_partitioned, year) AS ds_partitioned__year , EXTRACT(year FROM bookings_source_src_28000.ds_partitioned) AS ds_partitioned__extract_year , EXTRACT(quarter FROM bookings_source_src_28000.ds_partitioned) AS ds_partitioned__extract_quarter , EXTRACT(month FROM bookings_source_src_28000.ds_partitioned) AS ds_partitioned__extract_month , EXTRACT(day FROM bookings_source_src_28000.ds_partitioned) AS ds_partitioned__extract_day , IF(EXTRACT(dayofweek FROM bookings_source_src_28000.ds_partitioned) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_28000.ds_partitioned) - 1) AS ds_partitioned__extract_dow , EXTRACT(dayofyear FROM bookings_source_src_28000.ds_partitioned) AS ds_partitioned__extract_doy - , DATE_TRUNC(bookings_source_src_28000.paid_at, day) AS paid_at__day - , DATE_TRUNC(bookings_source_src_28000.paid_at, isoweek) AS paid_at__week - , DATE_TRUNC(bookings_source_src_28000.paid_at, month) AS paid_at__month - , DATE_TRUNC(bookings_source_src_28000.paid_at, quarter) AS paid_at__quarter - , DATE_TRUNC(bookings_source_src_28000.paid_at, year) AS paid_at__year + , DATETIME_TRUNC(bookings_source_src_28000.paid_at, day) AS paid_at__day + , DATETIME_TRUNC(bookings_source_src_28000.paid_at, isoweek) AS paid_at__week + , DATETIME_TRUNC(bookings_source_src_28000.paid_at, month) AS paid_at__month + , DATETIME_TRUNC(bookings_source_src_28000.paid_at, quarter) AS paid_at__quarter + , DATETIME_TRUNC(bookings_source_src_28000.paid_at, year) AS paid_at__year , EXTRACT(year FROM bookings_source_src_28000.paid_at) AS paid_at__extract_year , EXTRACT(quarter FROM bookings_source_src_28000.paid_at) AS paid_at__extract_quarter , EXTRACT(month FROM bookings_source_src_28000.paid_at) AS paid_at__extract_month @@ -181,33 +181,33 @@ INNER JOIN ( , IF(EXTRACT(dayofweek FROM bookings_source_src_28000.paid_at) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_28000.paid_at) - 1) AS paid_at__extract_dow , EXTRACT(dayofyear FROM bookings_source_src_28000.paid_at) AS paid_at__extract_doy , bookings_source_src_28000.is_instant AS booking__is_instant - , DATE_TRUNC(bookings_source_src_28000.ds, day) AS booking__ds__day - , DATE_TRUNC(bookings_source_src_28000.ds, isoweek) AS booking__ds__week - , DATE_TRUNC(bookings_source_src_28000.ds, month) AS booking__ds__month - , DATE_TRUNC(bookings_source_src_28000.ds, quarter) AS booking__ds__quarter - , DATE_TRUNC(bookings_source_src_28000.ds, year) AS booking__ds__year + , DATETIME_TRUNC(bookings_source_src_28000.ds, day) AS booking__ds__day + , DATETIME_TRUNC(bookings_source_src_28000.ds, isoweek) AS booking__ds__week + , DATETIME_TRUNC(bookings_source_src_28000.ds, month) AS booking__ds__month + , DATETIME_TRUNC(bookings_source_src_28000.ds, quarter) AS booking__ds__quarter + , DATETIME_TRUNC(bookings_source_src_28000.ds, year) AS booking__ds__year , EXTRACT(year FROM bookings_source_src_28000.ds) AS booking__ds__extract_year , EXTRACT(quarter FROM bookings_source_src_28000.ds) AS booking__ds__extract_quarter , EXTRACT(month FROM bookings_source_src_28000.ds) AS booking__ds__extract_month , EXTRACT(day FROM bookings_source_src_28000.ds) AS booking__ds__extract_day , IF(EXTRACT(dayofweek FROM bookings_source_src_28000.ds) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_28000.ds) - 1) AS booking__ds__extract_dow , EXTRACT(dayofyear FROM bookings_source_src_28000.ds) AS booking__ds__extract_doy - , DATE_TRUNC(bookings_source_src_28000.ds_partitioned, day) AS booking__ds_partitioned__day - , DATE_TRUNC(bookings_source_src_28000.ds_partitioned, isoweek) AS booking__ds_partitioned__week - , DATE_TRUNC(bookings_source_src_28000.ds_partitioned, month) AS booking__ds_partitioned__month - , DATE_TRUNC(bookings_source_src_28000.ds_partitioned, quarter) AS booking__ds_partitioned__quarter - , DATE_TRUNC(bookings_source_src_28000.ds_partitioned, year) AS booking__ds_partitioned__year + , DATETIME_TRUNC(bookings_source_src_28000.ds_partitioned, day) AS booking__ds_partitioned__day + , DATETIME_TRUNC(bookings_source_src_28000.ds_partitioned, isoweek) AS booking__ds_partitioned__week + , DATETIME_TRUNC(bookings_source_src_28000.ds_partitioned, month) AS booking__ds_partitioned__month + , DATETIME_TRUNC(bookings_source_src_28000.ds_partitioned, quarter) AS booking__ds_partitioned__quarter + , DATETIME_TRUNC(bookings_source_src_28000.ds_partitioned, year) AS booking__ds_partitioned__year , EXTRACT(year FROM bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__extract_year , EXTRACT(quarter FROM bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__extract_quarter , EXTRACT(month FROM bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__extract_month , EXTRACT(day FROM bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__extract_day , IF(EXTRACT(dayofweek FROM bookings_source_src_28000.ds_partitioned) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_28000.ds_partitioned) - 1) AS booking__ds_partitioned__extract_dow , EXTRACT(dayofyear FROM bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__extract_doy - , DATE_TRUNC(bookings_source_src_28000.paid_at, day) AS booking__paid_at__day - , DATE_TRUNC(bookings_source_src_28000.paid_at, isoweek) AS booking__paid_at__week - , DATE_TRUNC(bookings_source_src_28000.paid_at, month) AS booking__paid_at__month - , DATE_TRUNC(bookings_source_src_28000.paid_at, quarter) AS booking__paid_at__quarter - , DATE_TRUNC(bookings_source_src_28000.paid_at, year) AS booking__paid_at__year + , DATETIME_TRUNC(bookings_source_src_28000.paid_at, day) AS booking__paid_at__day + , DATETIME_TRUNC(bookings_source_src_28000.paid_at, isoweek) AS booking__paid_at__week + , DATETIME_TRUNC(bookings_source_src_28000.paid_at, month) AS booking__paid_at__month + , DATETIME_TRUNC(bookings_source_src_28000.paid_at, quarter) AS booking__paid_at__quarter + , DATETIME_TRUNC(bookings_source_src_28000.paid_at, year) AS booking__paid_at__year , EXTRACT(year FROM bookings_source_src_28000.paid_at) AS booking__paid_at__extract_year , EXTRACT(quarter FROM bookings_source_src_28000.paid_at) AS booking__paid_at__extract_quarter , EXTRACT(month FROM bookings_source_src_28000.paid_at) AS booking__paid_at__extract_month diff --git a/tests_metricflow/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/BigQuery/test_join_to_time_spine_node_without_offset__plan0_optimized.sql b/tests_metricflow/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/BigQuery/test_join_to_time_spine_node_without_offset__plan0_optimized.sql index 22fd39eb0b..afecd64116 100644 --- a/tests_metricflow/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/BigQuery/test_join_to_time_spine_node_without_offset__plan0_optimized.sql +++ b/tests_metricflow/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/BigQuery/test_join_to_time_spine_node_without_offset__plan0_optimized.sql @@ -22,7 +22,7 @@ INNER JOIN ( -- Pass Only Elements: ['booking_value', 'metric_time__day', 'listing'] -- Aggregate Measures SELECT - DATE_TRUNC(ds, day) AS metric_time__day + DATETIME_TRUNC(ds, day) AS metric_time__day , listing_id AS listing , SUM(booking_value) AS booking_value FROM ***************************.fct_bookings bookings_source_src_28000 diff --git a/tests_metricflow/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/BigQuery/test_measure_aggregation_node__plan0.sql b/tests_metricflow/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/BigQuery/test_measure_aggregation_node__plan0.sql index 64a83506ab..61776243c7 100644 --- a/tests_metricflow/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/BigQuery/test_measure_aggregation_node__plan0.sql +++ b/tests_metricflow/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/BigQuery/test_measure_aggregation_node__plan0.sql @@ -29,33 +29,33 @@ FROM ( , bookings_source_src_28000.booking_value AS approximate_continuous_booking_value_p99 , bookings_source_src_28000.booking_value AS approximate_discrete_booking_value_p99 , bookings_source_src_28000.is_instant - , DATE_TRUNC(bookings_source_src_28000.ds, day) AS ds__day - , DATE_TRUNC(bookings_source_src_28000.ds, isoweek) AS ds__week - , DATE_TRUNC(bookings_source_src_28000.ds, month) AS ds__month - , DATE_TRUNC(bookings_source_src_28000.ds, quarter) AS ds__quarter - , DATE_TRUNC(bookings_source_src_28000.ds, year) AS ds__year + , DATETIME_TRUNC(bookings_source_src_28000.ds, day) AS ds__day + , DATETIME_TRUNC(bookings_source_src_28000.ds, isoweek) AS ds__week + , DATETIME_TRUNC(bookings_source_src_28000.ds, month) AS ds__month + , DATETIME_TRUNC(bookings_source_src_28000.ds, quarter) AS ds__quarter + , DATETIME_TRUNC(bookings_source_src_28000.ds, year) AS ds__year , EXTRACT(year FROM bookings_source_src_28000.ds) AS ds__extract_year , EXTRACT(quarter FROM bookings_source_src_28000.ds) AS ds__extract_quarter , EXTRACT(month FROM bookings_source_src_28000.ds) AS ds__extract_month , EXTRACT(day FROM bookings_source_src_28000.ds) AS ds__extract_day , IF(EXTRACT(dayofweek FROM bookings_source_src_28000.ds) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_28000.ds) - 1) AS ds__extract_dow , EXTRACT(dayofyear FROM bookings_source_src_28000.ds) AS ds__extract_doy - , DATE_TRUNC(bookings_source_src_28000.ds_partitioned, day) AS ds_partitioned__day - , DATE_TRUNC(bookings_source_src_28000.ds_partitioned, isoweek) AS ds_partitioned__week - , DATE_TRUNC(bookings_source_src_28000.ds_partitioned, month) AS ds_partitioned__month - , DATE_TRUNC(bookings_source_src_28000.ds_partitioned, quarter) AS ds_partitioned__quarter - , DATE_TRUNC(bookings_source_src_28000.ds_partitioned, year) AS ds_partitioned__year + , DATETIME_TRUNC(bookings_source_src_28000.ds_partitioned, day) AS ds_partitioned__day + , DATETIME_TRUNC(bookings_source_src_28000.ds_partitioned, isoweek) AS ds_partitioned__week + , DATETIME_TRUNC(bookings_source_src_28000.ds_partitioned, month) AS ds_partitioned__month + , DATETIME_TRUNC(bookings_source_src_28000.ds_partitioned, quarter) AS ds_partitioned__quarter + , DATETIME_TRUNC(bookings_source_src_28000.ds_partitioned, year) AS ds_partitioned__year , EXTRACT(year FROM bookings_source_src_28000.ds_partitioned) AS ds_partitioned__extract_year , EXTRACT(quarter FROM bookings_source_src_28000.ds_partitioned) AS ds_partitioned__extract_quarter , EXTRACT(month FROM bookings_source_src_28000.ds_partitioned) AS ds_partitioned__extract_month , EXTRACT(day FROM bookings_source_src_28000.ds_partitioned) AS ds_partitioned__extract_day , IF(EXTRACT(dayofweek FROM bookings_source_src_28000.ds_partitioned) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_28000.ds_partitioned) - 1) AS ds_partitioned__extract_dow , EXTRACT(dayofyear FROM bookings_source_src_28000.ds_partitioned) AS ds_partitioned__extract_doy - , DATE_TRUNC(bookings_source_src_28000.paid_at, day) AS paid_at__day - , DATE_TRUNC(bookings_source_src_28000.paid_at, isoweek) AS paid_at__week - , DATE_TRUNC(bookings_source_src_28000.paid_at, month) AS paid_at__month - , DATE_TRUNC(bookings_source_src_28000.paid_at, quarter) AS paid_at__quarter - , DATE_TRUNC(bookings_source_src_28000.paid_at, year) AS paid_at__year + , DATETIME_TRUNC(bookings_source_src_28000.paid_at, day) AS paid_at__day + , DATETIME_TRUNC(bookings_source_src_28000.paid_at, isoweek) AS paid_at__week + , DATETIME_TRUNC(bookings_source_src_28000.paid_at, month) AS paid_at__month + , DATETIME_TRUNC(bookings_source_src_28000.paid_at, quarter) AS paid_at__quarter + , DATETIME_TRUNC(bookings_source_src_28000.paid_at, year) AS paid_at__year , EXTRACT(year FROM bookings_source_src_28000.paid_at) AS paid_at__extract_year , EXTRACT(quarter FROM bookings_source_src_28000.paid_at) AS paid_at__extract_quarter , EXTRACT(month FROM bookings_source_src_28000.paid_at) AS paid_at__extract_month @@ -63,33 +63,33 @@ FROM ( , IF(EXTRACT(dayofweek FROM bookings_source_src_28000.paid_at) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_28000.paid_at) - 1) AS paid_at__extract_dow , EXTRACT(dayofyear FROM bookings_source_src_28000.paid_at) AS paid_at__extract_doy , bookings_source_src_28000.is_instant AS booking__is_instant - , DATE_TRUNC(bookings_source_src_28000.ds, day) AS booking__ds__day - , DATE_TRUNC(bookings_source_src_28000.ds, isoweek) AS booking__ds__week - , DATE_TRUNC(bookings_source_src_28000.ds, month) AS booking__ds__month - , DATE_TRUNC(bookings_source_src_28000.ds, quarter) AS booking__ds__quarter - , DATE_TRUNC(bookings_source_src_28000.ds, year) AS booking__ds__year + , DATETIME_TRUNC(bookings_source_src_28000.ds, day) AS booking__ds__day + , DATETIME_TRUNC(bookings_source_src_28000.ds, isoweek) AS booking__ds__week + , DATETIME_TRUNC(bookings_source_src_28000.ds, month) AS booking__ds__month + , DATETIME_TRUNC(bookings_source_src_28000.ds, quarter) AS booking__ds__quarter + , DATETIME_TRUNC(bookings_source_src_28000.ds, year) AS booking__ds__year , EXTRACT(year FROM bookings_source_src_28000.ds) AS booking__ds__extract_year , EXTRACT(quarter FROM bookings_source_src_28000.ds) AS booking__ds__extract_quarter , EXTRACT(month FROM bookings_source_src_28000.ds) AS booking__ds__extract_month , EXTRACT(day FROM bookings_source_src_28000.ds) AS booking__ds__extract_day , IF(EXTRACT(dayofweek FROM bookings_source_src_28000.ds) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_28000.ds) - 1) AS booking__ds__extract_dow , EXTRACT(dayofyear FROM bookings_source_src_28000.ds) AS booking__ds__extract_doy - , DATE_TRUNC(bookings_source_src_28000.ds_partitioned, day) AS booking__ds_partitioned__day - , DATE_TRUNC(bookings_source_src_28000.ds_partitioned, isoweek) AS booking__ds_partitioned__week - , DATE_TRUNC(bookings_source_src_28000.ds_partitioned, month) AS booking__ds_partitioned__month - , DATE_TRUNC(bookings_source_src_28000.ds_partitioned, quarter) AS booking__ds_partitioned__quarter - , DATE_TRUNC(bookings_source_src_28000.ds_partitioned, year) AS booking__ds_partitioned__year + , DATETIME_TRUNC(bookings_source_src_28000.ds_partitioned, day) AS booking__ds_partitioned__day + , DATETIME_TRUNC(bookings_source_src_28000.ds_partitioned, isoweek) AS booking__ds_partitioned__week + , DATETIME_TRUNC(bookings_source_src_28000.ds_partitioned, month) AS booking__ds_partitioned__month + , DATETIME_TRUNC(bookings_source_src_28000.ds_partitioned, quarter) AS booking__ds_partitioned__quarter + , DATETIME_TRUNC(bookings_source_src_28000.ds_partitioned, year) AS booking__ds_partitioned__year , EXTRACT(year FROM bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__extract_year , EXTRACT(quarter FROM bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__extract_quarter , EXTRACT(month FROM bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__extract_month , EXTRACT(day FROM bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__extract_day , IF(EXTRACT(dayofweek FROM bookings_source_src_28000.ds_partitioned) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_28000.ds_partitioned) - 1) AS booking__ds_partitioned__extract_dow , EXTRACT(dayofyear FROM bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__extract_doy - , DATE_TRUNC(bookings_source_src_28000.paid_at, day) AS booking__paid_at__day - , DATE_TRUNC(bookings_source_src_28000.paid_at, isoweek) AS booking__paid_at__week - , DATE_TRUNC(bookings_source_src_28000.paid_at, month) AS booking__paid_at__month - , DATE_TRUNC(bookings_source_src_28000.paid_at, quarter) AS booking__paid_at__quarter - , DATE_TRUNC(bookings_source_src_28000.paid_at, year) AS booking__paid_at__year + , DATETIME_TRUNC(bookings_source_src_28000.paid_at, day) AS booking__paid_at__day + , DATETIME_TRUNC(bookings_source_src_28000.paid_at, isoweek) AS booking__paid_at__week + , DATETIME_TRUNC(bookings_source_src_28000.paid_at, month) AS booking__paid_at__month + , DATETIME_TRUNC(bookings_source_src_28000.paid_at, quarter) AS booking__paid_at__quarter + , DATETIME_TRUNC(bookings_source_src_28000.paid_at, year) AS booking__paid_at__year , EXTRACT(year FROM bookings_source_src_28000.paid_at) AS booking__paid_at__extract_year , EXTRACT(quarter FROM bookings_source_src_28000.paid_at) AS booking__paid_at__extract_quarter , EXTRACT(month FROM bookings_source_src_28000.paid_at) AS booking__paid_at__extract_month diff --git a/tests_metricflow/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/BigQuery/test_multi_join_node__plan0.sql b/tests_metricflow/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/BigQuery/test_multi_join_node__plan0.sql index a184642565..e6aedd6c08 100644 --- a/tests_metricflow/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/BigQuery/test_multi_join_node__plan0.sql +++ b/tests_metricflow/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/BigQuery/test_multi_join_node__plan0.sql @@ -27,33 +27,33 @@ FROM ( , bookings_source_src_28000.booking_value AS approximate_continuous_booking_value_p99 , bookings_source_src_28000.booking_value AS approximate_discrete_booking_value_p99 , bookings_source_src_28000.is_instant - , DATE_TRUNC(bookings_source_src_28000.ds, day) AS ds__day - , DATE_TRUNC(bookings_source_src_28000.ds, isoweek) AS ds__week - , DATE_TRUNC(bookings_source_src_28000.ds, month) AS ds__month - , DATE_TRUNC(bookings_source_src_28000.ds, quarter) AS ds__quarter - , DATE_TRUNC(bookings_source_src_28000.ds, year) AS ds__year + , DATETIME_TRUNC(bookings_source_src_28000.ds, day) AS ds__day + , DATETIME_TRUNC(bookings_source_src_28000.ds, isoweek) AS ds__week + , DATETIME_TRUNC(bookings_source_src_28000.ds, month) AS ds__month + , DATETIME_TRUNC(bookings_source_src_28000.ds, quarter) AS ds__quarter + , DATETIME_TRUNC(bookings_source_src_28000.ds, year) AS ds__year , EXTRACT(year FROM bookings_source_src_28000.ds) AS ds__extract_year , EXTRACT(quarter FROM bookings_source_src_28000.ds) AS ds__extract_quarter , EXTRACT(month FROM bookings_source_src_28000.ds) AS ds__extract_month , EXTRACT(day FROM bookings_source_src_28000.ds) AS ds__extract_day , IF(EXTRACT(dayofweek FROM bookings_source_src_28000.ds) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_28000.ds) - 1) AS ds__extract_dow , EXTRACT(dayofyear FROM bookings_source_src_28000.ds) AS ds__extract_doy - , DATE_TRUNC(bookings_source_src_28000.ds_partitioned, day) AS ds_partitioned__day - , DATE_TRUNC(bookings_source_src_28000.ds_partitioned, isoweek) AS ds_partitioned__week - , DATE_TRUNC(bookings_source_src_28000.ds_partitioned, month) AS ds_partitioned__month - , DATE_TRUNC(bookings_source_src_28000.ds_partitioned, quarter) AS ds_partitioned__quarter - , DATE_TRUNC(bookings_source_src_28000.ds_partitioned, year) AS ds_partitioned__year + , DATETIME_TRUNC(bookings_source_src_28000.ds_partitioned, day) AS ds_partitioned__day + , DATETIME_TRUNC(bookings_source_src_28000.ds_partitioned, isoweek) AS ds_partitioned__week + , DATETIME_TRUNC(bookings_source_src_28000.ds_partitioned, month) AS ds_partitioned__month + , DATETIME_TRUNC(bookings_source_src_28000.ds_partitioned, quarter) AS ds_partitioned__quarter + , DATETIME_TRUNC(bookings_source_src_28000.ds_partitioned, year) AS ds_partitioned__year , EXTRACT(year FROM bookings_source_src_28000.ds_partitioned) AS ds_partitioned__extract_year , EXTRACT(quarter FROM bookings_source_src_28000.ds_partitioned) AS ds_partitioned__extract_quarter , EXTRACT(month FROM bookings_source_src_28000.ds_partitioned) AS ds_partitioned__extract_month , EXTRACT(day FROM bookings_source_src_28000.ds_partitioned) AS ds_partitioned__extract_day , IF(EXTRACT(dayofweek FROM bookings_source_src_28000.ds_partitioned) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_28000.ds_partitioned) - 1) AS ds_partitioned__extract_dow , EXTRACT(dayofyear FROM bookings_source_src_28000.ds_partitioned) AS ds_partitioned__extract_doy - , DATE_TRUNC(bookings_source_src_28000.paid_at, day) AS paid_at__day - , DATE_TRUNC(bookings_source_src_28000.paid_at, isoweek) AS paid_at__week - , DATE_TRUNC(bookings_source_src_28000.paid_at, month) AS paid_at__month - , DATE_TRUNC(bookings_source_src_28000.paid_at, quarter) AS paid_at__quarter - , DATE_TRUNC(bookings_source_src_28000.paid_at, year) AS paid_at__year + , DATETIME_TRUNC(bookings_source_src_28000.paid_at, day) AS paid_at__day + , DATETIME_TRUNC(bookings_source_src_28000.paid_at, isoweek) AS paid_at__week + , DATETIME_TRUNC(bookings_source_src_28000.paid_at, month) AS paid_at__month + , DATETIME_TRUNC(bookings_source_src_28000.paid_at, quarter) AS paid_at__quarter + , DATETIME_TRUNC(bookings_source_src_28000.paid_at, year) AS paid_at__year , EXTRACT(year FROM bookings_source_src_28000.paid_at) AS paid_at__extract_year , EXTRACT(quarter FROM bookings_source_src_28000.paid_at) AS paid_at__extract_quarter , EXTRACT(month FROM bookings_source_src_28000.paid_at) AS paid_at__extract_month @@ -61,33 +61,33 @@ FROM ( , IF(EXTRACT(dayofweek FROM bookings_source_src_28000.paid_at) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_28000.paid_at) - 1) AS paid_at__extract_dow , EXTRACT(dayofyear FROM bookings_source_src_28000.paid_at) AS paid_at__extract_doy , bookings_source_src_28000.is_instant AS booking__is_instant - , DATE_TRUNC(bookings_source_src_28000.ds, day) AS booking__ds__day - , DATE_TRUNC(bookings_source_src_28000.ds, isoweek) AS booking__ds__week - , DATE_TRUNC(bookings_source_src_28000.ds, month) AS booking__ds__month - , DATE_TRUNC(bookings_source_src_28000.ds, quarter) AS booking__ds__quarter - , DATE_TRUNC(bookings_source_src_28000.ds, year) AS booking__ds__year + , DATETIME_TRUNC(bookings_source_src_28000.ds, day) AS booking__ds__day + , DATETIME_TRUNC(bookings_source_src_28000.ds, isoweek) AS booking__ds__week + , DATETIME_TRUNC(bookings_source_src_28000.ds, month) AS booking__ds__month + , DATETIME_TRUNC(bookings_source_src_28000.ds, quarter) AS booking__ds__quarter + , DATETIME_TRUNC(bookings_source_src_28000.ds, year) AS booking__ds__year , EXTRACT(year FROM bookings_source_src_28000.ds) AS booking__ds__extract_year , EXTRACT(quarter FROM bookings_source_src_28000.ds) AS booking__ds__extract_quarter , EXTRACT(month FROM bookings_source_src_28000.ds) AS booking__ds__extract_month , EXTRACT(day FROM bookings_source_src_28000.ds) AS booking__ds__extract_day , IF(EXTRACT(dayofweek FROM bookings_source_src_28000.ds) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_28000.ds) - 1) AS booking__ds__extract_dow , EXTRACT(dayofyear FROM bookings_source_src_28000.ds) AS booking__ds__extract_doy - , DATE_TRUNC(bookings_source_src_28000.ds_partitioned, day) AS booking__ds_partitioned__day - , DATE_TRUNC(bookings_source_src_28000.ds_partitioned, isoweek) AS booking__ds_partitioned__week - , DATE_TRUNC(bookings_source_src_28000.ds_partitioned, month) AS booking__ds_partitioned__month - , DATE_TRUNC(bookings_source_src_28000.ds_partitioned, quarter) AS booking__ds_partitioned__quarter - , DATE_TRUNC(bookings_source_src_28000.ds_partitioned, year) AS booking__ds_partitioned__year + , DATETIME_TRUNC(bookings_source_src_28000.ds_partitioned, day) AS booking__ds_partitioned__day + , DATETIME_TRUNC(bookings_source_src_28000.ds_partitioned, isoweek) AS booking__ds_partitioned__week + , DATETIME_TRUNC(bookings_source_src_28000.ds_partitioned, month) AS booking__ds_partitioned__month + , DATETIME_TRUNC(bookings_source_src_28000.ds_partitioned, quarter) AS booking__ds_partitioned__quarter + , DATETIME_TRUNC(bookings_source_src_28000.ds_partitioned, year) AS booking__ds_partitioned__year , EXTRACT(year FROM bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__extract_year , EXTRACT(quarter FROM bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__extract_quarter , EXTRACT(month FROM bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__extract_month , EXTRACT(day FROM bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__extract_day , IF(EXTRACT(dayofweek FROM bookings_source_src_28000.ds_partitioned) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_28000.ds_partitioned) - 1) AS booking__ds_partitioned__extract_dow , EXTRACT(dayofyear FROM bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__extract_doy - , DATE_TRUNC(bookings_source_src_28000.paid_at, day) AS booking__paid_at__day - , DATE_TRUNC(bookings_source_src_28000.paid_at, isoweek) AS booking__paid_at__week - , DATE_TRUNC(bookings_source_src_28000.paid_at, month) AS booking__paid_at__month - , DATE_TRUNC(bookings_source_src_28000.paid_at, quarter) AS booking__paid_at__quarter - , DATE_TRUNC(bookings_source_src_28000.paid_at, year) AS booking__paid_at__year + , DATETIME_TRUNC(bookings_source_src_28000.paid_at, day) AS booking__paid_at__day + , DATETIME_TRUNC(bookings_source_src_28000.paid_at, isoweek) AS booking__paid_at__week + , DATETIME_TRUNC(bookings_source_src_28000.paid_at, month) AS booking__paid_at__month + , DATETIME_TRUNC(bookings_source_src_28000.paid_at, quarter) AS booking__paid_at__quarter + , DATETIME_TRUNC(bookings_source_src_28000.paid_at, year) AS booking__paid_at__year , EXTRACT(year FROM bookings_source_src_28000.paid_at) AS booking__paid_at__extract_year , EXTRACT(quarter FROM bookings_source_src_28000.paid_at) AS booking__paid_at__extract_quarter , EXTRACT(month FROM bookings_source_src_28000.paid_at) AS booking__paid_at__extract_month @@ -114,22 +114,22 @@ LEFT OUTER JOIN ( 1 AS listings , listings_latest_src_28000.capacity AS largest_listing , listings_latest_src_28000.capacity AS smallest_listing - , DATE_TRUNC(listings_latest_src_28000.created_at, day) AS ds__day - , DATE_TRUNC(listings_latest_src_28000.created_at, isoweek) AS ds__week - , DATE_TRUNC(listings_latest_src_28000.created_at, month) AS ds__month - , DATE_TRUNC(listings_latest_src_28000.created_at, quarter) AS ds__quarter - , DATE_TRUNC(listings_latest_src_28000.created_at, year) AS ds__year + , DATETIME_TRUNC(listings_latest_src_28000.created_at, day) AS ds__day + , DATETIME_TRUNC(listings_latest_src_28000.created_at, isoweek) AS ds__week + , DATETIME_TRUNC(listings_latest_src_28000.created_at, month) AS ds__month + , DATETIME_TRUNC(listings_latest_src_28000.created_at, quarter) AS ds__quarter + , DATETIME_TRUNC(listings_latest_src_28000.created_at, year) AS ds__year , EXTRACT(year FROM listings_latest_src_28000.created_at) AS ds__extract_year , EXTRACT(quarter FROM listings_latest_src_28000.created_at) AS ds__extract_quarter , EXTRACT(month FROM listings_latest_src_28000.created_at) AS ds__extract_month , EXTRACT(day FROM listings_latest_src_28000.created_at) AS ds__extract_day , IF(EXTRACT(dayofweek FROM listings_latest_src_28000.created_at) = 1, 7, EXTRACT(dayofweek FROM listings_latest_src_28000.created_at) - 1) AS ds__extract_dow , EXTRACT(dayofyear FROM listings_latest_src_28000.created_at) AS ds__extract_doy - , DATE_TRUNC(listings_latest_src_28000.created_at, day) AS created_at__day - , DATE_TRUNC(listings_latest_src_28000.created_at, isoweek) AS created_at__week - , DATE_TRUNC(listings_latest_src_28000.created_at, month) AS created_at__month - , DATE_TRUNC(listings_latest_src_28000.created_at, quarter) AS created_at__quarter - , DATE_TRUNC(listings_latest_src_28000.created_at, year) AS created_at__year + , DATETIME_TRUNC(listings_latest_src_28000.created_at, day) AS created_at__day + , DATETIME_TRUNC(listings_latest_src_28000.created_at, isoweek) AS created_at__week + , DATETIME_TRUNC(listings_latest_src_28000.created_at, month) AS created_at__month + , DATETIME_TRUNC(listings_latest_src_28000.created_at, quarter) AS created_at__quarter + , DATETIME_TRUNC(listings_latest_src_28000.created_at, year) AS created_at__year , EXTRACT(year FROM listings_latest_src_28000.created_at) AS created_at__extract_year , EXTRACT(quarter FROM listings_latest_src_28000.created_at) AS created_at__extract_quarter , EXTRACT(month FROM listings_latest_src_28000.created_at) AS created_at__extract_month @@ -139,22 +139,22 @@ LEFT OUTER JOIN ( , listings_latest_src_28000.country AS country_latest , listings_latest_src_28000.is_lux AS is_lux_latest , listings_latest_src_28000.capacity AS capacity_latest - , DATE_TRUNC(listings_latest_src_28000.created_at, day) AS listing__ds__day - , DATE_TRUNC(listings_latest_src_28000.created_at, isoweek) AS listing__ds__week - , DATE_TRUNC(listings_latest_src_28000.created_at, month) AS listing__ds__month - , DATE_TRUNC(listings_latest_src_28000.created_at, quarter) AS listing__ds__quarter - , DATE_TRUNC(listings_latest_src_28000.created_at, year) AS listing__ds__year + , DATETIME_TRUNC(listings_latest_src_28000.created_at, day) AS listing__ds__day + , DATETIME_TRUNC(listings_latest_src_28000.created_at, isoweek) AS listing__ds__week + , DATETIME_TRUNC(listings_latest_src_28000.created_at, month) AS listing__ds__month + , DATETIME_TRUNC(listings_latest_src_28000.created_at, quarter) AS listing__ds__quarter + , DATETIME_TRUNC(listings_latest_src_28000.created_at, year) AS listing__ds__year , EXTRACT(year FROM listings_latest_src_28000.created_at) AS listing__ds__extract_year , EXTRACT(quarter FROM listings_latest_src_28000.created_at) AS listing__ds__extract_quarter , EXTRACT(month FROM listings_latest_src_28000.created_at) AS listing__ds__extract_month , EXTRACT(day FROM listings_latest_src_28000.created_at) AS listing__ds__extract_day , IF(EXTRACT(dayofweek FROM listings_latest_src_28000.created_at) = 1, 7, EXTRACT(dayofweek FROM listings_latest_src_28000.created_at) - 1) AS listing__ds__extract_dow , EXTRACT(dayofyear FROM listings_latest_src_28000.created_at) AS listing__ds__extract_doy - , DATE_TRUNC(listings_latest_src_28000.created_at, day) AS listing__created_at__day - , DATE_TRUNC(listings_latest_src_28000.created_at, isoweek) AS listing__created_at__week - , DATE_TRUNC(listings_latest_src_28000.created_at, month) AS listing__created_at__month - , DATE_TRUNC(listings_latest_src_28000.created_at, quarter) AS listing__created_at__quarter - , DATE_TRUNC(listings_latest_src_28000.created_at, year) AS listing__created_at__year + , DATETIME_TRUNC(listings_latest_src_28000.created_at, day) AS listing__created_at__day + , DATETIME_TRUNC(listings_latest_src_28000.created_at, isoweek) AS listing__created_at__week + , DATETIME_TRUNC(listings_latest_src_28000.created_at, month) AS listing__created_at__month + , DATETIME_TRUNC(listings_latest_src_28000.created_at, quarter) AS listing__created_at__quarter + , DATETIME_TRUNC(listings_latest_src_28000.created_at, year) AS listing__created_at__year , EXTRACT(year FROM listings_latest_src_28000.created_at) AS listing__created_at__extract_year , EXTRACT(quarter FROM listings_latest_src_28000.created_at) AS listing__created_at__extract_quarter , EXTRACT(month FROM listings_latest_src_28000.created_at) AS listing__created_at__extract_month @@ -183,22 +183,22 @@ LEFT OUTER JOIN ( 1 AS listings , listings_latest_src_28000.capacity AS largest_listing , listings_latest_src_28000.capacity AS smallest_listing - , DATE_TRUNC(listings_latest_src_28000.created_at, day) AS ds__day - , DATE_TRUNC(listings_latest_src_28000.created_at, isoweek) AS ds__week - , DATE_TRUNC(listings_latest_src_28000.created_at, month) AS ds__month - , DATE_TRUNC(listings_latest_src_28000.created_at, quarter) AS ds__quarter - , DATE_TRUNC(listings_latest_src_28000.created_at, year) AS ds__year + , DATETIME_TRUNC(listings_latest_src_28000.created_at, day) AS ds__day + , DATETIME_TRUNC(listings_latest_src_28000.created_at, isoweek) AS ds__week + , DATETIME_TRUNC(listings_latest_src_28000.created_at, month) AS ds__month + , DATETIME_TRUNC(listings_latest_src_28000.created_at, quarter) AS ds__quarter + , DATETIME_TRUNC(listings_latest_src_28000.created_at, year) AS ds__year , EXTRACT(year FROM listings_latest_src_28000.created_at) AS ds__extract_year , EXTRACT(quarter FROM listings_latest_src_28000.created_at) AS ds__extract_quarter , EXTRACT(month FROM listings_latest_src_28000.created_at) AS ds__extract_month , EXTRACT(day FROM listings_latest_src_28000.created_at) AS ds__extract_day , IF(EXTRACT(dayofweek FROM listings_latest_src_28000.created_at) = 1, 7, EXTRACT(dayofweek FROM listings_latest_src_28000.created_at) - 1) AS ds__extract_dow , EXTRACT(dayofyear FROM listings_latest_src_28000.created_at) AS ds__extract_doy - , DATE_TRUNC(listings_latest_src_28000.created_at, day) AS created_at__day - , DATE_TRUNC(listings_latest_src_28000.created_at, isoweek) AS created_at__week - , DATE_TRUNC(listings_latest_src_28000.created_at, month) AS created_at__month - , DATE_TRUNC(listings_latest_src_28000.created_at, quarter) AS created_at__quarter - , DATE_TRUNC(listings_latest_src_28000.created_at, year) AS created_at__year + , DATETIME_TRUNC(listings_latest_src_28000.created_at, day) AS created_at__day + , DATETIME_TRUNC(listings_latest_src_28000.created_at, isoweek) AS created_at__week + , DATETIME_TRUNC(listings_latest_src_28000.created_at, month) AS created_at__month + , DATETIME_TRUNC(listings_latest_src_28000.created_at, quarter) AS created_at__quarter + , DATETIME_TRUNC(listings_latest_src_28000.created_at, year) AS created_at__year , EXTRACT(year FROM listings_latest_src_28000.created_at) AS created_at__extract_year , EXTRACT(quarter FROM listings_latest_src_28000.created_at) AS created_at__extract_quarter , EXTRACT(month FROM listings_latest_src_28000.created_at) AS created_at__extract_month @@ -208,22 +208,22 @@ LEFT OUTER JOIN ( , listings_latest_src_28000.country AS country_latest , listings_latest_src_28000.is_lux AS is_lux_latest , listings_latest_src_28000.capacity AS capacity_latest - , DATE_TRUNC(listings_latest_src_28000.created_at, day) AS listing__ds__day - , DATE_TRUNC(listings_latest_src_28000.created_at, isoweek) AS listing__ds__week - , DATE_TRUNC(listings_latest_src_28000.created_at, month) AS listing__ds__month - , DATE_TRUNC(listings_latest_src_28000.created_at, quarter) AS listing__ds__quarter - , DATE_TRUNC(listings_latest_src_28000.created_at, year) AS listing__ds__year + , DATETIME_TRUNC(listings_latest_src_28000.created_at, day) AS listing__ds__day + , DATETIME_TRUNC(listings_latest_src_28000.created_at, isoweek) AS listing__ds__week + , DATETIME_TRUNC(listings_latest_src_28000.created_at, month) AS listing__ds__month + , DATETIME_TRUNC(listings_latest_src_28000.created_at, quarter) AS listing__ds__quarter + , DATETIME_TRUNC(listings_latest_src_28000.created_at, year) AS listing__ds__year , EXTRACT(year FROM listings_latest_src_28000.created_at) AS listing__ds__extract_year , EXTRACT(quarter FROM listings_latest_src_28000.created_at) AS listing__ds__extract_quarter , EXTRACT(month FROM listings_latest_src_28000.created_at) AS listing__ds__extract_month , EXTRACT(day FROM listings_latest_src_28000.created_at) AS listing__ds__extract_day , IF(EXTRACT(dayofweek FROM listings_latest_src_28000.created_at) = 1, 7, EXTRACT(dayofweek FROM listings_latest_src_28000.created_at) - 1) AS listing__ds__extract_dow , EXTRACT(dayofyear FROM listings_latest_src_28000.created_at) AS listing__ds__extract_doy - , DATE_TRUNC(listings_latest_src_28000.created_at, day) AS listing__created_at__day - , DATE_TRUNC(listings_latest_src_28000.created_at, isoweek) AS listing__created_at__week - , DATE_TRUNC(listings_latest_src_28000.created_at, month) AS listing__created_at__month - , DATE_TRUNC(listings_latest_src_28000.created_at, quarter) AS listing__created_at__quarter - , DATE_TRUNC(listings_latest_src_28000.created_at, year) AS listing__created_at__year + , DATETIME_TRUNC(listings_latest_src_28000.created_at, day) AS listing__created_at__day + , DATETIME_TRUNC(listings_latest_src_28000.created_at, isoweek) AS listing__created_at__week + , DATETIME_TRUNC(listings_latest_src_28000.created_at, month) AS listing__created_at__month + , DATETIME_TRUNC(listings_latest_src_28000.created_at, quarter) AS listing__created_at__quarter + , DATETIME_TRUNC(listings_latest_src_28000.created_at, year) AS listing__created_at__year , EXTRACT(year FROM listings_latest_src_28000.created_at) AS listing__created_at__extract_year , EXTRACT(quarter FROM listings_latest_src_28000.created_at) AS listing__created_at__extract_quarter , EXTRACT(month FROM listings_latest_src_28000.created_at) AS listing__created_at__extract_month diff --git a/tests_metricflow/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/BigQuery/test_order_by_node__plan0.sql b/tests_metricflow/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/BigQuery/test_order_by_node__plan0.sql index 33b3ebed38..de3e01e42a 100644 --- a/tests_metricflow/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/BigQuery/test_order_by_node__plan0.sql +++ b/tests_metricflow/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/BigQuery/test_order_by_node__plan0.sql @@ -39,33 +39,33 @@ FROM ( , bookings_source_src_28000.booking_value AS approximate_continuous_booking_value_p99 , bookings_source_src_28000.booking_value AS approximate_discrete_booking_value_p99 , bookings_source_src_28000.is_instant - , DATE_TRUNC(bookings_source_src_28000.ds, day) AS ds__day - , DATE_TRUNC(bookings_source_src_28000.ds, isoweek) AS ds__week - , DATE_TRUNC(bookings_source_src_28000.ds, month) AS ds__month - , DATE_TRUNC(bookings_source_src_28000.ds, quarter) AS ds__quarter - , DATE_TRUNC(bookings_source_src_28000.ds, year) AS ds__year + , DATETIME_TRUNC(bookings_source_src_28000.ds, day) AS ds__day + , DATETIME_TRUNC(bookings_source_src_28000.ds, isoweek) AS ds__week + , DATETIME_TRUNC(bookings_source_src_28000.ds, month) AS ds__month + , DATETIME_TRUNC(bookings_source_src_28000.ds, quarter) AS ds__quarter + , DATETIME_TRUNC(bookings_source_src_28000.ds, year) AS ds__year , EXTRACT(year FROM bookings_source_src_28000.ds) AS ds__extract_year , EXTRACT(quarter FROM bookings_source_src_28000.ds) AS ds__extract_quarter , EXTRACT(month FROM bookings_source_src_28000.ds) AS ds__extract_month , EXTRACT(day FROM bookings_source_src_28000.ds) AS ds__extract_day , IF(EXTRACT(dayofweek FROM bookings_source_src_28000.ds) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_28000.ds) - 1) AS ds__extract_dow , EXTRACT(dayofyear FROM bookings_source_src_28000.ds) AS ds__extract_doy - , DATE_TRUNC(bookings_source_src_28000.ds_partitioned, day) AS ds_partitioned__day - , DATE_TRUNC(bookings_source_src_28000.ds_partitioned, isoweek) AS ds_partitioned__week - , DATE_TRUNC(bookings_source_src_28000.ds_partitioned, month) AS ds_partitioned__month - , DATE_TRUNC(bookings_source_src_28000.ds_partitioned, quarter) AS ds_partitioned__quarter - , DATE_TRUNC(bookings_source_src_28000.ds_partitioned, year) AS ds_partitioned__year + , DATETIME_TRUNC(bookings_source_src_28000.ds_partitioned, day) AS ds_partitioned__day + , DATETIME_TRUNC(bookings_source_src_28000.ds_partitioned, isoweek) AS ds_partitioned__week + , DATETIME_TRUNC(bookings_source_src_28000.ds_partitioned, month) AS ds_partitioned__month + , DATETIME_TRUNC(bookings_source_src_28000.ds_partitioned, quarter) AS ds_partitioned__quarter + , DATETIME_TRUNC(bookings_source_src_28000.ds_partitioned, year) AS ds_partitioned__year , EXTRACT(year FROM bookings_source_src_28000.ds_partitioned) AS ds_partitioned__extract_year , EXTRACT(quarter FROM bookings_source_src_28000.ds_partitioned) AS ds_partitioned__extract_quarter , EXTRACT(month FROM bookings_source_src_28000.ds_partitioned) AS ds_partitioned__extract_month , EXTRACT(day FROM bookings_source_src_28000.ds_partitioned) AS ds_partitioned__extract_day , IF(EXTRACT(dayofweek FROM bookings_source_src_28000.ds_partitioned) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_28000.ds_partitioned) - 1) AS ds_partitioned__extract_dow , EXTRACT(dayofyear FROM bookings_source_src_28000.ds_partitioned) AS ds_partitioned__extract_doy - , DATE_TRUNC(bookings_source_src_28000.paid_at, day) AS paid_at__day - , DATE_TRUNC(bookings_source_src_28000.paid_at, isoweek) AS paid_at__week - , DATE_TRUNC(bookings_source_src_28000.paid_at, month) AS paid_at__month - , DATE_TRUNC(bookings_source_src_28000.paid_at, quarter) AS paid_at__quarter - , DATE_TRUNC(bookings_source_src_28000.paid_at, year) AS paid_at__year + , DATETIME_TRUNC(bookings_source_src_28000.paid_at, day) AS paid_at__day + , DATETIME_TRUNC(bookings_source_src_28000.paid_at, isoweek) AS paid_at__week + , DATETIME_TRUNC(bookings_source_src_28000.paid_at, month) AS paid_at__month + , DATETIME_TRUNC(bookings_source_src_28000.paid_at, quarter) AS paid_at__quarter + , DATETIME_TRUNC(bookings_source_src_28000.paid_at, year) AS paid_at__year , EXTRACT(year FROM bookings_source_src_28000.paid_at) AS paid_at__extract_year , EXTRACT(quarter FROM bookings_source_src_28000.paid_at) AS paid_at__extract_quarter , EXTRACT(month FROM bookings_source_src_28000.paid_at) AS paid_at__extract_month @@ -73,33 +73,33 @@ FROM ( , IF(EXTRACT(dayofweek FROM bookings_source_src_28000.paid_at) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_28000.paid_at) - 1) AS paid_at__extract_dow , EXTRACT(dayofyear FROM bookings_source_src_28000.paid_at) AS paid_at__extract_doy , bookings_source_src_28000.is_instant AS booking__is_instant - , DATE_TRUNC(bookings_source_src_28000.ds, day) AS booking__ds__day - , DATE_TRUNC(bookings_source_src_28000.ds, isoweek) AS booking__ds__week - , DATE_TRUNC(bookings_source_src_28000.ds, month) AS booking__ds__month - , DATE_TRUNC(bookings_source_src_28000.ds, quarter) AS booking__ds__quarter - , DATE_TRUNC(bookings_source_src_28000.ds, year) AS booking__ds__year + , DATETIME_TRUNC(bookings_source_src_28000.ds, day) AS booking__ds__day + , DATETIME_TRUNC(bookings_source_src_28000.ds, isoweek) AS booking__ds__week + , DATETIME_TRUNC(bookings_source_src_28000.ds, month) AS booking__ds__month + , DATETIME_TRUNC(bookings_source_src_28000.ds, quarter) AS booking__ds__quarter + , DATETIME_TRUNC(bookings_source_src_28000.ds, year) AS booking__ds__year , EXTRACT(year FROM bookings_source_src_28000.ds) AS booking__ds__extract_year , EXTRACT(quarter FROM bookings_source_src_28000.ds) AS booking__ds__extract_quarter , EXTRACT(month FROM bookings_source_src_28000.ds) AS booking__ds__extract_month , EXTRACT(day FROM bookings_source_src_28000.ds) AS booking__ds__extract_day , IF(EXTRACT(dayofweek FROM bookings_source_src_28000.ds) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_28000.ds) - 1) AS booking__ds__extract_dow , EXTRACT(dayofyear FROM bookings_source_src_28000.ds) AS booking__ds__extract_doy - , DATE_TRUNC(bookings_source_src_28000.ds_partitioned, day) AS booking__ds_partitioned__day - , DATE_TRUNC(bookings_source_src_28000.ds_partitioned, isoweek) AS booking__ds_partitioned__week - , DATE_TRUNC(bookings_source_src_28000.ds_partitioned, month) AS booking__ds_partitioned__month - , DATE_TRUNC(bookings_source_src_28000.ds_partitioned, quarter) AS booking__ds_partitioned__quarter - , DATE_TRUNC(bookings_source_src_28000.ds_partitioned, year) AS booking__ds_partitioned__year + , DATETIME_TRUNC(bookings_source_src_28000.ds_partitioned, day) AS booking__ds_partitioned__day + , DATETIME_TRUNC(bookings_source_src_28000.ds_partitioned, isoweek) AS booking__ds_partitioned__week + , DATETIME_TRUNC(bookings_source_src_28000.ds_partitioned, month) AS booking__ds_partitioned__month + , DATETIME_TRUNC(bookings_source_src_28000.ds_partitioned, quarter) AS booking__ds_partitioned__quarter + , DATETIME_TRUNC(bookings_source_src_28000.ds_partitioned, year) AS booking__ds_partitioned__year , EXTRACT(year FROM bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__extract_year , EXTRACT(quarter FROM bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__extract_quarter , EXTRACT(month FROM bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__extract_month , EXTRACT(day FROM bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__extract_day , IF(EXTRACT(dayofweek FROM bookings_source_src_28000.ds_partitioned) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_28000.ds_partitioned) - 1) AS booking__ds_partitioned__extract_dow , EXTRACT(dayofyear FROM bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__extract_doy - , DATE_TRUNC(bookings_source_src_28000.paid_at, day) AS booking__paid_at__day - , DATE_TRUNC(bookings_source_src_28000.paid_at, isoweek) AS booking__paid_at__week - , DATE_TRUNC(bookings_source_src_28000.paid_at, month) AS booking__paid_at__month - , DATE_TRUNC(bookings_source_src_28000.paid_at, quarter) AS booking__paid_at__quarter - , DATE_TRUNC(bookings_source_src_28000.paid_at, year) AS booking__paid_at__year + , DATETIME_TRUNC(bookings_source_src_28000.paid_at, day) AS booking__paid_at__day + , DATETIME_TRUNC(bookings_source_src_28000.paid_at, isoweek) AS booking__paid_at__week + , DATETIME_TRUNC(bookings_source_src_28000.paid_at, month) AS booking__paid_at__month + , DATETIME_TRUNC(bookings_source_src_28000.paid_at, quarter) AS booking__paid_at__quarter + , DATETIME_TRUNC(bookings_source_src_28000.paid_at, year) AS booking__paid_at__year , EXTRACT(year FROM bookings_source_src_28000.paid_at) AS booking__paid_at__extract_year , EXTRACT(quarter FROM bookings_source_src_28000.paid_at) AS booking__paid_at__extract_quarter , EXTRACT(month FROM bookings_source_src_28000.paid_at) AS booking__paid_at__extract_month diff --git a/tests_metricflow/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/BigQuery/test_order_by_node__plan0_optimized.sql b/tests_metricflow/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/BigQuery/test_order_by_node__plan0_optimized.sql index e755ce8680..c48515ef47 100644 --- a/tests_metricflow/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/BigQuery/test_order_by_node__plan0_optimized.sql +++ b/tests_metricflow/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/BigQuery/test_order_by_node__plan0_optimized.sql @@ -9,7 +9,7 @@ FROM ( -- Read Elements From Semantic Model 'bookings_source' -- Pass Only Elements: ['bookings', 'is_instant', 'ds__day'] SELECT - DATE_TRUNC(ds, day) AS ds__day + DATETIME_TRUNC(ds, day) AS ds__day , is_instant , 1 AS bookings FROM ***************************.fct_bookings bookings_source_src_28000 diff --git a/tests_metricflow/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/BigQuery/test_semi_additive_join_node__plan0.sql b/tests_metricflow/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/BigQuery/test_semi_additive_join_node__plan0.sql index ccb6e95894..603cac9c69 100644 --- a/tests_metricflow/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/BigQuery/test_semi_additive_join_node__plan0.sql +++ b/tests_metricflow/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/BigQuery/test_semi_additive_join_node__plan0.sql @@ -35,11 +35,11 @@ FROM ( accounts_source_src_28000.account_balance , accounts_source_src_28000.account_balance AS total_account_balance_first_day , accounts_source_src_28000.account_balance AS current_account_balance_by_user - , DATE_TRUNC(accounts_source_src_28000.ds, day) AS ds__day - , DATE_TRUNC(accounts_source_src_28000.ds, isoweek) AS ds__week - , DATE_TRUNC(accounts_source_src_28000.ds, month) AS ds__month - , DATE_TRUNC(accounts_source_src_28000.ds, quarter) AS ds__quarter - , DATE_TRUNC(accounts_source_src_28000.ds, year) AS ds__year + , DATETIME_TRUNC(accounts_source_src_28000.ds, day) AS ds__day + , DATETIME_TRUNC(accounts_source_src_28000.ds, isoweek) AS ds__week + , DATETIME_TRUNC(accounts_source_src_28000.ds, month) AS ds__month + , DATETIME_TRUNC(accounts_source_src_28000.ds, quarter) AS ds__quarter + , DATETIME_TRUNC(accounts_source_src_28000.ds, year) AS ds__year , EXTRACT(year FROM accounts_source_src_28000.ds) AS ds__extract_year , EXTRACT(quarter FROM accounts_source_src_28000.ds) AS ds__extract_quarter , EXTRACT(month FROM accounts_source_src_28000.ds) AS ds__extract_month @@ -47,11 +47,11 @@ FROM ( , IF(EXTRACT(dayofweek FROM accounts_source_src_28000.ds) = 1, 7, EXTRACT(dayofweek FROM accounts_source_src_28000.ds) - 1) AS ds__extract_dow , EXTRACT(dayofyear FROM accounts_source_src_28000.ds) AS ds__extract_doy , accounts_source_src_28000.account_type - , DATE_TRUNC(accounts_source_src_28000.ds, day) AS account__ds__day - , DATE_TRUNC(accounts_source_src_28000.ds, isoweek) AS account__ds__week - , DATE_TRUNC(accounts_source_src_28000.ds, month) AS account__ds__month - , DATE_TRUNC(accounts_source_src_28000.ds, quarter) AS account__ds__quarter - , DATE_TRUNC(accounts_source_src_28000.ds, year) AS account__ds__year + , DATETIME_TRUNC(accounts_source_src_28000.ds, day) AS account__ds__day + , DATETIME_TRUNC(accounts_source_src_28000.ds, isoweek) AS account__ds__week + , DATETIME_TRUNC(accounts_source_src_28000.ds, month) AS account__ds__month + , DATETIME_TRUNC(accounts_source_src_28000.ds, quarter) AS account__ds__quarter + , DATETIME_TRUNC(accounts_source_src_28000.ds, year) AS account__ds__year , EXTRACT(year FROM accounts_source_src_28000.ds) AS account__ds__extract_year , EXTRACT(quarter FROM accounts_source_src_28000.ds) AS account__ds__extract_quarter , EXTRACT(month FROM accounts_source_src_28000.ds) AS account__ds__extract_month @@ -73,11 +73,11 @@ INNER JOIN ( accounts_source_src_28000.account_balance , accounts_source_src_28000.account_balance AS total_account_balance_first_day , accounts_source_src_28000.account_balance AS current_account_balance_by_user - , DATE_TRUNC(accounts_source_src_28000.ds, day) AS ds__day - , DATE_TRUNC(accounts_source_src_28000.ds, isoweek) AS ds__week - , DATE_TRUNC(accounts_source_src_28000.ds, month) AS ds__month - , DATE_TRUNC(accounts_source_src_28000.ds, quarter) AS ds__quarter - , DATE_TRUNC(accounts_source_src_28000.ds, year) AS ds__year + , DATETIME_TRUNC(accounts_source_src_28000.ds, day) AS ds__day + , DATETIME_TRUNC(accounts_source_src_28000.ds, isoweek) AS ds__week + , DATETIME_TRUNC(accounts_source_src_28000.ds, month) AS ds__month + , DATETIME_TRUNC(accounts_source_src_28000.ds, quarter) AS ds__quarter + , DATETIME_TRUNC(accounts_source_src_28000.ds, year) AS ds__year , EXTRACT(year FROM accounts_source_src_28000.ds) AS ds__extract_year , EXTRACT(quarter FROM accounts_source_src_28000.ds) AS ds__extract_quarter , EXTRACT(month FROM accounts_source_src_28000.ds) AS ds__extract_month @@ -85,11 +85,11 @@ INNER JOIN ( , IF(EXTRACT(dayofweek FROM accounts_source_src_28000.ds) = 1, 7, EXTRACT(dayofweek FROM accounts_source_src_28000.ds) - 1) AS ds__extract_dow , EXTRACT(dayofyear FROM accounts_source_src_28000.ds) AS ds__extract_doy , accounts_source_src_28000.account_type - , DATE_TRUNC(accounts_source_src_28000.ds, day) AS account__ds__day - , DATE_TRUNC(accounts_source_src_28000.ds, isoweek) AS account__ds__week - , DATE_TRUNC(accounts_source_src_28000.ds, month) AS account__ds__month - , DATE_TRUNC(accounts_source_src_28000.ds, quarter) AS account__ds__quarter - , DATE_TRUNC(accounts_source_src_28000.ds, year) AS account__ds__year + , DATETIME_TRUNC(accounts_source_src_28000.ds, day) AS account__ds__day + , DATETIME_TRUNC(accounts_source_src_28000.ds, isoweek) AS account__ds__week + , DATETIME_TRUNC(accounts_source_src_28000.ds, month) AS account__ds__month + , DATETIME_TRUNC(accounts_source_src_28000.ds, quarter) AS account__ds__quarter + , DATETIME_TRUNC(accounts_source_src_28000.ds, year) AS account__ds__year , EXTRACT(year FROM accounts_source_src_28000.ds) AS account__ds__extract_year , EXTRACT(quarter FROM accounts_source_src_28000.ds) AS account__ds__extract_quarter , EXTRACT(month FROM accounts_source_src_28000.ds) AS account__ds__extract_month diff --git a/tests_metricflow/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/BigQuery/test_semi_additive_join_node__plan0_optimized.sql b/tests_metricflow/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/BigQuery/test_semi_additive_join_node__plan0_optimized.sql index daf549a272..090ed3d620 100644 --- a/tests_metricflow/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/BigQuery/test_semi_additive_join_node__plan0_optimized.sql +++ b/tests_metricflow/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/BigQuery/test_semi_additive_join_node__plan0_optimized.sql @@ -35,11 +35,11 @@ FROM ( account_balance , account_balance AS total_account_balance_first_day , account_balance AS current_account_balance_by_user - , DATE_TRUNC(ds, day) AS ds__day - , DATE_TRUNC(ds, isoweek) AS ds__week - , DATE_TRUNC(ds, month) AS ds__month - , DATE_TRUNC(ds, quarter) AS ds__quarter - , DATE_TRUNC(ds, year) AS ds__year + , DATETIME_TRUNC(ds, day) AS ds__day + , DATETIME_TRUNC(ds, isoweek) AS ds__week + , DATETIME_TRUNC(ds, month) AS ds__month + , DATETIME_TRUNC(ds, quarter) AS ds__quarter + , DATETIME_TRUNC(ds, year) AS ds__year , EXTRACT(year FROM ds) AS ds__extract_year , EXTRACT(quarter FROM ds) AS ds__extract_quarter , EXTRACT(month FROM ds) AS ds__extract_month @@ -47,11 +47,11 @@ FROM ( , IF(EXTRACT(dayofweek FROM ds) = 1, 7, EXTRACT(dayofweek FROM ds) - 1) AS ds__extract_dow , EXTRACT(dayofyear FROM ds) AS ds__extract_doy , account_type - , DATE_TRUNC(ds, day) AS account__ds__day - , DATE_TRUNC(ds, isoweek) AS account__ds__week - , DATE_TRUNC(ds, month) AS account__ds__month - , DATE_TRUNC(ds, quarter) AS account__ds__quarter - , DATE_TRUNC(ds, year) AS account__ds__year + , DATETIME_TRUNC(ds, day) AS account__ds__day + , DATETIME_TRUNC(ds, isoweek) AS account__ds__week + , DATETIME_TRUNC(ds, month) AS account__ds__month + , DATETIME_TRUNC(ds, quarter) AS account__ds__quarter + , DATETIME_TRUNC(ds, year) AS account__ds__year , EXTRACT(year FROM ds) AS account__ds__extract_year , EXTRACT(quarter FROM ds) AS account__ds__extract_quarter , EXTRACT(month FROM ds) AS account__ds__extract_month @@ -67,7 +67,7 @@ INNER JOIN ( -- Read Elements From Semantic Model 'accounts_source' -- Filter row on MIN(ds__day) SELECT - MIN(DATE_TRUNC(ds, day)) AS ds__day__complete + MIN(DATETIME_TRUNC(ds, day)) AS ds__day__complete FROM ***************************.fct_accounts accounts_source_src_28000 ) subq_5 ON diff --git a/tests_metricflow/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/BigQuery/test_semi_additive_join_node_with_grouping__plan0.sql b/tests_metricflow/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/BigQuery/test_semi_additive_join_node_with_grouping__plan0.sql index fafd67ef4c..204e39e8d3 100644 --- a/tests_metricflow/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/BigQuery/test_semi_additive_join_node_with_grouping__plan0.sql +++ b/tests_metricflow/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/BigQuery/test_semi_additive_join_node_with_grouping__plan0.sql @@ -35,11 +35,11 @@ FROM ( accounts_source_src_28000.account_balance , accounts_source_src_28000.account_balance AS total_account_balance_first_day , accounts_source_src_28000.account_balance AS current_account_balance_by_user - , DATE_TRUNC(accounts_source_src_28000.ds, day) AS ds__day - , DATE_TRUNC(accounts_source_src_28000.ds, isoweek) AS ds__week - , DATE_TRUNC(accounts_source_src_28000.ds, month) AS ds__month - , DATE_TRUNC(accounts_source_src_28000.ds, quarter) AS ds__quarter - , DATE_TRUNC(accounts_source_src_28000.ds, year) AS ds__year + , DATETIME_TRUNC(accounts_source_src_28000.ds, day) AS ds__day + , DATETIME_TRUNC(accounts_source_src_28000.ds, isoweek) AS ds__week + , DATETIME_TRUNC(accounts_source_src_28000.ds, month) AS ds__month + , DATETIME_TRUNC(accounts_source_src_28000.ds, quarter) AS ds__quarter + , DATETIME_TRUNC(accounts_source_src_28000.ds, year) AS ds__year , EXTRACT(year FROM accounts_source_src_28000.ds) AS ds__extract_year , EXTRACT(quarter FROM accounts_source_src_28000.ds) AS ds__extract_quarter , EXTRACT(month FROM accounts_source_src_28000.ds) AS ds__extract_month @@ -47,11 +47,11 @@ FROM ( , IF(EXTRACT(dayofweek FROM accounts_source_src_28000.ds) = 1, 7, EXTRACT(dayofweek FROM accounts_source_src_28000.ds) - 1) AS ds__extract_dow , EXTRACT(dayofyear FROM accounts_source_src_28000.ds) AS ds__extract_doy , accounts_source_src_28000.account_type - , DATE_TRUNC(accounts_source_src_28000.ds, day) AS account__ds__day - , DATE_TRUNC(accounts_source_src_28000.ds, isoweek) AS account__ds__week - , DATE_TRUNC(accounts_source_src_28000.ds, month) AS account__ds__month - , DATE_TRUNC(accounts_source_src_28000.ds, quarter) AS account__ds__quarter - , DATE_TRUNC(accounts_source_src_28000.ds, year) AS account__ds__year + , DATETIME_TRUNC(accounts_source_src_28000.ds, day) AS account__ds__day + , DATETIME_TRUNC(accounts_source_src_28000.ds, isoweek) AS account__ds__week + , DATETIME_TRUNC(accounts_source_src_28000.ds, month) AS account__ds__month + , DATETIME_TRUNC(accounts_source_src_28000.ds, quarter) AS account__ds__quarter + , DATETIME_TRUNC(accounts_source_src_28000.ds, year) AS account__ds__year , EXTRACT(year FROM accounts_source_src_28000.ds) AS account__ds__extract_year , EXTRACT(quarter FROM accounts_source_src_28000.ds) AS account__ds__extract_quarter , EXTRACT(month FROM accounts_source_src_28000.ds) AS account__ds__extract_month @@ -74,11 +74,11 @@ INNER JOIN ( accounts_source_src_28000.account_balance , accounts_source_src_28000.account_balance AS total_account_balance_first_day , accounts_source_src_28000.account_balance AS current_account_balance_by_user - , DATE_TRUNC(accounts_source_src_28000.ds, day) AS ds__day - , DATE_TRUNC(accounts_source_src_28000.ds, isoweek) AS ds__week - , DATE_TRUNC(accounts_source_src_28000.ds, month) AS ds__month - , DATE_TRUNC(accounts_source_src_28000.ds, quarter) AS ds__quarter - , DATE_TRUNC(accounts_source_src_28000.ds, year) AS ds__year + , DATETIME_TRUNC(accounts_source_src_28000.ds, day) AS ds__day + , DATETIME_TRUNC(accounts_source_src_28000.ds, isoweek) AS ds__week + , DATETIME_TRUNC(accounts_source_src_28000.ds, month) AS ds__month + , DATETIME_TRUNC(accounts_source_src_28000.ds, quarter) AS ds__quarter + , DATETIME_TRUNC(accounts_source_src_28000.ds, year) AS ds__year , EXTRACT(year FROM accounts_source_src_28000.ds) AS ds__extract_year , EXTRACT(quarter FROM accounts_source_src_28000.ds) AS ds__extract_quarter , EXTRACT(month FROM accounts_source_src_28000.ds) AS ds__extract_month @@ -86,11 +86,11 @@ INNER JOIN ( , IF(EXTRACT(dayofweek FROM accounts_source_src_28000.ds) = 1, 7, EXTRACT(dayofweek FROM accounts_source_src_28000.ds) - 1) AS ds__extract_dow , EXTRACT(dayofyear FROM accounts_source_src_28000.ds) AS ds__extract_doy , accounts_source_src_28000.account_type - , DATE_TRUNC(accounts_source_src_28000.ds, day) AS account__ds__day - , DATE_TRUNC(accounts_source_src_28000.ds, isoweek) AS account__ds__week - , DATE_TRUNC(accounts_source_src_28000.ds, month) AS account__ds__month - , DATE_TRUNC(accounts_source_src_28000.ds, quarter) AS account__ds__quarter - , DATE_TRUNC(accounts_source_src_28000.ds, year) AS account__ds__year + , DATETIME_TRUNC(accounts_source_src_28000.ds, day) AS account__ds__day + , DATETIME_TRUNC(accounts_source_src_28000.ds, isoweek) AS account__ds__week + , DATETIME_TRUNC(accounts_source_src_28000.ds, month) AS account__ds__month + , DATETIME_TRUNC(accounts_source_src_28000.ds, quarter) AS account__ds__quarter + , DATETIME_TRUNC(accounts_source_src_28000.ds, year) AS account__ds__year , EXTRACT(year FROM accounts_source_src_28000.ds) AS account__ds__extract_year , EXTRACT(quarter FROM accounts_source_src_28000.ds) AS account__ds__extract_quarter , EXTRACT(month FROM accounts_source_src_28000.ds) AS account__ds__extract_month diff --git a/tests_metricflow/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/BigQuery/test_semi_additive_join_node_with_grouping__plan0_optimized.sql b/tests_metricflow/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/BigQuery/test_semi_additive_join_node_with_grouping__plan0_optimized.sql index 21e367d9b5..7bc2a27483 100644 --- a/tests_metricflow/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/BigQuery/test_semi_additive_join_node_with_grouping__plan0_optimized.sql +++ b/tests_metricflow/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/BigQuery/test_semi_additive_join_node_with_grouping__plan0_optimized.sql @@ -35,11 +35,11 @@ FROM ( account_balance , account_balance AS total_account_balance_first_day , account_balance AS current_account_balance_by_user - , DATE_TRUNC(ds, day) AS ds__day - , DATE_TRUNC(ds, isoweek) AS ds__week - , DATE_TRUNC(ds, month) AS ds__month - , DATE_TRUNC(ds, quarter) AS ds__quarter - , DATE_TRUNC(ds, year) AS ds__year + , DATETIME_TRUNC(ds, day) AS ds__day + , DATETIME_TRUNC(ds, isoweek) AS ds__week + , DATETIME_TRUNC(ds, month) AS ds__month + , DATETIME_TRUNC(ds, quarter) AS ds__quarter + , DATETIME_TRUNC(ds, year) AS ds__year , EXTRACT(year FROM ds) AS ds__extract_year , EXTRACT(quarter FROM ds) AS ds__extract_quarter , EXTRACT(month FROM ds) AS ds__extract_month @@ -47,11 +47,11 @@ FROM ( , IF(EXTRACT(dayofweek FROM ds) = 1, 7, EXTRACT(dayofweek FROM ds) - 1) AS ds__extract_dow , EXTRACT(dayofyear FROM ds) AS ds__extract_doy , account_type - , DATE_TRUNC(ds, day) AS account__ds__day - , DATE_TRUNC(ds, isoweek) AS account__ds__week - , DATE_TRUNC(ds, month) AS account__ds__month - , DATE_TRUNC(ds, quarter) AS account__ds__quarter - , DATE_TRUNC(ds, year) AS account__ds__year + , DATETIME_TRUNC(ds, day) AS account__ds__day + , DATETIME_TRUNC(ds, isoweek) AS account__ds__week + , DATETIME_TRUNC(ds, month) AS account__ds__month + , DATETIME_TRUNC(ds, quarter) AS account__ds__quarter + , DATETIME_TRUNC(ds, year) AS account__ds__year , EXTRACT(year FROM ds) AS account__ds__extract_year , EXTRACT(quarter FROM ds) AS account__ds__extract_quarter , EXTRACT(month FROM ds) AS account__ds__extract_month @@ -68,7 +68,7 @@ INNER JOIN ( -- Filter row on MAX(ds__day) SELECT user_id AS user - , MAX(DATE_TRUNC(ds, day)) AS ds__day__complete + , MAX(DATETIME_TRUNC(ds, day)) AS ds__day__complete FROM ***************************.fct_accounts accounts_source_src_28000 GROUP BY user diff --git a/tests_metricflow/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/BigQuery/test_semi_additive_join_node_with_queried_group_by__plan0.sql b/tests_metricflow/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/BigQuery/test_semi_additive_join_node_with_queried_group_by__plan0.sql index 678ad17089..15a982bc1b 100644 --- a/tests_metricflow/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/BigQuery/test_semi_additive_join_node_with_queried_group_by__plan0.sql +++ b/tests_metricflow/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/BigQuery/test_semi_additive_join_node_with_queried_group_by__plan0.sql @@ -35,11 +35,11 @@ FROM ( accounts_source_src_28000.account_balance , accounts_source_src_28000.account_balance AS total_account_balance_first_day , accounts_source_src_28000.account_balance AS current_account_balance_by_user - , DATE_TRUNC(accounts_source_src_28000.ds, day) AS ds__day - , DATE_TRUNC(accounts_source_src_28000.ds, isoweek) AS ds__week - , DATE_TRUNC(accounts_source_src_28000.ds, month) AS ds__month - , DATE_TRUNC(accounts_source_src_28000.ds, quarter) AS ds__quarter - , DATE_TRUNC(accounts_source_src_28000.ds, year) AS ds__year + , DATETIME_TRUNC(accounts_source_src_28000.ds, day) AS ds__day + , DATETIME_TRUNC(accounts_source_src_28000.ds, isoweek) AS ds__week + , DATETIME_TRUNC(accounts_source_src_28000.ds, month) AS ds__month + , DATETIME_TRUNC(accounts_source_src_28000.ds, quarter) AS ds__quarter + , DATETIME_TRUNC(accounts_source_src_28000.ds, year) AS ds__year , EXTRACT(year FROM accounts_source_src_28000.ds) AS ds__extract_year , EXTRACT(quarter FROM accounts_source_src_28000.ds) AS ds__extract_quarter , EXTRACT(month FROM accounts_source_src_28000.ds) AS ds__extract_month @@ -47,11 +47,11 @@ FROM ( , IF(EXTRACT(dayofweek FROM accounts_source_src_28000.ds) = 1, 7, EXTRACT(dayofweek FROM accounts_source_src_28000.ds) - 1) AS ds__extract_dow , EXTRACT(dayofyear FROM accounts_source_src_28000.ds) AS ds__extract_doy , accounts_source_src_28000.account_type - , DATE_TRUNC(accounts_source_src_28000.ds, day) AS account__ds__day - , DATE_TRUNC(accounts_source_src_28000.ds, isoweek) AS account__ds__week - , DATE_TRUNC(accounts_source_src_28000.ds, month) AS account__ds__month - , DATE_TRUNC(accounts_source_src_28000.ds, quarter) AS account__ds__quarter - , DATE_TRUNC(accounts_source_src_28000.ds, year) AS account__ds__year + , DATETIME_TRUNC(accounts_source_src_28000.ds, day) AS account__ds__day + , DATETIME_TRUNC(accounts_source_src_28000.ds, isoweek) AS account__ds__week + , DATETIME_TRUNC(accounts_source_src_28000.ds, month) AS account__ds__month + , DATETIME_TRUNC(accounts_source_src_28000.ds, quarter) AS account__ds__quarter + , DATETIME_TRUNC(accounts_source_src_28000.ds, year) AS account__ds__year , EXTRACT(year FROM accounts_source_src_28000.ds) AS account__ds__extract_year , EXTRACT(quarter FROM accounts_source_src_28000.ds) AS account__ds__extract_quarter , EXTRACT(month FROM accounts_source_src_28000.ds) AS account__ds__extract_month @@ -74,11 +74,11 @@ INNER JOIN ( accounts_source_src_28000.account_balance , accounts_source_src_28000.account_balance AS total_account_balance_first_day , accounts_source_src_28000.account_balance AS current_account_balance_by_user - , DATE_TRUNC(accounts_source_src_28000.ds, day) AS ds__day - , DATE_TRUNC(accounts_source_src_28000.ds, isoweek) AS ds__week - , DATE_TRUNC(accounts_source_src_28000.ds, month) AS ds__month - , DATE_TRUNC(accounts_source_src_28000.ds, quarter) AS ds__quarter - , DATE_TRUNC(accounts_source_src_28000.ds, year) AS ds__year + , DATETIME_TRUNC(accounts_source_src_28000.ds, day) AS ds__day + , DATETIME_TRUNC(accounts_source_src_28000.ds, isoweek) AS ds__week + , DATETIME_TRUNC(accounts_source_src_28000.ds, month) AS ds__month + , DATETIME_TRUNC(accounts_source_src_28000.ds, quarter) AS ds__quarter + , DATETIME_TRUNC(accounts_source_src_28000.ds, year) AS ds__year , EXTRACT(year FROM accounts_source_src_28000.ds) AS ds__extract_year , EXTRACT(quarter FROM accounts_source_src_28000.ds) AS ds__extract_quarter , EXTRACT(month FROM accounts_source_src_28000.ds) AS ds__extract_month @@ -86,11 +86,11 @@ INNER JOIN ( , IF(EXTRACT(dayofweek FROM accounts_source_src_28000.ds) = 1, 7, EXTRACT(dayofweek FROM accounts_source_src_28000.ds) - 1) AS ds__extract_dow , EXTRACT(dayofyear FROM accounts_source_src_28000.ds) AS ds__extract_doy , accounts_source_src_28000.account_type - , DATE_TRUNC(accounts_source_src_28000.ds, day) AS account__ds__day - , DATE_TRUNC(accounts_source_src_28000.ds, isoweek) AS account__ds__week - , DATE_TRUNC(accounts_source_src_28000.ds, month) AS account__ds__month - , DATE_TRUNC(accounts_source_src_28000.ds, quarter) AS account__ds__quarter - , DATE_TRUNC(accounts_source_src_28000.ds, year) AS account__ds__year + , DATETIME_TRUNC(accounts_source_src_28000.ds, day) AS account__ds__day + , DATETIME_TRUNC(accounts_source_src_28000.ds, isoweek) AS account__ds__week + , DATETIME_TRUNC(accounts_source_src_28000.ds, month) AS account__ds__month + , DATETIME_TRUNC(accounts_source_src_28000.ds, quarter) AS account__ds__quarter + , DATETIME_TRUNC(accounts_source_src_28000.ds, year) AS account__ds__year , EXTRACT(year FROM accounts_source_src_28000.ds) AS account__ds__extract_year , EXTRACT(quarter FROM accounts_source_src_28000.ds) AS account__ds__extract_quarter , EXTRACT(month FROM accounts_source_src_28000.ds) AS account__ds__extract_month diff --git a/tests_metricflow/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/BigQuery/test_semi_additive_join_node_with_queried_group_by__plan0_optimized.sql b/tests_metricflow/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/BigQuery/test_semi_additive_join_node_with_queried_group_by__plan0_optimized.sql index 909a088263..adb1d564c8 100644 --- a/tests_metricflow/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/BigQuery/test_semi_additive_join_node_with_queried_group_by__plan0_optimized.sql +++ b/tests_metricflow/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/BigQuery/test_semi_additive_join_node_with_queried_group_by__plan0_optimized.sql @@ -35,11 +35,11 @@ FROM ( account_balance , account_balance AS total_account_balance_first_day , account_balance AS current_account_balance_by_user - , DATE_TRUNC(ds, day) AS ds__day - , DATE_TRUNC(ds, isoweek) AS ds__week - , DATE_TRUNC(ds, month) AS ds__month - , DATE_TRUNC(ds, quarter) AS ds__quarter - , DATE_TRUNC(ds, year) AS ds__year + , DATETIME_TRUNC(ds, day) AS ds__day + , DATETIME_TRUNC(ds, isoweek) AS ds__week + , DATETIME_TRUNC(ds, month) AS ds__month + , DATETIME_TRUNC(ds, quarter) AS ds__quarter + , DATETIME_TRUNC(ds, year) AS ds__year , EXTRACT(year FROM ds) AS ds__extract_year , EXTRACT(quarter FROM ds) AS ds__extract_quarter , EXTRACT(month FROM ds) AS ds__extract_month @@ -47,11 +47,11 @@ FROM ( , IF(EXTRACT(dayofweek FROM ds) = 1, 7, EXTRACT(dayofweek FROM ds) - 1) AS ds__extract_dow , EXTRACT(dayofyear FROM ds) AS ds__extract_doy , account_type - , DATE_TRUNC(ds, day) AS account__ds__day - , DATE_TRUNC(ds, isoweek) AS account__ds__week - , DATE_TRUNC(ds, month) AS account__ds__month - , DATE_TRUNC(ds, quarter) AS account__ds__quarter - , DATE_TRUNC(ds, year) AS account__ds__year + , DATETIME_TRUNC(ds, day) AS account__ds__day + , DATETIME_TRUNC(ds, isoweek) AS account__ds__week + , DATETIME_TRUNC(ds, month) AS account__ds__month + , DATETIME_TRUNC(ds, quarter) AS account__ds__quarter + , DATETIME_TRUNC(ds, year) AS account__ds__year , EXTRACT(year FROM ds) AS account__ds__extract_year , EXTRACT(quarter FROM ds) AS account__ds__extract_quarter , EXTRACT(month FROM ds) AS account__ds__extract_month @@ -67,8 +67,8 @@ INNER JOIN ( -- Read Elements From Semantic Model 'accounts_source' -- Filter row on MIN(ds__day) SELECT - DATE_TRUNC(ds, isoweek) AS ds__week - , MIN(DATE_TRUNC(ds, day)) AS ds__day__complete + DATETIME_TRUNC(ds, isoweek) AS ds__week + , MIN(DATETIME_TRUNC(ds, day)) AS ds__day__complete FROM ***************************.fct_accounts accounts_source_src_28000 GROUP BY ds__week diff --git a/tests_metricflow/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/BigQuery/test_single_join_node__plan0.sql b/tests_metricflow/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/BigQuery/test_single_join_node__plan0.sql index 2baea3c2d6..69ccb6a64a 100644 --- a/tests_metricflow/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/BigQuery/test_single_join_node__plan0.sql +++ b/tests_metricflow/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/BigQuery/test_single_join_node__plan0.sql @@ -25,33 +25,33 @@ FROM ( , bookings_source_src_28000.booking_value AS approximate_continuous_booking_value_p99 , bookings_source_src_28000.booking_value AS approximate_discrete_booking_value_p99 , bookings_source_src_28000.is_instant - , DATE_TRUNC(bookings_source_src_28000.ds, day) AS ds__day - , DATE_TRUNC(bookings_source_src_28000.ds, isoweek) AS ds__week - , DATE_TRUNC(bookings_source_src_28000.ds, month) AS ds__month - , DATE_TRUNC(bookings_source_src_28000.ds, quarter) AS ds__quarter - , DATE_TRUNC(bookings_source_src_28000.ds, year) AS ds__year + , DATETIME_TRUNC(bookings_source_src_28000.ds, day) AS ds__day + , DATETIME_TRUNC(bookings_source_src_28000.ds, isoweek) AS ds__week + , DATETIME_TRUNC(bookings_source_src_28000.ds, month) AS ds__month + , DATETIME_TRUNC(bookings_source_src_28000.ds, quarter) AS ds__quarter + , DATETIME_TRUNC(bookings_source_src_28000.ds, year) AS ds__year , EXTRACT(year FROM bookings_source_src_28000.ds) AS ds__extract_year , EXTRACT(quarter FROM bookings_source_src_28000.ds) AS ds__extract_quarter , EXTRACT(month FROM bookings_source_src_28000.ds) AS ds__extract_month , EXTRACT(day FROM bookings_source_src_28000.ds) AS ds__extract_day , IF(EXTRACT(dayofweek FROM bookings_source_src_28000.ds) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_28000.ds) - 1) AS ds__extract_dow , EXTRACT(dayofyear FROM bookings_source_src_28000.ds) AS ds__extract_doy - , DATE_TRUNC(bookings_source_src_28000.ds_partitioned, day) AS ds_partitioned__day - , DATE_TRUNC(bookings_source_src_28000.ds_partitioned, isoweek) AS ds_partitioned__week - , DATE_TRUNC(bookings_source_src_28000.ds_partitioned, month) AS ds_partitioned__month - , DATE_TRUNC(bookings_source_src_28000.ds_partitioned, quarter) AS ds_partitioned__quarter - , DATE_TRUNC(bookings_source_src_28000.ds_partitioned, year) AS ds_partitioned__year + , DATETIME_TRUNC(bookings_source_src_28000.ds_partitioned, day) AS ds_partitioned__day + , DATETIME_TRUNC(bookings_source_src_28000.ds_partitioned, isoweek) AS ds_partitioned__week + , DATETIME_TRUNC(bookings_source_src_28000.ds_partitioned, month) AS ds_partitioned__month + , DATETIME_TRUNC(bookings_source_src_28000.ds_partitioned, quarter) AS ds_partitioned__quarter + , DATETIME_TRUNC(bookings_source_src_28000.ds_partitioned, year) AS ds_partitioned__year , EXTRACT(year FROM bookings_source_src_28000.ds_partitioned) AS ds_partitioned__extract_year , EXTRACT(quarter FROM bookings_source_src_28000.ds_partitioned) AS ds_partitioned__extract_quarter , EXTRACT(month FROM bookings_source_src_28000.ds_partitioned) AS ds_partitioned__extract_month , EXTRACT(day FROM bookings_source_src_28000.ds_partitioned) AS ds_partitioned__extract_day , IF(EXTRACT(dayofweek FROM bookings_source_src_28000.ds_partitioned) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_28000.ds_partitioned) - 1) AS ds_partitioned__extract_dow , EXTRACT(dayofyear FROM bookings_source_src_28000.ds_partitioned) AS ds_partitioned__extract_doy - , DATE_TRUNC(bookings_source_src_28000.paid_at, day) AS paid_at__day - , DATE_TRUNC(bookings_source_src_28000.paid_at, isoweek) AS paid_at__week - , DATE_TRUNC(bookings_source_src_28000.paid_at, month) AS paid_at__month - , DATE_TRUNC(bookings_source_src_28000.paid_at, quarter) AS paid_at__quarter - , DATE_TRUNC(bookings_source_src_28000.paid_at, year) AS paid_at__year + , DATETIME_TRUNC(bookings_source_src_28000.paid_at, day) AS paid_at__day + , DATETIME_TRUNC(bookings_source_src_28000.paid_at, isoweek) AS paid_at__week + , DATETIME_TRUNC(bookings_source_src_28000.paid_at, month) AS paid_at__month + , DATETIME_TRUNC(bookings_source_src_28000.paid_at, quarter) AS paid_at__quarter + , DATETIME_TRUNC(bookings_source_src_28000.paid_at, year) AS paid_at__year , EXTRACT(year FROM bookings_source_src_28000.paid_at) AS paid_at__extract_year , EXTRACT(quarter FROM bookings_source_src_28000.paid_at) AS paid_at__extract_quarter , EXTRACT(month FROM bookings_source_src_28000.paid_at) AS paid_at__extract_month @@ -59,33 +59,33 @@ FROM ( , IF(EXTRACT(dayofweek FROM bookings_source_src_28000.paid_at) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_28000.paid_at) - 1) AS paid_at__extract_dow , EXTRACT(dayofyear FROM bookings_source_src_28000.paid_at) AS paid_at__extract_doy , bookings_source_src_28000.is_instant AS booking__is_instant - , DATE_TRUNC(bookings_source_src_28000.ds, day) AS booking__ds__day - , DATE_TRUNC(bookings_source_src_28000.ds, isoweek) AS booking__ds__week - , DATE_TRUNC(bookings_source_src_28000.ds, month) AS booking__ds__month - , DATE_TRUNC(bookings_source_src_28000.ds, quarter) AS booking__ds__quarter - , DATE_TRUNC(bookings_source_src_28000.ds, year) AS booking__ds__year + , DATETIME_TRUNC(bookings_source_src_28000.ds, day) AS booking__ds__day + , DATETIME_TRUNC(bookings_source_src_28000.ds, isoweek) AS booking__ds__week + , DATETIME_TRUNC(bookings_source_src_28000.ds, month) AS booking__ds__month + , DATETIME_TRUNC(bookings_source_src_28000.ds, quarter) AS booking__ds__quarter + , DATETIME_TRUNC(bookings_source_src_28000.ds, year) AS booking__ds__year , EXTRACT(year FROM bookings_source_src_28000.ds) AS booking__ds__extract_year , EXTRACT(quarter FROM bookings_source_src_28000.ds) AS booking__ds__extract_quarter , EXTRACT(month FROM bookings_source_src_28000.ds) AS booking__ds__extract_month , EXTRACT(day FROM bookings_source_src_28000.ds) AS booking__ds__extract_day , IF(EXTRACT(dayofweek FROM bookings_source_src_28000.ds) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_28000.ds) - 1) AS booking__ds__extract_dow , EXTRACT(dayofyear FROM bookings_source_src_28000.ds) AS booking__ds__extract_doy - , DATE_TRUNC(bookings_source_src_28000.ds_partitioned, day) AS booking__ds_partitioned__day - , DATE_TRUNC(bookings_source_src_28000.ds_partitioned, isoweek) AS booking__ds_partitioned__week - , DATE_TRUNC(bookings_source_src_28000.ds_partitioned, month) AS booking__ds_partitioned__month - , DATE_TRUNC(bookings_source_src_28000.ds_partitioned, quarter) AS booking__ds_partitioned__quarter - , DATE_TRUNC(bookings_source_src_28000.ds_partitioned, year) AS booking__ds_partitioned__year + , DATETIME_TRUNC(bookings_source_src_28000.ds_partitioned, day) AS booking__ds_partitioned__day + , DATETIME_TRUNC(bookings_source_src_28000.ds_partitioned, isoweek) AS booking__ds_partitioned__week + , DATETIME_TRUNC(bookings_source_src_28000.ds_partitioned, month) AS booking__ds_partitioned__month + , DATETIME_TRUNC(bookings_source_src_28000.ds_partitioned, quarter) AS booking__ds_partitioned__quarter + , DATETIME_TRUNC(bookings_source_src_28000.ds_partitioned, year) AS booking__ds_partitioned__year , EXTRACT(year FROM bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__extract_year , EXTRACT(quarter FROM bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__extract_quarter , EXTRACT(month FROM bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__extract_month , EXTRACT(day FROM bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__extract_day , IF(EXTRACT(dayofweek FROM bookings_source_src_28000.ds_partitioned) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_28000.ds_partitioned) - 1) AS booking__ds_partitioned__extract_dow , EXTRACT(dayofyear FROM bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__extract_doy - , DATE_TRUNC(bookings_source_src_28000.paid_at, day) AS booking__paid_at__day - , DATE_TRUNC(bookings_source_src_28000.paid_at, isoweek) AS booking__paid_at__week - , DATE_TRUNC(bookings_source_src_28000.paid_at, month) AS booking__paid_at__month - , DATE_TRUNC(bookings_source_src_28000.paid_at, quarter) AS booking__paid_at__quarter - , DATE_TRUNC(bookings_source_src_28000.paid_at, year) AS booking__paid_at__year + , DATETIME_TRUNC(bookings_source_src_28000.paid_at, day) AS booking__paid_at__day + , DATETIME_TRUNC(bookings_source_src_28000.paid_at, isoweek) AS booking__paid_at__week + , DATETIME_TRUNC(bookings_source_src_28000.paid_at, month) AS booking__paid_at__month + , DATETIME_TRUNC(bookings_source_src_28000.paid_at, quarter) AS booking__paid_at__quarter + , DATETIME_TRUNC(bookings_source_src_28000.paid_at, year) AS booking__paid_at__year , EXTRACT(year FROM bookings_source_src_28000.paid_at) AS booking__paid_at__extract_year , EXTRACT(quarter FROM bookings_source_src_28000.paid_at) AS booking__paid_at__extract_quarter , EXTRACT(month FROM bookings_source_src_28000.paid_at) AS booking__paid_at__extract_month @@ -112,22 +112,22 @@ LEFT OUTER JOIN ( 1 AS listings , listings_latest_src_28000.capacity AS largest_listing , listings_latest_src_28000.capacity AS smallest_listing - , DATE_TRUNC(listings_latest_src_28000.created_at, day) AS ds__day - , DATE_TRUNC(listings_latest_src_28000.created_at, isoweek) AS ds__week - , DATE_TRUNC(listings_latest_src_28000.created_at, month) AS ds__month - , DATE_TRUNC(listings_latest_src_28000.created_at, quarter) AS ds__quarter - , DATE_TRUNC(listings_latest_src_28000.created_at, year) AS ds__year + , DATETIME_TRUNC(listings_latest_src_28000.created_at, day) AS ds__day + , DATETIME_TRUNC(listings_latest_src_28000.created_at, isoweek) AS ds__week + , DATETIME_TRUNC(listings_latest_src_28000.created_at, month) AS ds__month + , DATETIME_TRUNC(listings_latest_src_28000.created_at, quarter) AS ds__quarter + , DATETIME_TRUNC(listings_latest_src_28000.created_at, year) AS ds__year , EXTRACT(year FROM listings_latest_src_28000.created_at) AS ds__extract_year , EXTRACT(quarter FROM listings_latest_src_28000.created_at) AS ds__extract_quarter , EXTRACT(month FROM listings_latest_src_28000.created_at) AS ds__extract_month , EXTRACT(day FROM listings_latest_src_28000.created_at) AS ds__extract_day , IF(EXTRACT(dayofweek FROM listings_latest_src_28000.created_at) = 1, 7, EXTRACT(dayofweek FROM listings_latest_src_28000.created_at) - 1) AS ds__extract_dow , EXTRACT(dayofyear FROM listings_latest_src_28000.created_at) AS ds__extract_doy - , DATE_TRUNC(listings_latest_src_28000.created_at, day) AS created_at__day - , DATE_TRUNC(listings_latest_src_28000.created_at, isoweek) AS created_at__week - , DATE_TRUNC(listings_latest_src_28000.created_at, month) AS created_at__month - , DATE_TRUNC(listings_latest_src_28000.created_at, quarter) AS created_at__quarter - , DATE_TRUNC(listings_latest_src_28000.created_at, year) AS created_at__year + , DATETIME_TRUNC(listings_latest_src_28000.created_at, day) AS created_at__day + , DATETIME_TRUNC(listings_latest_src_28000.created_at, isoweek) AS created_at__week + , DATETIME_TRUNC(listings_latest_src_28000.created_at, month) AS created_at__month + , DATETIME_TRUNC(listings_latest_src_28000.created_at, quarter) AS created_at__quarter + , DATETIME_TRUNC(listings_latest_src_28000.created_at, year) AS created_at__year , EXTRACT(year FROM listings_latest_src_28000.created_at) AS created_at__extract_year , EXTRACT(quarter FROM listings_latest_src_28000.created_at) AS created_at__extract_quarter , EXTRACT(month FROM listings_latest_src_28000.created_at) AS created_at__extract_month @@ -137,22 +137,22 @@ LEFT OUTER JOIN ( , listings_latest_src_28000.country AS country_latest , listings_latest_src_28000.is_lux AS is_lux_latest , listings_latest_src_28000.capacity AS capacity_latest - , DATE_TRUNC(listings_latest_src_28000.created_at, day) AS listing__ds__day - , DATE_TRUNC(listings_latest_src_28000.created_at, isoweek) AS listing__ds__week - , DATE_TRUNC(listings_latest_src_28000.created_at, month) AS listing__ds__month - , DATE_TRUNC(listings_latest_src_28000.created_at, quarter) AS listing__ds__quarter - , DATE_TRUNC(listings_latest_src_28000.created_at, year) AS listing__ds__year + , DATETIME_TRUNC(listings_latest_src_28000.created_at, day) AS listing__ds__day + , DATETIME_TRUNC(listings_latest_src_28000.created_at, isoweek) AS listing__ds__week + , DATETIME_TRUNC(listings_latest_src_28000.created_at, month) AS listing__ds__month + , DATETIME_TRUNC(listings_latest_src_28000.created_at, quarter) AS listing__ds__quarter + , DATETIME_TRUNC(listings_latest_src_28000.created_at, year) AS listing__ds__year , EXTRACT(year FROM listings_latest_src_28000.created_at) AS listing__ds__extract_year , EXTRACT(quarter FROM listings_latest_src_28000.created_at) AS listing__ds__extract_quarter , EXTRACT(month FROM listings_latest_src_28000.created_at) AS listing__ds__extract_month , EXTRACT(day FROM listings_latest_src_28000.created_at) AS listing__ds__extract_day , IF(EXTRACT(dayofweek FROM listings_latest_src_28000.created_at) = 1, 7, EXTRACT(dayofweek FROM listings_latest_src_28000.created_at) - 1) AS listing__ds__extract_dow , EXTRACT(dayofyear FROM listings_latest_src_28000.created_at) AS listing__ds__extract_doy - , DATE_TRUNC(listings_latest_src_28000.created_at, day) AS listing__created_at__day - , DATE_TRUNC(listings_latest_src_28000.created_at, isoweek) AS listing__created_at__week - , DATE_TRUNC(listings_latest_src_28000.created_at, month) AS listing__created_at__month - , DATE_TRUNC(listings_latest_src_28000.created_at, quarter) AS listing__created_at__quarter - , DATE_TRUNC(listings_latest_src_28000.created_at, year) AS listing__created_at__year + , DATETIME_TRUNC(listings_latest_src_28000.created_at, day) AS listing__created_at__day + , DATETIME_TRUNC(listings_latest_src_28000.created_at, isoweek) AS listing__created_at__week + , DATETIME_TRUNC(listings_latest_src_28000.created_at, month) AS listing__created_at__month + , DATETIME_TRUNC(listings_latest_src_28000.created_at, quarter) AS listing__created_at__quarter + , DATETIME_TRUNC(listings_latest_src_28000.created_at, year) AS listing__created_at__year , EXTRACT(year FROM listings_latest_src_28000.created_at) AS listing__created_at__extract_year , EXTRACT(quarter FROM listings_latest_src_28000.created_at) AS listing__created_at__extract_quarter , EXTRACT(month FROM listings_latest_src_28000.created_at) AS listing__created_at__extract_month diff --git a/tests_metricflow/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/BigQuery/test_source_node__plan0.sql b/tests_metricflow/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/BigQuery/test_source_node__plan0.sql index c614493864..afa118a65c 100644 --- a/tests_metricflow/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/BigQuery/test_source_node__plan0.sql +++ b/tests_metricflow/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/BigQuery/test_source_node__plan0.sql @@ -15,33 +15,33 @@ SELECT , bookings_source_src_28000.booking_value AS approximate_continuous_booking_value_p99 , bookings_source_src_28000.booking_value AS approximate_discrete_booking_value_p99 , bookings_source_src_28000.is_instant - , DATE_TRUNC(bookings_source_src_28000.ds, day) AS ds__day - , DATE_TRUNC(bookings_source_src_28000.ds, isoweek) AS ds__week - , DATE_TRUNC(bookings_source_src_28000.ds, month) AS ds__month - , DATE_TRUNC(bookings_source_src_28000.ds, quarter) AS ds__quarter - , DATE_TRUNC(bookings_source_src_28000.ds, year) AS ds__year + , DATETIME_TRUNC(bookings_source_src_28000.ds, day) AS ds__day + , DATETIME_TRUNC(bookings_source_src_28000.ds, isoweek) AS ds__week + , DATETIME_TRUNC(bookings_source_src_28000.ds, month) AS ds__month + , DATETIME_TRUNC(bookings_source_src_28000.ds, quarter) AS ds__quarter + , DATETIME_TRUNC(bookings_source_src_28000.ds, year) AS ds__year , EXTRACT(year FROM bookings_source_src_28000.ds) AS ds__extract_year , EXTRACT(quarter FROM bookings_source_src_28000.ds) AS ds__extract_quarter , EXTRACT(month FROM bookings_source_src_28000.ds) AS ds__extract_month , EXTRACT(day FROM bookings_source_src_28000.ds) AS ds__extract_day , IF(EXTRACT(dayofweek FROM bookings_source_src_28000.ds) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_28000.ds) - 1) AS ds__extract_dow , EXTRACT(dayofyear FROM bookings_source_src_28000.ds) AS ds__extract_doy - , DATE_TRUNC(bookings_source_src_28000.ds_partitioned, day) AS ds_partitioned__day - , DATE_TRUNC(bookings_source_src_28000.ds_partitioned, isoweek) AS ds_partitioned__week - , DATE_TRUNC(bookings_source_src_28000.ds_partitioned, month) AS ds_partitioned__month - , DATE_TRUNC(bookings_source_src_28000.ds_partitioned, quarter) AS ds_partitioned__quarter - , DATE_TRUNC(bookings_source_src_28000.ds_partitioned, year) AS ds_partitioned__year + , DATETIME_TRUNC(bookings_source_src_28000.ds_partitioned, day) AS ds_partitioned__day + , DATETIME_TRUNC(bookings_source_src_28000.ds_partitioned, isoweek) AS ds_partitioned__week + , DATETIME_TRUNC(bookings_source_src_28000.ds_partitioned, month) AS ds_partitioned__month + , DATETIME_TRUNC(bookings_source_src_28000.ds_partitioned, quarter) AS ds_partitioned__quarter + , DATETIME_TRUNC(bookings_source_src_28000.ds_partitioned, year) AS ds_partitioned__year , EXTRACT(year FROM bookings_source_src_28000.ds_partitioned) AS ds_partitioned__extract_year , EXTRACT(quarter FROM bookings_source_src_28000.ds_partitioned) AS ds_partitioned__extract_quarter , EXTRACT(month FROM bookings_source_src_28000.ds_partitioned) AS ds_partitioned__extract_month , EXTRACT(day FROM bookings_source_src_28000.ds_partitioned) AS ds_partitioned__extract_day , IF(EXTRACT(dayofweek FROM bookings_source_src_28000.ds_partitioned) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_28000.ds_partitioned) - 1) AS ds_partitioned__extract_dow , EXTRACT(dayofyear FROM bookings_source_src_28000.ds_partitioned) AS ds_partitioned__extract_doy - , DATE_TRUNC(bookings_source_src_28000.paid_at, day) AS paid_at__day - , DATE_TRUNC(bookings_source_src_28000.paid_at, isoweek) AS paid_at__week - , DATE_TRUNC(bookings_source_src_28000.paid_at, month) AS paid_at__month - , DATE_TRUNC(bookings_source_src_28000.paid_at, quarter) AS paid_at__quarter - , DATE_TRUNC(bookings_source_src_28000.paid_at, year) AS paid_at__year + , DATETIME_TRUNC(bookings_source_src_28000.paid_at, day) AS paid_at__day + , DATETIME_TRUNC(bookings_source_src_28000.paid_at, isoweek) AS paid_at__week + , DATETIME_TRUNC(bookings_source_src_28000.paid_at, month) AS paid_at__month + , DATETIME_TRUNC(bookings_source_src_28000.paid_at, quarter) AS paid_at__quarter + , DATETIME_TRUNC(bookings_source_src_28000.paid_at, year) AS paid_at__year , EXTRACT(year FROM bookings_source_src_28000.paid_at) AS paid_at__extract_year , EXTRACT(quarter FROM bookings_source_src_28000.paid_at) AS paid_at__extract_quarter , EXTRACT(month FROM bookings_source_src_28000.paid_at) AS paid_at__extract_month @@ -49,33 +49,33 @@ SELECT , IF(EXTRACT(dayofweek FROM bookings_source_src_28000.paid_at) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_28000.paid_at) - 1) AS paid_at__extract_dow , EXTRACT(dayofyear FROM bookings_source_src_28000.paid_at) AS paid_at__extract_doy , bookings_source_src_28000.is_instant AS booking__is_instant - , DATE_TRUNC(bookings_source_src_28000.ds, day) AS booking__ds__day - , DATE_TRUNC(bookings_source_src_28000.ds, isoweek) AS booking__ds__week - , DATE_TRUNC(bookings_source_src_28000.ds, month) AS booking__ds__month - , DATE_TRUNC(bookings_source_src_28000.ds, quarter) AS booking__ds__quarter - , DATE_TRUNC(bookings_source_src_28000.ds, year) AS booking__ds__year + , DATETIME_TRUNC(bookings_source_src_28000.ds, day) AS booking__ds__day + , DATETIME_TRUNC(bookings_source_src_28000.ds, isoweek) AS booking__ds__week + , DATETIME_TRUNC(bookings_source_src_28000.ds, month) AS booking__ds__month + , DATETIME_TRUNC(bookings_source_src_28000.ds, quarter) AS booking__ds__quarter + , DATETIME_TRUNC(bookings_source_src_28000.ds, year) AS booking__ds__year , EXTRACT(year FROM bookings_source_src_28000.ds) AS booking__ds__extract_year , EXTRACT(quarter FROM bookings_source_src_28000.ds) AS booking__ds__extract_quarter , EXTRACT(month FROM bookings_source_src_28000.ds) AS booking__ds__extract_month , EXTRACT(day FROM bookings_source_src_28000.ds) AS booking__ds__extract_day , IF(EXTRACT(dayofweek FROM bookings_source_src_28000.ds) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_28000.ds) - 1) AS booking__ds__extract_dow , EXTRACT(dayofyear FROM bookings_source_src_28000.ds) AS booking__ds__extract_doy - , DATE_TRUNC(bookings_source_src_28000.ds_partitioned, day) AS booking__ds_partitioned__day - , DATE_TRUNC(bookings_source_src_28000.ds_partitioned, isoweek) AS booking__ds_partitioned__week - , DATE_TRUNC(bookings_source_src_28000.ds_partitioned, month) AS booking__ds_partitioned__month - , DATE_TRUNC(bookings_source_src_28000.ds_partitioned, quarter) AS booking__ds_partitioned__quarter - , DATE_TRUNC(bookings_source_src_28000.ds_partitioned, year) AS booking__ds_partitioned__year + , DATETIME_TRUNC(bookings_source_src_28000.ds_partitioned, day) AS booking__ds_partitioned__day + , DATETIME_TRUNC(bookings_source_src_28000.ds_partitioned, isoweek) AS booking__ds_partitioned__week + , DATETIME_TRUNC(bookings_source_src_28000.ds_partitioned, month) AS booking__ds_partitioned__month + , DATETIME_TRUNC(bookings_source_src_28000.ds_partitioned, quarter) AS booking__ds_partitioned__quarter + , DATETIME_TRUNC(bookings_source_src_28000.ds_partitioned, year) AS booking__ds_partitioned__year , EXTRACT(year FROM bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__extract_year , EXTRACT(quarter FROM bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__extract_quarter , EXTRACT(month FROM bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__extract_month , EXTRACT(day FROM bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__extract_day , IF(EXTRACT(dayofweek FROM bookings_source_src_28000.ds_partitioned) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_28000.ds_partitioned) - 1) AS booking__ds_partitioned__extract_dow , EXTRACT(dayofyear FROM bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__extract_doy - , DATE_TRUNC(bookings_source_src_28000.paid_at, day) AS booking__paid_at__day - , DATE_TRUNC(bookings_source_src_28000.paid_at, isoweek) AS booking__paid_at__week - , DATE_TRUNC(bookings_source_src_28000.paid_at, month) AS booking__paid_at__month - , DATE_TRUNC(bookings_source_src_28000.paid_at, quarter) AS booking__paid_at__quarter - , DATE_TRUNC(bookings_source_src_28000.paid_at, year) AS booking__paid_at__year + , DATETIME_TRUNC(bookings_source_src_28000.paid_at, day) AS booking__paid_at__day + , DATETIME_TRUNC(bookings_source_src_28000.paid_at, isoweek) AS booking__paid_at__week + , DATETIME_TRUNC(bookings_source_src_28000.paid_at, month) AS booking__paid_at__month + , DATETIME_TRUNC(bookings_source_src_28000.paid_at, quarter) AS booking__paid_at__quarter + , DATETIME_TRUNC(bookings_source_src_28000.paid_at, year) AS booking__paid_at__year , EXTRACT(year FROM bookings_source_src_28000.paid_at) AS booking__paid_at__extract_year , EXTRACT(quarter FROM bookings_source_src_28000.paid_at) AS booking__paid_at__extract_quarter , EXTRACT(month FROM bookings_source_src_28000.paid_at) AS booking__paid_at__extract_month diff --git a/tests_metricflow/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/BigQuery/test_source_node__plan0_optimized.sql b/tests_metricflow/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/BigQuery/test_source_node__plan0_optimized.sql index 641da95a40..6f863aca28 100644 --- a/tests_metricflow/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/BigQuery/test_source_node__plan0_optimized.sql +++ b/tests_metricflow/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/BigQuery/test_source_node__plan0_optimized.sql @@ -15,33 +15,33 @@ SELECT , booking_value AS approximate_continuous_booking_value_p99 , booking_value AS approximate_discrete_booking_value_p99 , is_instant - , DATE_TRUNC(ds, day) AS ds__day - , DATE_TRUNC(ds, isoweek) AS ds__week - , DATE_TRUNC(ds, month) AS ds__month - , DATE_TRUNC(ds, quarter) AS ds__quarter - , DATE_TRUNC(ds, year) AS ds__year + , DATETIME_TRUNC(ds, day) AS ds__day + , DATETIME_TRUNC(ds, isoweek) AS ds__week + , DATETIME_TRUNC(ds, month) AS ds__month + , DATETIME_TRUNC(ds, quarter) AS ds__quarter + , DATETIME_TRUNC(ds, year) AS ds__year , EXTRACT(year FROM ds) AS ds__extract_year , EXTRACT(quarter FROM ds) AS ds__extract_quarter , EXTRACT(month FROM ds) AS ds__extract_month , EXTRACT(day FROM ds) AS ds__extract_day , IF(EXTRACT(dayofweek FROM ds) = 1, 7, EXTRACT(dayofweek FROM ds) - 1) AS ds__extract_dow , EXTRACT(dayofyear FROM ds) AS ds__extract_doy - , DATE_TRUNC(ds_partitioned, day) AS ds_partitioned__day - , DATE_TRUNC(ds_partitioned, isoweek) AS ds_partitioned__week - , DATE_TRUNC(ds_partitioned, month) AS ds_partitioned__month - , DATE_TRUNC(ds_partitioned, quarter) AS ds_partitioned__quarter - , DATE_TRUNC(ds_partitioned, year) AS ds_partitioned__year + , DATETIME_TRUNC(ds_partitioned, day) AS ds_partitioned__day + , DATETIME_TRUNC(ds_partitioned, isoweek) AS ds_partitioned__week + , DATETIME_TRUNC(ds_partitioned, month) AS ds_partitioned__month + , DATETIME_TRUNC(ds_partitioned, quarter) AS ds_partitioned__quarter + , DATETIME_TRUNC(ds_partitioned, year) AS ds_partitioned__year , EXTRACT(year FROM ds_partitioned) AS ds_partitioned__extract_year , EXTRACT(quarter FROM ds_partitioned) AS ds_partitioned__extract_quarter , EXTRACT(month FROM ds_partitioned) AS ds_partitioned__extract_month , EXTRACT(day FROM ds_partitioned) AS ds_partitioned__extract_day , IF(EXTRACT(dayofweek FROM ds_partitioned) = 1, 7, EXTRACT(dayofweek FROM ds_partitioned) - 1) AS ds_partitioned__extract_dow , EXTRACT(dayofyear FROM ds_partitioned) AS ds_partitioned__extract_doy - , DATE_TRUNC(paid_at, day) AS paid_at__day - , DATE_TRUNC(paid_at, isoweek) AS paid_at__week - , DATE_TRUNC(paid_at, month) AS paid_at__month - , DATE_TRUNC(paid_at, quarter) AS paid_at__quarter - , DATE_TRUNC(paid_at, year) AS paid_at__year + , DATETIME_TRUNC(paid_at, day) AS paid_at__day + , DATETIME_TRUNC(paid_at, isoweek) AS paid_at__week + , DATETIME_TRUNC(paid_at, month) AS paid_at__month + , DATETIME_TRUNC(paid_at, quarter) AS paid_at__quarter + , DATETIME_TRUNC(paid_at, year) AS paid_at__year , EXTRACT(year FROM paid_at) AS paid_at__extract_year , EXTRACT(quarter FROM paid_at) AS paid_at__extract_quarter , EXTRACT(month FROM paid_at) AS paid_at__extract_month @@ -49,33 +49,33 @@ SELECT , IF(EXTRACT(dayofweek FROM paid_at) = 1, 7, EXTRACT(dayofweek FROM paid_at) - 1) AS paid_at__extract_dow , EXTRACT(dayofyear FROM paid_at) AS paid_at__extract_doy , is_instant AS booking__is_instant - , DATE_TRUNC(ds, day) AS booking__ds__day - , DATE_TRUNC(ds, isoweek) AS booking__ds__week - , DATE_TRUNC(ds, month) AS booking__ds__month - , DATE_TRUNC(ds, quarter) AS booking__ds__quarter - , DATE_TRUNC(ds, year) AS booking__ds__year + , DATETIME_TRUNC(ds, day) AS booking__ds__day + , DATETIME_TRUNC(ds, isoweek) AS booking__ds__week + , DATETIME_TRUNC(ds, month) AS booking__ds__month + , DATETIME_TRUNC(ds, quarter) AS booking__ds__quarter + , DATETIME_TRUNC(ds, year) AS booking__ds__year , EXTRACT(year FROM ds) AS booking__ds__extract_year , EXTRACT(quarter FROM ds) AS booking__ds__extract_quarter , EXTRACT(month FROM ds) AS booking__ds__extract_month , EXTRACT(day FROM ds) AS booking__ds__extract_day , IF(EXTRACT(dayofweek FROM ds) = 1, 7, EXTRACT(dayofweek FROM ds) - 1) AS booking__ds__extract_dow , EXTRACT(dayofyear FROM ds) AS booking__ds__extract_doy - , DATE_TRUNC(ds_partitioned, day) AS booking__ds_partitioned__day - , DATE_TRUNC(ds_partitioned, isoweek) AS booking__ds_partitioned__week - , DATE_TRUNC(ds_partitioned, month) AS booking__ds_partitioned__month - , DATE_TRUNC(ds_partitioned, quarter) AS booking__ds_partitioned__quarter - , DATE_TRUNC(ds_partitioned, year) AS booking__ds_partitioned__year + , DATETIME_TRUNC(ds_partitioned, day) AS booking__ds_partitioned__day + , DATETIME_TRUNC(ds_partitioned, isoweek) AS booking__ds_partitioned__week + , DATETIME_TRUNC(ds_partitioned, month) AS booking__ds_partitioned__month + , DATETIME_TRUNC(ds_partitioned, quarter) AS booking__ds_partitioned__quarter + , DATETIME_TRUNC(ds_partitioned, year) AS booking__ds_partitioned__year , EXTRACT(year FROM ds_partitioned) AS booking__ds_partitioned__extract_year , EXTRACT(quarter FROM ds_partitioned) AS booking__ds_partitioned__extract_quarter , EXTRACT(month FROM ds_partitioned) AS booking__ds_partitioned__extract_month , EXTRACT(day FROM ds_partitioned) AS booking__ds_partitioned__extract_day , IF(EXTRACT(dayofweek FROM ds_partitioned) = 1, 7, EXTRACT(dayofweek FROM ds_partitioned) - 1) AS booking__ds_partitioned__extract_dow , EXTRACT(dayofyear FROM ds_partitioned) AS booking__ds_partitioned__extract_doy - , DATE_TRUNC(paid_at, day) AS booking__paid_at__day - , DATE_TRUNC(paid_at, isoweek) AS booking__paid_at__week - , DATE_TRUNC(paid_at, month) AS booking__paid_at__month - , DATE_TRUNC(paid_at, quarter) AS booking__paid_at__quarter - , DATE_TRUNC(paid_at, year) AS booking__paid_at__year + , DATETIME_TRUNC(paid_at, day) AS booking__paid_at__day + , DATETIME_TRUNC(paid_at, isoweek) AS booking__paid_at__week + , DATETIME_TRUNC(paid_at, month) AS booking__paid_at__month + , DATETIME_TRUNC(paid_at, quarter) AS booking__paid_at__quarter + , DATETIME_TRUNC(paid_at, year) AS booking__paid_at__year , EXTRACT(year FROM paid_at) AS booking__paid_at__extract_year , EXTRACT(quarter FROM paid_at) AS booking__paid_at__extract_quarter , EXTRACT(month FROM paid_at) AS booking__paid_at__extract_month diff --git a/tests_metricflow/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/BigQuery/test_cumulative_time_offset_metric_with_time_constraint__plan0.sql b/tests_metricflow/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/BigQuery/test_cumulative_time_offset_metric_with_time_constraint__plan0.sql index 0bf3205339..2076a0ccf1 100644 --- a/tests_metricflow/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/BigQuery/test_cumulative_time_offset_metric_with_time_constraint__plan0.sql +++ b/tests_metricflow/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/BigQuery/test_cumulative_time_offset_metric_with_time_constraint__plan0.sql @@ -26,10 +26,10 @@ FROM ( -- Join to Time Spine Dataset SELECT subq_5.metric_time__day AS metric_time__day - , DATE_TRUNC(subq_5.metric_time__day, isoweek) AS metric_time__week - , DATE_TRUNC(subq_5.metric_time__day, month) AS metric_time__month - , DATE_TRUNC(subq_5.metric_time__day, quarter) AS metric_time__quarter - , DATE_TRUNC(subq_5.metric_time__day, year) AS metric_time__year + , DATETIME_TRUNC(subq_5.metric_time__day, isoweek) AS metric_time__week + , DATETIME_TRUNC(subq_5.metric_time__day, month) AS metric_time__month + , DATETIME_TRUNC(subq_5.metric_time__day, quarter) AS metric_time__quarter + , DATETIME_TRUNC(subq_5.metric_time__day, year) AS metric_time__year , EXTRACT(year FROM subq_5.metric_time__day) AS metric_time__extract_year , EXTRACT(quarter FROM subq_5.metric_time__day) AS metric_time__extract_quarter , EXTRACT(month FROM subq_5.metric_time__day) AS metric_time__extract_month @@ -356,33 +356,33 @@ FROM ( , bookings_source_src_28000.booking_value AS approximate_continuous_booking_value_p99 , bookings_source_src_28000.booking_value AS approximate_discrete_booking_value_p99 , bookings_source_src_28000.is_instant - , DATE_TRUNC(bookings_source_src_28000.ds, day) AS ds__day - , DATE_TRUNC(bookings_source_src_28000.ds, isoweek) AS ds__week - , DATE_TRUNC(bookings_source_src_28000.ds, month) AS ds__month - , DATE_TRUNC(bookings_source_src_28000.ds, quarter) AS ds__quarter - , DATE_TRUNC(bookings_source_src_28000.ds, year) AS ds__year + , DATETIME_TRUNC(bookings_source_src_28000.ds, day) AS ds__day + , DATETIME_TRUNC(bookings_source_src_28000.ds, isoweek) AS ds__week + , DATETIME_TRUNC(bookings_source_src_28000.ds, month) AS ds__month + , DATETIME_TRUNC(bookings_source_src_28000.ds, quarter) AS ds__quarter + , DATETIME_TRUNC(bookings_source_src_28000.ds, year) AS ds__year , EXTRACT(year FROM bookings_source_src_28000.ds) AS ds__extract_year , EXTRACT(quarter FROM bookings_source_src_28000.ds) AS ds__extract_quarter , EXTRACT(month FROM bookings_source_src_28000.ds) AS ds__extract_month , EXTRACT(day FROM bookings_source_src_28000.ds) AS ds__extract_day , IF(EXTRACT(dayofweek FROM bookings_source_src_28000.ds) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_28000.ds) - 1) AS ds__extract_dow , EXTRACT(dayofyear FROM bookings_source_src_28000.ds) AS ds__extract_doy - , DATE_TRUNC(bookings_source_src_28000.ds_partitioned, day) AS ds_partitioned__day - , DATE_TRUNC(bookings_source_src_28000.ds_partitioned, isoweek) AS ds_partitioned__week - , DATE_TRUNC(bookings_source_src_28000.ds_partitioned, month) AS ds_partitioned__month - , DATE_TRUNC(bookings_source_src_28000.ds_partitioned, quarter) AS ds_partitioned__quarter - , DATE_TRUNC(bookings_source_src_28000.ds_partitioned, year) AS ds_partitioned__year + , DATETIME_TRUNC(bookings_source_src_28000.ds_partitioned, day) AS ds_partitioned__day + , DATETIME_TRUNC(bookings_source_src_28000.ds_partitioned, isoweek) AS ds_partitioned__week + , DATETIME_TRUNC(bookings_source_src_28000.ds_partitioned, month) AS ds_partitioned__month + , DATETIME_TRUNC(bookings_source_src_28000.ds_partitioned, quarter) AS ds_partitioned__quarter + , DATETIME_TRUNC(bookings_source_src_28000.ds_partitioned, year) AS ds_partitioned__year , EXTRACT(year FROM bookings_source_src_28000.ds_partitioned) AS ds_partitioned__extract_year , EXTRACT(quarter FROM bookings_source_src_28000.ds_partitioned) AS ds_partitioned__extract_quarter , EXTRACT(month FROM bookings_source_src_28000.ds_partitioned) AS ds_partitioned__extract_month , EXTRACT(day FROM bookings_source_src_28000.ds_partitioned) AS ds_partitioned__extract_day , IF(EXTRACT(dayofweek FROM bookings_source_src_28000.ds_partitioned) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_28000.ds_partitioned) - 1) AS ds_partitioned__extract_dow , EXTRACT(dayofyear FROM bookings_source_src_28000.ds_partitioned) AS ds_partitioned__extract_doy - , DATE_TRUNC(bookings_source_src_28000.paid_at, day) AS paid_at__day - , DATE_TRUNC(bookings_source_src_28000.paid_at, isoweek) AS paid_at__week - , DATE_TRUNC(bookings_source_src_28000.paid_at, month) AS paid_at__month - , DATE_TRUNC(bookings_source_src_28000.paid_at, quarter) AS paid_at__quarter - , DATE_TRUNC(bookings_source_src_28000.paid_at, year) AS paid_at__year + , DATETIME_TRUNC(bookings_source_src_28000.paid_at, day) AS paid_at__day + , DATETIME_TRUNC(bookings_source_src_28000.paid_at, isoweek) AS paid_at__week + , DATETIME_TRUNC(bookings_source_src_28000.paid_at, month) AS paid_at__month + , DATETIME_TRUNC(bookings_source_src_28000.paid_at, quarter) AS paid_at__quarter + , DATETIME_TRUNC(bookings_source_src_28000.paid_at, year) AS paid_at__year , EXTRACT(year FROM bookings_source_src_28000.paid_at) AS paid_at__extract_year , EXTRACT(quarter FROM bookings_source_src_28000.paid_at) AS paid_at__extract_quarter , EXTRACT(month FROM bookings_source_src_28000.paid_at) AS paid_at__extract_month @@ -390,33 +390,33 @@ FROM ( , IF(EXTRACT(dayofweek FROM bookings_source_src_28000.paid_at) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_28000.paid_at) - 1) AS paid_at__extract_dow , EXTRACT(dayofyear FROM bookings_source_src_28000.paid_at) AS paid_at__extract_doy , bookings_source_src_28000.is_instant AS booking__is_instant - , DATE_TRUNC(bookings_source_src_28000.ds, day) AS booking__ds__day - , DATE_TRUNC(bookings_source_src_28000.ds, isoweek) AS booking__ds__week - , DATE_TRUNC(bookings_source_src_28000.ds, month) AS booking__ds__month - , DATE_TRUNC(bookings_source_src_28000.ds, quarter) AS booking__ds__quarter - , DATE_TRUNC(bookings_source_src_28000.ds, year) AS booking__ds__year + , DATETIME_TRUNC(bookings_source_src_28000.ds, day) AS booking__ds__day + , DATETIME_TRUNC(bookings_source_src_28000.ds, isoweek) AS booking__ds__week + , DATETIME_TRUNC(bookings_source_src_28000.ds, month) AS booking__ds__month + , DATETIME_TRUNC(bookings_source_src_28000.ds, quarter) AS booking__ds__quarter + , DATETIME_TRUNC(bookings_source_src_28000.ds, year) AS booking__ds__year , EXTRACT(year FROM bookings_source_src_28000.ds) AS booking__ds__extract_year , EXTRACT(quarter FROM bookings_source_src_28000.ds) AS booking__ds__extract_quarter , EXTRACT(month FROM bookings_source_src_28000.ds) AS booking__ds__extract_month , EXTRACT(day FROM bookings_source_src_28000.ds) AS booking__ds__extract_day , IF(EXTRACT(dayofweek FROM bookings_source_src_28000.ds) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_28000.ds) - 1) AS booking__ds__extract_dow , EXTRACT(dayofyear FROM bookings_source_src_28000.ds) AS booking__ds__extract_doy - , DATE_TRUNC(bookings_source_src_28000.ds_partitioned, day) AS booking__ds_partitioned__day - , DATE_TRUNC(bookings_source_src_28000.ds_partitioned, isoweek) AS booking__ds_partitioned__week - , DATE_TRUNC(bookings_source_src_28000.ds_partitioned, month) AS booking__ds_partitioned__month - , DATE_TRUNC(bookings_source_src_28000.ds_partitioned, quarter) AS booking__ds_partitioned__quarter - , DATE_TRUNC(bookings_source_src_28000.ds_partitioned, year) AS booking__ds_partitioned__year + , DATETIME_TRUNC(bookings_source_src_28000.ds_partitioned, day) AS booking__ds_partitioned__day + , DATETIME_TRUNC(bookings_source_src_28000.ds_partitioned, isoweek) AS booking__ds_partitioned__week + , DATETIME_TRUNC(bookings_source_src_28000.ds_partitioned, month) AS booking__ds_partitioned__month + , DATETIME_TRUNC(bookings_source_src_28000.ds_partitioned, quarter) AS booking__ds_partitioned__quarter + , DATETIME_TRUNC(bookings_source_src_28000.ds_partitioned, year) AS booking__ds_partitioned__year , EXTRACT(year FROM bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__extract_year , EXTRACT(quarter FROM bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__extract_quarter , EXTRACT(month FROM bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__extract_month , EXTRACT(day FROM bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__extract_day , IF(EXTRACT(dayofweek FROM bookings_source_src_28000.ds_partitioned) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_28000.ds_partitioned) - 1) AS booking__ds_partitioned__extract_dow , EXTRACT(dayofyear FROM bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__extract_doy - , DATE_TRUNC(bookings_source_src_28000.paid_at, day) AS booking__paid_at__day - , DATE_TRUNC(bookings_source_src_28000.paid_at, isoweek) AS booking__paid_at__week - , DATE_TRUNC(bookings_source_src_28000.paid_at, month) AS booking__paid_at__month - , DATE_TRUNC(bookings_source_src_28000.paid_at, quarter) AS booking__paid_at__quarter - , DATE_TRUNC(bookings_source_src_28000.paid_at, year) AS booking__paid_at__year + , DATETIME_TRUNC(bookings_source_src_28000.paid_at, day) AS booking__paid_at__day + , DATETIME_TRUNC(bookings_source_src_28000.paid_at, isoweek) AS booking__paid_at__week + , DATETIME_TRUNC(bookings_source_src_28000.paid_at, month) AS booking__paid_at__month + , DATETIME_TRUNC(bookings_source_src_28000.paid_at, quarter) AS booking__paid_at__quarter + , DATETIME_TRUNC(bookings_source_src_28000.paid_at, year) AS booking__paid_at__year , EXTRACT(year FROM bookings_source_src_28000.paid_at) AS booking__paid_at__extract_year , EXTRACT(quarter FROM bookings_source_src_28000.paid_at) AS booking__paid_at__extract_quarter , EXTRACT(month FROM bookings_source_src_28000.paid_at) AS booking__paid_at__extract_month diff --git a/tests_metricflow/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/BigQuery/test_cumulative_time_offset_metric_with_time_constraint__plan0_optimized.sql b/tests_metricflow/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/BigQuery/test_cumulative_time_offset_metric_with_time_constraint__plan0_optimized.sql index 22b6f3894b..b50ea33e0f 100644 --- a/tests_metricflow/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/BigQuery/test_cumulative_time_offset_metric_with_time_constraint__plan0_optimized.sql +++ b/tests_metricflow/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/BigQuery/test_cumulative_time_offset_metric_with_time_constraint__plan0_optimized.sql @@ -28,9 +28,9 @@ FROM ( ***************************.fct_bookings bookings_source_src_28000 ON ( - DATE_TRUNC(bookings_source_src_28000.ds, day) <= subq_15.ds + DATETIME_TRUNC(bookings_source_src_28000.ds, day) <= subq_15.ds ) AND ( - DATE_TRUNC(bookings_source_src_28000.ds, day) > DATE_SUB(CAST(subq_15.ds AS DATETIME), INTERVAL 2 day) + DATETIME_TRUNC(bookings_source_src_28000.ds, day) > DATE_SUB(CAST(subq_15.ds AS DATETIME), INTERVAL 2 day) ) ) subq_16 ON diff --git a/tests_metricflow/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/BigQuery/test_derived_metric__plan0.sql b/tests_metricflow/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/BigQuery/test_derived_metric__plan0.sql index ece67a4c44..ecf273f6ed 100644 --- a/tests_metricflow/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/BigQuery/test_derived_metric__plan0.sql +++ b/tests_metricflow/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/BigQuery/test_derived_metric__plan0.sql @@ -142,33 +142,33 @@ FROM ( , bookings_source_src_28000.booking_value AS approximate_continuous_booking_value_p99 , bookings_source_src_28000.booking_value AS approximate_discrete_booking_value_p99 , bookings_source_src_28000.is_instant - , DATE_TRUNC(bookings_source_src_28000.ds, day) AS ds__day - , DATE_TRUNC(bookings_source_src_28000.ds, isoweek) AS ds__week - , DATE_TRUNC(bookings_source_src_28000.ds, month) AS ds__month - , DATE_TRUNC(bookings_source_src_28000.ds, quarter) AS ds__quarter - , DATE_TRUNC(bookings_source_src_28000.ds, year) AS ds__year + , DATETIME_TRUNC(bookings_source_src_28000.ds, day) AS ds__day + , DATETIME_TRUNC(bookings_source_src_28000.ds, isoweek) AS ds__week + , DATETIME_TRUNC(bookings_source_src_28000.ds, month) AS ds__month + , DATETIME_TRUNC(bookings_source_src_28000.ds, quarter) AS ds__quarter + , DATETIME_TRUNC(bookings_source_src_28000.ds, year) AS ds__year , EXTRACT(year FROM bookings_source_src_28000.ds) AS ds__extract_year , EXTRACT(quarter FROM bookings_source_src_28000.ds) AS ds__extract_quarter , EXTRACT(month FROM bookings_source_src_28000.ds) AS ds__extract_month , EXTRACT(day FROM bookings_source_src_28000.ds) AS ds__extract_day , IF(EXTRACT(dayofweek FROM bookings_source_src_28000.ds) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_28000.ds) - 1) AS ds__extract_dow , EXTRACT(dayofyear FROM bookings_source_src_28000.ds) AS ds__extract_doy - , DATE_TRUNC(bookings_source_src_28000.ds_partitioned, day) AS ds_partitioned__day - , DATE_TRUNC(bookings_source_src_28000.ds_partitioned, isoweek) AS ds_partitioned__week - , DATE_TRUNC(bookings_source_src_28000.ds_partitioned, month) AS ds_partitioned__month - , DATE_TRUNC(bookings_source_src_28000.ds_partitioned, quarter) AS ds_partitioned__quarter - , DATE_TRUNC(bookings_source_src_28000.ds_partitioned, year) AS ds_partitioned__year + , DATETIME_TRUNC(bookings_source_src_28000.ds_partitioned, day) AS ds_partitioned__day + , DATETIME_TRUNC(bookings_source_src_28000.ds_partitioned, isoweek) AS ds_partitioned__week + , DATETIME_TRUNC(bookings_source_src_28000.ds_partitioned, month) AS ds_partitioned__month + , DATETIME_TRUNC(bookings_source_src_28000.ds_partitioned, quarter) AS ds_partitioned__quarter + , DATETIME_TRUNC(bookings_source_src_28000.ds_partitioned, year) AS ds_partitioned__year , EXTRACT(year FROM bookings_source_src_28000.ds_partitioned) AS ds_partitioned__extract_year , EXTRACT(quarter FROM bookings_source_src_28000.ds_partitioned) AS ds_partitioned__extract_quarter , EXTRACT(month FROM bookings_source_src_28000.ds_partitioned) AS ds_partitioned__extract_month , EXTRACT(day FROM bookings_source_src_28000.ds_partitioned) AS ds_partitioned__extract_day , IF(EXTRACT(dayofweek FROM bookings_source_src_28000.ds_partitioned) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_28000.ds_partitioned) - 1) AS ds_partitioned__extract_dow , EXTRACT(dayofyear FROM bookings_source_src_28000.ds_partitioned) AS ds_partitioned__extract_doy - , DATE_TRUNC(bookings_source_src_28000.paid_at, day) AS paid_at__day - , DATE_TRUNC(bookings_source_src_28000.paid_at, isoweek) AS paid_at__week - , DATE_TRUNC(bookings_source_src_28000.paid_at, month) AS paid_at__month - , DATE_TRUNC(bookings_source_src_28000.paid_at, quarter) AS paid_at__quarter - , DATE_TRUNC(bookings_source_src_28000.paid_at, year) AS paid_at__year + , DATETIME_TRUNC(bookings_source_src_28000.paid_at, day) AS paid_at__day + , DATETIME_TRUNC(bookings_source_src_28000.paid_at, isoweek) AS paid_at__week + , DATETIME_TRUNC(bookings_source_src_28000.paid_at, month) AS paid_at__month + , DATETIME_TRUNC(bookings_source_src_28000.paid_at, quarter) AS paid_at__quarter + , DATETIME_TRUNC(bookings_source_src_28000.paid_at, year) AS paid_at__year , EXTRACT(year FROM bookings_source_src_28000.paid_at) AS paid_at__extract_year , EXTRACT(quarter FROM bookings_source_src_28000.paid_at) AS paid_at__extract_quarter , EXTRACT(month FROM bookings_source_src_28000.paid_at) AS paid_at__extract_month @@ -176,33 +176,33 @@ FROM ( , IF(EXTRACT(dayofweek FROM bookings_source_src_28000.paid_at) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_28000.paid_at) - 1) AS paid_at__extract_dow , EXTRACT(dayofyear FROM bookings_source_src_28000.paid_at) AS paid_at__extract_doy , bookings_source_src_28000.is_instant AS booking__is_instant - , DATE_TRUNC(bookings_source_src_28000.ds, day) AS booking__ds__day - , DATE_TRUNC(bookings_source_src_28000.ds, isoweek) AS booking__ds__week - , DATE_TRUNC(bookings_source_src_28000.ds, month) AS booking__ds__month - , DATE_TRUNC(bookings_source_src_28000.ds, quarter) AS booking__ds__quarter - , DATE_TRUNC(bookings_source_src_28000.ds, year) AS booking__ds__year + , DATETIME_TRUNC(bookings_source_src_28000.ds, day) AS booking__ds__day + , DATETIME_TRUNC(bookings_source_src_28000.ds, isoweek) AS booking__ds__week + , DATETIME_TRUNC(bookings_source_src_28000.ds, month) AS booking__ds__month + , DATETIME_TRUNC(bookings_source_src_28000.ds, quarter) AS booking__ds__quarter + , DATETIME_TRUNC(bookings_source_src_28000.ds, year) AS booking__ds__year , EXTRACT(year FROM bookings_source_src_28000.ds) AS booking__ds__extract_year , EXTRACT(quarter FROM bookings_source_src_28000.ds) AS booking__ds__extract_quarter , EXTRACT(month FROM bookings_source_src_28000.ds) AS booking__ds__extract_month , EXTRACT(day FROM bookings_source_src_28000.ds) AS booking__ds__extract_day , IF(EXTRACT(dayofweek FROM bookings_source_src_28000.ds) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_28000.ds) - 1) AS booking__ds__extract_dow , EXTRACT(dayofyear FROM bookings_source_src_28000.ds) AS booking__ds__extract_doy - , DATE_TRUNC(bookings_source_src_28000.ds_partitioned, day) AS booking__ds_partitioned__day - , DATE_TRUNC(bookings_source_src_28000.ds_partitioned, isoweek) AS booking__ds_partitioned__week - , DATE_TRUNC(bookings_source_src_28000.ds_partitioned, month) AS booking__ds_partitioned__month - , DATE_TRUNC(bookings_source_src_28000.ds_partitioned, quarter) AS booking__ds_partitioned__quarter - , DATE_TRUNC(bookings_source_src_28000.ds_partitioned, year) AS booking__ds_partitioned__year + , DATETIME_TRUNC(bookings_source_src_28000.ds_partitioned, day) AS booking__ds_partitioned__day + , DATETIME_TRUNC(bookings_source_src_28000.ds_partitioned, isoweek) AS booking__ds_partitioned__week + , DATETIME_TRUNC(bookings_source_src_28000.ds_partitioned, month) AS booking__ds_partitioned__month + , DATETIME_TRUNC(bookings_source_src_28000.ds_partitioned, quarter) AS booking__ds_partitioned__quarter + , DATETIME_TRUNC(bookings_source_src_28000.ds_partitioned, year) AS booking__ds_partitioned__year , EXTRACT(year FROM bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__extract_year , EXTRACT(quarter FROM bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__extract_quarter , EXTRACT(month FROM bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__extract_month , EXTRACT(day FROM bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__extract_day , IF(EXTRACT(dayofweek FROM bookings_source_src_28000.ds_partitioned) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_28000.ds_partitioned) - 1) AS booking__ds_partitioned__extract_dow , EXTRACT(dayofyear FROM bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__extract_doy - , DATE_TRUNC(bookings_source_src_28000.paid_at, day) AS booking__paid_at__day - , DATE_TRUNC(bookings_source_src_28000.paid_at, isoweek) AS booking__paid_at__week - , DATE_TRUNC(bookings_source_src_28000.paid_at, month) AS booking__paid_at__month - , DATE_TRUNC(bookings_source_src_28000.paid_at, quarter) AS booking__paid_at__quarter - , DATE_TRUNC(bookings_source_src_28000.paid_at, year) AS booking__paid_at__year + , DATETIME_TRUNC(bookings_source_src_28000.paid_at, day) AS booking__paid_at__day + , DATETIME_TRUNC(bookings_source_src_28000.paid_at, isoweek) AS booking__paid_at__week + , DATETIME_TRUNC(bookings_source_src_28000.paid_at, month) AS booking__paid_at__month + , DATETIME_TRUNC(bookings_source_src_28000.paid_at, quarter) AS booking__paid_at__quarter + , DATETIME_TRUNC(bookings_source_src_28000.paid_at, year) AS booking__paid_at__year , EXTRACT(year FROM bookings_source_src_28000.paid_at) AS booking__paid_at__extract_year , EXTRACT(quarter FROM bookings_source_src_28000.paid_at) AS booking__paid_at__extract_quarter , EXTRACT(month FROM bookings_source_src_28000.paid_at) AS booking__paid_at__extract_month @@ -357,33 +357,33 @@ FROM ( , bookings_source_src_28000.booking_value AS approximate_continuous_booking_value_p99 , bookings_source_src_28000.booking_value AS approximate_discrete_booking_value_p99 , bookings_source_src_28000.is_instant - , DATE_TRUNC(bookings_source_src_28000.ds, day) AS ds__day - , DATE_TRUNC(bookings_source_src_28000.ds, isoweek) AS ds__week - , DATE_TRUNC(bookings_source_src_28000.ds, month) AS ds__month - , DATE_TRUNC(bookings_source_src_28000.ds, quarter) AS ds__quarter - , DATE_TRUNC(bookings_source_src_28000.ds, year) AS ds__year + , DATETIME_TRUNC(bookings_source_src_28000.ds, day) AS ds__day + , DATETIME_TRUNC(bookings_source_src_28000.ds, isoweek) AS ds__week + , DATETIME_TRUNC(bookings_source_src_28000.ds, month) AS ds__month + , DATETIME_TRUNC(bookings_source_src_28000.ds, quarter) AS ds__quarter + , DATETIME_TRUNC(bookings_source_src_28000.ds, year) AS ds__year , EXTRACT(year FROM bookings_source_src_28000.ds) AS ds__extract_year , EXTRACT(quarter FROM bookings_source_src_28000.ds) AS ds__extract_quarter , EXTRACT(month FROM bookings_source_src_28000.ds) AS ds__extract_month , EXTRACT(day FROM bookings_source_src_28000.ds) AS ds__extract_day , IF(EXTRACT(dayofweek FROM bookings_source_src_28000.ds) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_28000.ds) - 1) AS ds__extract_dow , EXTRACT(dayofyear FROM bookings_source_src_28000.ds) AS ds__extract_doy - , DATE_TRUNC(bookings_source_src_28000.ds_partitioned, day) AS ds_partitioned__day - , DATE_TRUNC(bookings_source_src_28000.ds_partitioned, isoweek) AS ds_partitioned__week - , DATE_TRUNC(bookings_source_src_28000.ds_partitioned, month) AS ds_partitioned__month - , DATE_TRUNC(bookings_source_src_28000.ds_partitioned, quarter) AS ds_partitioned__quarter - , DATE_TRUNC(bookings_source_src_28000.ds_partitioned, year) AS ds_partitioned__year + , DATETIME_TRUNC(bookings_source_src_28000.ds_partitioned, day) AS ds_partitioned__day + , DATETIME_TRUNC(bookings_source_src_28000.ds_partitioned, isoweek) AS ds_partitioned__week + , DATETIME_TRUNC(bookings_source_src_28000.ds_partitioned, month) AS ds_partitioned__month + , DATETIME_TRUNC(bookings_source_src_28000.ds_partitioned, quarter) AS ds_partitioned__quarter + , DATETIME_TRUNC(bookings_source_src_28000.ds_partitioned, year) AS ds_partitioned__year , EXTRACT(year FROM bookings_source_src_28000.ds_partitioned) AS ds_partitioned__extract_year , EXTRACT(quarter FROM bookings_source_src_28000.ds_partitioned) AS ds_partitioned__extract_quarter , EXTRACT(month FROM bookings_source_src_28000.ds_partitioned) AS ds_partitioned__extract_month , EXTRACT(day FROM bookings_source_src_28000.ds_partitioned) AS ds_partitioned__extract_day , IF(EXTRACT(dayofweek FROM bookings_source_src_28000.ds_partitioned) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_28000.ds_partitioned) - 1) AS ds_partitioned__extract_dow , EXTRACT(dayofyear FROM bookings_source_src_28000.ds_partitioned) AS ds_partitioned__extract_doy - , DATE_TRUNC(bookings_source_src_28000.paid_at, day) AS paid_at__day - , DATE_TRUNC(bookings_source_src_28000.paid_at, isoweek) AS paid_at__week - , DATE_TRUNC(bookings_source_src_28000.paid_at, month) AS paid_at__month - , DATE_TRUNC(bookings_source_src_28000.paid_at, quarter) AS paid_at__quarter - , DATE_TRUNC(bookings_source_src_28000.paid_at, year) AS paid_at__year + , DATETIME_TRUNC(bookings_source_src_28000.paid_at, day) AS paid_at__day + , DATETIME_TRUNC(bookings_source_src_28000.paid_at, isoweek) AS paid_at__week + , DATETIME_TRUNC(bookings_source_src_28000.paid_at, month) AS paid_at__month + , DATETIME_TRUNC(bookings_source_src_28000.paid_at, quarter) AS paid_at__quarter + , DATETIME_TRUNC(bookings_source_src_28000.paid_at, year) AS paid_at__year , EXTRACT(year FROM bookings_source_src_28000.paid_at) AS paid_at__extract_year , EXTRACT(quarter FROM bookings_source_src_28000.paid_at) AS paid_at__extract_quarter , EXTRACT(month FROM bookings_source_src_28000.paid_at) AS paid_at__extract_month @@ -391,33 +391,33 @@ FROM ( , IF(EXTRACT(dayofweek FROM bookings_source_src_28000.paid_at) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_28000.paid_at) - 1) AS paid_at__extract_dow , EXTRACT(dayofyear FROM bookings_source_src_28000.paid_at) AS paid_at__extract_doy , bookings_source_src_28000.is_instant AS booking__is_instant - , DATE_TRUNC(bookings_source_src_28000.ds, day) AS booking__ds__day - , DATE_TRUNC(bookings_source_src_28000.ds, isoweek) AS booking__ds__week - , DATE_TRUNC(bookings_source_src_28000.ds, month) AS booking__ds__month - , DATE_TRUNC(bookings_source_src_28000.ds, quarter) AS booking__ds__quarter - , DATE_TRUNC(bookings_source_src_28000.ds, year) AS booking__ds__year + , DATETIME_TRUNC(bookings_source_src_28000.ds, day) AS booking__ds__day + , DATETIME_TRUNC(bookings_source_src_28000.ds, isoweek) AS booking__ds__week + , DATETIME_TRUNC(bookings_source_src_28000.ds, month) AS booking__ds__month + , DATETIME_TRUNC(bookings_source_src_28000.ds, quarter) AS booking__ds__quarter + , DATETIME_TRUNC(bookings_source_src_28000.ds, year) AS booking__ds__year , EXTRACT(year FROM bookings_source_src_28000.ds) AS booking__ds__extract_year , EXTRACT(quarter FROM bookings_source_src_28000.ds) AS booking__ds__extract_quarter , EXTRACT(month FROM bookings_source_src_28000.ds) AS booking__ds__extract_month , EXTRACT(day FROM bookings_source_src_28000.ds) AS booking__ds__extract_day , IF(EXTRACT(dayofweek FROM bookings_source_src_28000.ds) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_28000.ds) - 1) AS booking__ds__extract_dow , EXTRACT(dayofyear FROM bookings_source_src_28000.ds) AS booking__ds__extract_doy - , DATE_TRUNC(bookings_source_src_28000.ds_partitioned, day) AS booking__ds_partitioned__day - , DATE_TRUNC(bookings_source_src_28000.ds_partitioned, isoweek) AS booking__ds_partitioned__week - , DATE_TRUNC(bookings_source_src_28000.ds_partitioned, month) AS booking__ds_partitioned__month - , DATE_TRUNC(bookings_source_src_28000.ds_partitioned, quarter) AS booking__ds_partitioned__quarter - , DATE_TRUNC(bookings_source_src_28000.ds_partitioned, year) AS booking__ds_partitioned__year + , DATETIME_TRUNC(bookings_source_src_28000.ds_partitioned, day) AS booking__ds_partitioned__day + , DATETIME_TRUNC(bookings_source_src_28000.ds_partitioned, isoweek) AS booking__ds_partitioned__week + , DATETIME_TRUNC(bookings_source_src_28000.ds_partitioned, month) AS booking__ds_partitioned__month + , DATETIME_TRUNC(bookings_source_src_28000.ds_partitioned, quarter) AS booking__ds_partitioned__quarter + , DATETIME_TRUNC(bookings_source_src_28000.ds_partitioned, year) AS booking__ds_partitioned__year , EXTRACT(year FROM bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__extract_year , EXTRACT(quarter FROM bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__extract_quarter , EXTRACT(month FROM bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__extract_month , EXTRACT(day FROM bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__extract_day , IF(EXTRACT(dayofweek FROM bookings_source_src_28000.ds_partitioned) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_28000.ds_partitioned) - 1) AS booking__ds_partitioned__extract_dow , EXTRACT(dayofyear FROM bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__extract_doy - , DATE_TRUNC(bookings_source_src_28000.paid_at, day) AS booking__paid_at__day - , DATE_TRUNC(bookings_source_src_28000.paid_at, isoweek) AS booking__paid_at__week - , DATE_TRUNC(bookings_source_src_28000.paid_at, month) AS booking__paid_at__month - , DATE_TRUNC(bookings_source_src_28000.paid_at, quarter) AS booking__paid_at__quarter - , DATE_TRUNC(bookings_source_src_28000.paid_at, year) AS booking__paid_at__year + , DATETIME_TRUNC(bookings_source_src_28000.paid_at, day) AS booking__paid_at__day + , DATETIME_TRUNC(bookings_source_src_28000.paid_at, isoweek) AS booking__paid_at__week + , DATETIME_TRUNC(bookings_source_src_28000.paid_at, month) AS booking__paid_at__month + , DATETIME_TRUNC(bookings_source_src_28000.paid_at, quarter) AS booking__paid_at__quarter + , DATETIME_TRUNC(bookings_source_src_28000.paid_at, year) AS booking__paid_at__year , EXTRACT(year FROM bookings_source_src_28000.paid_at) AS booking__paid_at__extract_year , EXTRACT(quarter FROM bookings_source_src_28000.paid_at) AS booking__paid_at__extract_quarter , EXTRACT(month FROM bookings_source_src_28000.paid_at) AS booking__paid_at__extract_month diff --git a/tests_metricflow/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/BigQuery/test_derived_metric__plan0_optimized.sql b/tests_metricflow/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/BigQuery/test_derived_metric__plan0_optimized.sql index 09c4b8dbd9..861ffcc1e5 100644 --- a/tests_metricflow/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/BigQuery/test_derived_metric__plan0_optimized.sql +++ b/tests_metricflow/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/BigQuery/test_derived_metric__plan0_optimized.sql @@ -19,7 +19,7 @@ FROM ( -- Metric Time Dimension 'ds' -- Pass Only Elements: ['referred_bookings', 'metric_time__day'] SELECT - DATE_TRUNC(ds, day) AS metric_time__day + DATETIME_TRUNC(ds, day) AS metric_time__day , CASE WHEN referrer_id IS NOT NULL THEN 1 ELSE 0 END AS referred_bookings FROM ***************************.fct_bookings bookings_source_src_28000 ) subq_13 @@ -37,7 +37,7 @@ FROM ( -- Metric Time Dimension 'ds' -- Pass Only Elements: ['bookings', 'metric_time__day'] SELECT - DATE_TRUNC(ds, day) AS metric_time__day + DATETIME_TRUNC(ds, day) AS metric_time__day , 1 AS bookings FROM ***************************.fct_bookings bookings_source_src_28000 ) subq_18 diff --git a/tests_metricflow/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/BigQuery/test_derived_metric_with_month_dimension_and_offset_window__plan0.sql b/tests_metricflow/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/BigQuery/test_derived_metric_with_month_dimension_and_offset_window__plan0.sql index 696bb8b6fa..3a5f4679e3 100644 --- a/tests_metricflow/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/BigQuery/test_derived_metric_with_month_dimension_and_offset_window__plan0.sql +++ b/tests_metricflow/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/BigQuery/test_derived_metric_with_month_dimension_and_offset_window__plan0.sql @@ -21,8 +21,8 @@ FROM ( -- Join to Time Spine Dataset SELECT subq_2.metric_time__month AS metric_time__month - , DATE_TRUNC(subq_2.metric_time__month, quarter) AS metric_time__quarter - , DATE_TRUNC(subq_2.metric_time__month, year) AS metric_time__year + , DATETIME_TRUNC(subq_2.metric_time__month, quarter) AS metric_time__quarter + , DATETIME_TRUNC(subq_2.metric_time__month, year) AS metric_time__year , EXTRACT(year FROM subq_2.metric_time__month) AS metric_time__extract_year , EXTRACT(quarter FROM subq_2.metric_time__month) AS metric_time__extract_quarter , EXTRACT(month FROM subq_2.metric_time__month) AS metric_time__extract_month @@ -44,7 +44,7 @@ FROM ( FROM ( -- Time Spine SELECT - DATE_TRUNC(subq_3.ds, month) AS metric_time__month + DATETIME_TRUNC(subq_3.ds, month) AS metric_time__month FROM ***************************.mf_time_spine subq_3 GROUP BY metric_time__month @@ -77,15 +77,15 @@ FROM ( -- Read Elements From Semantic Model 'bookings_monthly_source' SELECT bookings_monthly_source_src_16000.bookings_monthly - , DATE_TRUNC(bookings_monthly_source_src_16000.ds, month) AS monthly_ds__month - , DATE_TRUNC(bookings_monthly_source_src_16000.ds, quarter) AS monthly_ds__quarter - , DATE_TRUNC(bookings_monthly_source_src_16000.ds, year) AS monthly_ds__year + , DATETIME_TRUNC(bookings_monthly_source_src_16000.ds, month) AS monthly_ds__month + , DATETIME_TRUNC(bookings_monthly_source_src_16000.ds, quarter) AS monthly_ds__quarter + , DATETIME_TRUNC(bookings_monthly_source_src_16000.ds, year) AS monthly_ds__year , EXTRACT(year FROM bookings_monthly_source_src_16000.ds) AS monthly_ds__extract_year , EXTRACT(quarter FROM bookings_monthly_source_src_16000.ds) AS monthly_ds__extract_quarter , EXTRACT(month FROM bookings_monthly_source_src_16000.ds) AS monthly_ds__extract_month - , DATE_TRUNC(bookings_monthly_source_src_16000.ds, month) AS booking__monthly_ds__month - , DATE_TRUNC(bookings_monthly_source_src_16000.ds, quarter) AS booking__monthly_ds__quarter - , DATE_TRUNC(bookings_monthly_source_src_16000.ds, year) AS booking__monthly_ds__year + , DATETIME_TRUNC(bookings_monthly_source_src_16000.ds, month) AS booking__monthly_ds__month + , DATETIME_TRUNC(bookings_monthly_source_src_16000.ds, quarter) AS booking__monthly_ds__quarter + , DATETIME_TRUNC(bookings_monthly_source_src_16000.ds, year) AS booking__monthly_ds__year , EXTRACT(year FROM bookings_monthly_source_src_16000.ds) AS booking__monthly_ds__extract_year , EXTRACT(quarter FROM bookings_monthly_source_src_16000.ds) AS booking__monthly_ds__extract_quarter , EXTRACT(month FROM bookings_monthly_source_src_16000.ds) AS booking__monthly_ds__extract_month diff --git a/tests_metricflow/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/BigQuery/test_derived_metric_with_month_dimension_and_offset_window__plan0_optimized.sql b/tests_metricflow/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/BigQuery/test_derived_metric_with_month_dimension_and_offset_window__plan0_optimized.sql index 5d3bd940a3..2c527ca57a 100644 --- a/tests_metricflow/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/BigQuery/test_derived_metric_with_month_dimension_and_offset_window__plan0_optimized.sql +++ b/tests_metricflow/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/BigQuery/test_derived_metric_with_month_dimension_and_offset_window__plan0_optimized.sql @@ -13,7 +13,7 @@ FROM ( FROM ( -- Time Spine SELECT - DATE_TRUNC(ds, month) AS metric_time__month + DATETIME_TRUNC(ds, month) AS metric_time__month FROM ***************************.mf_time_spine subq_11 GROUP BY metric_time__month @@ -21,7 +21,7 @@ FROM ( INNER JOIN ***************************.fct_bookings_extended_monthly bookings_monthly_source_src_16000 ON - DATE_SUB(CAST(subq_10.metric_time__month AS DATETIME), INTERVAL 1 month) = DATE_TRUNC(bookings_monthly_source_src_16000.ds, month) + DATE_SUB(CAST(subq_10.metric_time__month AS DATETIME), INTERVAL 1 month) = DATETIME_TRUNC(bookings_monthly_source_src_16000.ds, month) GROUP BY metric_time__month ) subq_15 diff --git a/tests_metricflow/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/BigQuery/test_derived_metric_with_offset_to_grain__plan0.sql b/tests_metricflow/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/BigQuery/test_derived_metric_with_offset_to_grain__plan0.sql index a66e9f254c..75aba4803b 100644 --- a/tests_metricflow/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/BigQuery/test_derived_metric_with_offset_to_grain__plan0.sql +++ b/tests_metricflow/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/BigQuery/test_derived_metric_with_offset_to_grain__plan0.sql @@ -142,33 +142,33 @@ FROM ( , bookings_source_src_28000.booking_value AS approximate_continuous_booking_value_p99 , bookings_source_src_28000.booking_value AS approximate_discrete_booking_value_p99 , bookings_source_src_28000.is_instant - , DATE_TRUNC(bookings_source_src_28000.ds, day) AS ds__day - , DATE_TRUNC(bookings_source_src_28000.ds, isoweek) AS ds__week - , DATE_TRUNC(bookings_source_src_28000.ds, month) AS ds__month - , DATE_TRUNC(bookings_source_src_28000.ds, quarter) AS ds__quarter - , DATE_TRUNC(bookings_source_src_28000.ds, year) AS ds__year + , DATETIME_TRUNC(bookings_source_src_28000.ds, day) AS ds__day + , DATETIME_TRUNC(bookings_source_src_28000.ds, isoweek) AS ds__week + , DATETIME_TRUNC(bookings_source_src_28000.ds, month) AS ds__month + , DATETIME_TRUNC(bookings_source_src_28000.ds, quarter) AS ds__quarter + , DATETIME_TRUNC(bookings_source_src_28000.ds, year) AS ds__year , EXTRACT(year FROM bookings_source_src_28000.ds) AS ds__extract_year , EXTRACT(quarter FROM bookings_source_src_28000.ds) AS ds__extract_quarter , EXTRACT(month FROM bookings_source_src_28000.ds) AS ds__extract_month , EXTRACT(day FROM bookings_source_src_28000.ds) AS ds__extract_day , IF(EXTRACT(dayofweek FROM bookings_source_src_28000.ds) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_28000.ds) - 1) AS ds__extract_dow , EXTRACT(dayofyear FROM bookings_source_src_28000.ds) AS ds__extract_doy - , DATE_TRUNC(bookings_source_src_28000.ds_partitioned, day) AS ds_partitioned__day - , DATE_TRUNC(bookings_source_src_28000.ds_partitioned, isoweek) AS ds_partitioned__week - , DATE_TRUNC(bookings_source_src_28000.ds_partitioned, month) AS ds_partitioned__month - , DATE_TRUNC(bookings_source_src_28000.ds_partitioned, quarter) AS ds_partitioned__quarter - , DATE_TRUNC(bookings_source_src_28000.ds_partitioned, year) AS ds_partitioned__year + , DATETIME_TRUNC(bookings_source_src_28000.ds_partitioned, day) AS ds_partitioned__day + , DATETIME_TRUNC(bookings_source_src_28000.ds_partitioned, isoweek) AS ds_partitioned__week + , DATETIME_TRUNC(bookings_source_src_28000.ds_partitioned, month) AS ds_partitioned__month + , DATETIME_TRUNC(bookings_source_src_28000.ds_partitioned, quarter) AS ds_partitioned__quarter + , DATETIME_TRUNC(bookings_source_src_28000.ds_partitioned, year) AS ds_partitioned__year , EXTRACT(year FROM bookings_source_src_28000.ds_partitioned) AS ds_partitioned__extract_year , EXTRACT(quarter FROM bookings_source_src_28000.ds_partitioned) AS ds_partitioned__extract_quarter , EXTRACT(month FROM bookings_source_src_28000.ds_partitioned) AS ds_partitioned__extract_month , EXTRACT(day FROM bookings_source_src_28000.ds_partitioned) AS ds_partitioned__extract_day , IF(EXTRACT(dayofweek FROM bookings_source_src_28000.ds_partitioned) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_28000.ds_partitioned) - 1) AS ds_partitioned__extract_dow , EXTRACT(dayofyear FROM bookings_source_src_28000.ds_partitioned) AS ds_partitioned__extract_doy - , DATE_TRUNC(bookings_source_src_28000.paid_at, day) AS paid_at__day - , DATE_TRUNC(bookings_source_src_28000.paid_at, isoweek) AS paid_at__week - , DATE_TRUNC(bookings_source_src_28000.paid_at, month) AS paid_at__month - , DATE_TRUNC(bookings_source_src_28000.paid_at, quarter) AS paid_at__quarter - , DATE_TRUNC(bookings_source_src_28000.paid_at, year) AS paid_at__year + , DATETIME_TRUNC(bookings_source_src_28000.paid_at, day) AS paid_at__day + , DATETIME_TRUNC(bookings_source_src_28000.paid_at, isoweek) AS paid_at__week + , DATETIME_TRUNC(bookings_source_src_28000.paid_at, month) AS paid_at__month + , DATETIME_TRUNC(bookings_source_src_28000.paid_at, quarter) AS paid_at__quarter + , DATETIME_TRUNC(bookings_source_src_28000.paid_at, year) AS paid_at__year , EXTRACT(year FROM bookings_source_src_28000.paid_at) AS paid_at__extract_year , EXTRACT(quarter FROM bookings_source_src_28000.paid_at) AS paid_at__extract_quarter , EXTRACT(month FROM bookings_source_src_28000.paid_at) AS paid_at__extract_month @@ -176,33 +176,33 @@ FROM ( , IF(EXTRACT(dayofweek FROM bookings_source_src_28000.paid_at) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_28000.paid_at) - 1) AS paid_at__extract_dow , EXTRACT(dayofyear FROM bookings_source_src_28000.paid_at) AS paid_at__extract_doy , bookings_source_src_28000.is_instant AS booking__is_instant - , DATE_TRUNC(bookings_source_src_28000.ds, day) AS booking__ds__day - , DATE_TRUNC(bookings_source_src_28000.ds, isoweek) AS booking__ds__week - , DATE_TRUNC(bookings_source_src_28000.ds, month) AS booking__ds__month - , DATE_TRUNC(bookings_source_src_28000.ds, quarter) AS booking__ds__quarter - , DATE_TRUNC(bookings_source_src_28000.ds, year) AS booking__ds__year + , DATETIME_TRUNC(bookings_source_src_28000.ds, day) AS booking__ds__day + , DATETIME_TRUNC(bookings_source_src_28000.ds, isoweek) AS booking__ds__week + , DATETIME_TRUNC(bookings_source_src_28000.ds, month) AS booking__ds__month + , DATETIME_TRUNC(bookings_source_src_28000.ds, quarter) AS booking__ds__quarter + , DATETIME_TRUNC(bookings_source_src_28000.ds, year) AS booking__ds__year , EXTRACT(year FROM bookings_source_src_28000.ds) AS booking__ds__extract_year , EXTRACT(quarter FROM bookings_source_src_28000.ds) AS booking__ds__extract_quarter , EXTRACT(month FROM bookings_source_src_28000.ds) AS booking__ds__extract_month , EXTRACT(day FROM bookings_source_src_28000.ds) AS booking__ds__extract_day , IF(EXTRACT(dayofweek FROM bookings_source_src_28000.ds) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_28000.ds) - 1) AS booking__ds__extract_dow , EXTRACT(dayofyear FROM bookings_source_src_28000.ds) AS booking__ds__extract_doy - , DATE_TRUNC(bookings_source_src_28000.ds_partitioned, day) AS booking__ds_partitioned__day - , DATE_TRUNC(bookings_source_src_28000.ds_partitioned, isoweek) AS booking__ds_partitioned__week - , DATE_TRUNC(bookings_source_src_28000.ds_partitioned, month) AS booking__ds_partitioned__month - , DATE_TRUNC(bookings_source_src_28000.ds_partitioned, quarter) AS booking__ds_partitioned__quarter - , DATE_TRUNC(bookings_source_src_28000.ds_partitioned, year) AS booking__ds_partitioned__year + , DATETIME_TRUNC(bookings_source_src_28000.ds_partitioned, day) AS booking__ds_partitioned__day + , DATETIME_TRUNC(bookings_source_src_28000.ds_partitioned, isoweek) AS booking__ds_partitioned__week + , DATETIME_TRUNC(bookings_source_src_28000.ds_partitioned, month) AS booking__ds_partitioned__month + , DATETIME_TRUNC(bookings_source_src_28000.ds_partitioned, quarter) AS booking__ds_partitioned__quarter + , DATETIME_TRUNC(bookings_source_src_28000.ds_partitioned, year) AS booking__ds_partitioned__year , EXTRACT(year FROM bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__extract_year , EXTRACT(quarter FROM bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__extract_quarter , EXTRACT(month FROM bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__extract_month , EXTRACT(day FROM bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__extract_day , IF(EXTRACT(dayofweek FROM bookings_source_src_28000.ds_partitioned) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_28000.ds_partitioned) - 1) AS booking__ds_partitioned__extract_dow , EXTRACT(dayofyear FROM bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__extract_doy - , DATE_TRUNC(bookings_source_src_28000.paid_at, day) AS booking__paid_at__day - , DATE_TRUNC(bookings_source_src_28000.paid_at, isoweek) AS booking__paid_at__week - , DATE_TRUNC(bookings_source_src_28000.paid_at, month) AS booking__paid_at__month - , DATE_TRUNC(bookings_source_src_28000.paid_at, quarter) AS booking__paid_at__quarter - , DATE_TRUNC(bookings_source_src_28000.paid_at, year) AS booking__paid_at__year + , DATETIME_TRUNC(bookings_source_src_28000.paid_at, day) AS booking__paid_at__day + , DATETIME_TRUNC(bookings_source_src_28000.paid_at, isoweek) AS booking__paid_at__week + , DATETIME_TRUNC(bookings_source_src_28000.paid_at, month) AS booking__paid_at__month + , DATETIME_TRUNC(bookings_source_src_28000.paid_at, quarter) AS booking__paid_at__quarter + , DATETIME_TRUNC(bookings_source_src_28000.paid_at, year) AS booking__paid_at__year , EXTRACT(year FROM bookings_source_src_28000.paid_at) AS booking__paid_at__extract_year , EXTRACT(quarter FROM bookings_source_src_28000.paid_at) AS booking__paid_at__extract_quarter , EXTRACT(month FROM bookings_source_src_28000.paid_at) AS booking__paid_at__extract_month @@ -242,10 +242,10 @@ FROM ( -- Join to Time Spine Dataset SELECT subq_7.metric_time__day AS metric_time__day - , DATE_TRUNC(subq_7.metric_time__day, isoweek) AS metric_time__week - , DATE_TRUNC(subq_7.metric_time__day, month) AS metric_time__month - , DATE_TRUNC(subq_7.metric_time__day, quarter) AS metric_time__quarter - , DATE_TRUNC(subq_7.metric_time__day, year) AS metric_time__year + , DATETIME_TRUNC(subq_7.metric_time__day, isoweek) AS metric_time__week + , DATETIME_TRUNC(subq_7.metric_time__day, month) AS metric_time__month + , DATETIME_TRUNC(subq_7.metric_time__day, quarter) AS metric_time__quarter + , DATETIME_TRUNC(subq_7.metric_time__day, year) AS metric_time__year , EXTRACT(year FROM subq_7.metric_time__day) AS metric_time__extract_year , EXTRACT(quarter FROM subq_7.metric_time__day) AS metric_time__extract_quarter , EXTRACT(month FROM subq_7.metric_time__day) AS metric_time__extract_month @@ -464,33 +464,33 @@ FROM ( , bookings_source_src_28000.booking_value AS approximate_continuous_booking_value_p99 , bookings_source_src_28000.booking_value AS approximate_discrete_booking_value_p99 , bookings_source_src_28000.is_instant - , DATE_TRUNC(bookings_source_src_28000.ds, day) AS ds__day - , DATE_TRUNC(bookings_source_src_28000.ds, isoweek) AS ds__week - , DATE_TRUNC(bookings_source_src_28000.ds, month) AS ds__month - , DATE_TRUNC(bookings_source_src_28000.ds, quarter) AS ds__quarter - , DATE_TRUNC(bookings_source_src_28000.ds, year) AS ds__year + , DATETIME_TRUNC(bookings_source_src_28000.ds, day) AS ds__day + , DATETIME_TRUNC(bookings_source_src_28000.ds, isoweek) AS ds__week + , DATETIME_TRUNC(bookings_source_src_28000.ds, month) AS ds__month + , DATETIME_TRUNC(bookings_source_src_28000.ds, quarter) AS ds__quarter + , DATETIME_TRUNC(bookings_source_src_28000.ds, year) AS ds__year , EXTRACT(year FROM bookings_source_src_28000.ds) AS ds__extract_year , EXTRACT(quarter FROM bookings_source_src_28000.ds) AS ds__extract_quarter , EXTRACT(month FROM bookings_source_src_28000.ds) AS ds__extract_month , EXTRACT(day FROM bookings_source_src_28000.ds) AS ds__extract_day , IF(EXTRACT(dayofweek FROM bookings_source_src_28000.ds) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_28000.ds) - 1) AS ds__extract_dow , EXTRACT(dayofyear FROM bookings_source_src_28000.ds) AS ds__extract_doy - , DATE_TRUNC(bookings_source_src_28000.ds_partitioned, day) AS ds_partitioned__day - , DATE_TRUNC(bookings_source_src_28000.ds_partitioned, isoweek) AS ds_partitioned__week - , DATE_TRUNC(bookings_source_src_28000.ds_partitioned, month) AS ds_partitioned__month - , DATE_TRUNC(bookings_source_src_28000.ds_partitioned, quarter) AS ds_partitioned__quarter - , DATE_TRUNC(bookings_source_src_28000.ds_partitioned, year) AS ds_partitioned__year + , DATETIME_TRUNC(bookings_source_src_28000.ds_partitioned, day) AS ds_partitioned__day + , DATETIME_TRUNC(bookings_source_src_28000.ds_partitioned, isoweek) AS ds_partitioned__week + , DATETIME_TRUNC(bookings_source_src_28000.ds_partitioned, month) AS ds_partitioned__month + , DATETIME_TRUNC(bookings_source_src_28000.ds_partitioned, quarter) AS ds_partitioned__quarter + , DATETIME_TRUNC(bookings_source_src_28000.ds_partitioned, year) AS ds_partitioned__year , EXTRACT(year FROM bookings_source_src_28000.ds_partitioned) AS ds_partitioned__extract_year , EXTRACT(quarter FROM bookings_source_src_28000.ds_partitioned) AS ds_partitioned__extract_quarter , EXTRACT(month FROM bookings_source_src_28000.ds_partitioned) AS ds_partitioned__extract_month , EXTRACT(day FROM bookings_source_src_28000.ds_partitioned) AS ds_partitioned__extract_day , IF(EXTRACT(dayofweek FROM bookings_source_src_28000.ds_partitioned) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_28000.ds_partitioned) - 1) AS ds_partitioned__extract_dow , EXTRACT(dayofyear FROM bookings_source_src_28000.ds_partitioned) AS ds_partitioned__extract_doy - , DATE_TRUNC(bookings_source_src_28000.paid_at, day) AS paid_at__day - , DATE_TRUNC(bookings_source_src_28000.paid_at, isoweek) AS paid_at__week - , DATE_TRUNC(bookings_source_src_28000.paid_at, month) AS paid_at__month - , DATE_TRUNC(bookings_source_src_28000.paid_at, quarter) AS paid_at__quarter - , DATE_TRUNC(bookings_source_src_28000.paid_at, year) AS paid_at__year + , DATETIME_TRUNC(bookings_source_src_28000.paid_at, day) AS paid_at__day + , DATETIME_TRUNC(bookings_source_src_28000.paid_at, isoweek) AS paid_at__week + , DATETIME_TRUNC(bookings_source_src_28000.paid_at, month) AS paid_at__month + , DATETIME_TRUNC(bookings_source_src_28000.paid_at, quarter) AS paid_at__quarter + , DATETIME_TRUNC(bookings_source_src_28000.paid_at, year) AS paid_at__year , EXTRACT(year FROM bookings_source_src_28000.paid_at) AS paid_at__extract_year , EXTRACT(quarter FROM bookings_source_src_28000.paid_at) AS paid_at__extract_quarter , EXTRACT(month FROM bookings_source_src_28000.paid_at) AS paid_at__extract_month @@ -498,33 +498,33 @@ FROM ( , IF(EXTRACT(dayofweek FROM bookings_source_src_28000.paid_at) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_28000.paid_at) - 1) AS paid_at__extract_dow , EXTRACT(dayofyear FROM bookings_source_src_28000.paid_at) AS paid_at__extract_doy , bookings_source_src_28000.is_instant AS booking__is_instant - , DATE_TRUNC(bookings_source_src_28000.ds, day) AS booking__ds__day - , DATE_TRUNC(bookings_source_src_28000.ds, isoweek) AS booking__ds__week - , DATE_TRUNC(bookings_source_src_28000.ds, month) AS booking__ds__month - , DATE_TRUNC(bookings_source_src_28000.ds, quarter) AS booking__ds__quarter - , DATE_TRUNC(bookings_source_src_28000.ds, year) AS booking__ds__year + , DATETIME_TRUNC(bookings_source_src_28000.ds, day) AS booking__ds__day + , DATETIME_TRUNC(bookings_source_src_28000.ds, isoweek) AS booking__ds__week + , DATETIME_TRUNC(bookings_source_src_28000.ds, month) AS booking__ds__month + , DATETIME_TRUNC(bookings_source_src_28000.ds, quarter) AS booking__ds__quarter + , DATETIME_TRUNC(bookings_source_src_28000.ds, year) AS booking__ds__year , EXTRACT(year FROM bookings_source_src_28000.ds) AS booking__ds__extract_year , EXTRACT(quarter FROM bookings_source_src_28000.ds) AS booking__ds__extract_quarter , EXTRACT(month FROM bookings_source_src_28000.ds) AS booking__ds__extract_month , EXTRACT(day FROM bookings_source_src_28000.ds) AS booking__ds__extract_day , IF(EXTRACT(dayofweek FROM bookings_source_src_28000.ds) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_28000.ds) - 1) AS booking__ds__extract_dow , EXTRACT(dayofyear FROM bookings_source_src_28000.ds) AS booking__ds__extract_doy - , DATE_TRUNC(bookings_source_src_28000.ds_partitioned, day) AS booking__ds_partitioned__day - , DATE_TRUNC(bookings_source_src_28000.ds_partitioned, isoweek) AS booking__ds_partitioned__week - , DATE_TRUNC(bookings_source_src_28000.ds_partitioned, month) AS booking__ds_partitioned__month - , DATE_TRUNC(bookings_source_src_28000.ds_partitioned, quarter) AS booking__ds_partitioned__quarter - , DATE_TRUNC(bookings_source_src_28000.ds_partitioned, year) AS booking__ds_partitioned__year + , DATETIME_TRUNC(bookings_source_src_28000.ds_partitioned, day) AS booking__ds_partitioned__day + , DATETIME_TRUNC(bookings_source_src_28000.ds_partitioned, isoweek) AS booking__ds_partitioned__week + , DATETIME_TRUNC(bookings_source_src_28000.ds_partitioned, month) AS booking__ds_partitioned__month + , DATETIME_TRUNC(bookings_source_src_28000.ds_partitioned, quarter) AS booking__ds_partitioned__quarter + , DATETIME_TRUNC(bookings_source_src_28000.ds_partitioned, year) AS booking__ds_partitioned__year , EXTRACT(year FROM bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__extract_year , EXTRACT(quarter FROM bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__extract_quarter , EXTRACT(month FROM bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__extract_month , EXTRACT(day FROM bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__extract_day , IF(EXTRACT(dayofweek FROM bookings_source_src_28000.ds_partitioned) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_28000.ds_partitioned) - 1) AS booking__ds_partitioned__extract_dow , EXTRACT(dayofyear FROM bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__extract_doy - , DATE_TRUNC(bookings_source_src_28000.paid_at, day) AS booking__paid_at__day - , DATE_TRUNC(bookings_source_src_28000.paid_at, isoweek) AS booking__paid_at__week - , DATE_TRUNC(bookings_source_src_28000.paid_at, month) AS booking__paid_at__month - , DATE_TRUNC(bookings_source_src_28000.paid_at, quarter) AS booking__paid_at__quarter - , DATE_TRUNC(bookings_source_src_28000.paid_at, year) AS booking__paid_at__year + , DATETIME_TRUNC(bookings_source_src_28000.paid_at, day) AS booking__paid_at__day + , DATETIME_TRUNC(bookings_source_src_28000.paid_at, isoweek) AS booking__paid_at__week + , DATETIME_TRUNC(bookings_source_src_28000.paid_at, month) AS booking__paid_at__month + , DATETIME_TRUNC(bookings_source_src_28000.paid_at, quarter) AS booking__paid_at__quarter + , DATETIME_TRUNC(bookings_source_src_28000.paid_at, year) AS booking__paid_at__year , EXTRACT(year FROM bookings_source_src_28000.paid_at) AS booking__paid_at__extract_year , EXTRACT(quarter FROM bookings_source_src_28000.paid_at) AS booking__paid_at__extract_quarter , EXTRACT(month FROM bookings_source_src_28000.paid_at) AS booking__paid_at__extract_month @@ -541,7 +541,7 @@ FROM ( ) subq_5 ) subq_6 ON - DATE_TRUNC(subq_7.metric_time__day, month) = subq_6.metric_time__day + DATETIME_TRUNC(subq_7.metric_time__day, month) = subq_6.metric_time__day ) subq_9 ) subq_10 GROUP BY diff --git a/tests_metricflow/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/BigQuery/test_derived_metric_with_offset_to_grain__plan0_optimized.sql b/tests_metricflow/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/BigQuery/test_derived_metric_with_offset_to_grain__plan0_optimized.sql index 632b367fc0..01998e04e7 100644 --- a/tests_metricflow/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/BigQuery/test_derived_metric_with_offset_to_grain__plan0_optimized.sql +++ b/tests_metricflow/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/BigQuery/test_derived_metric_with_offset_to_grain__plan0_optimized.sql @@ -19,7 +19,7 @@ FROM ( -- Metric Time Dimension 'ds' -- Pass Only Elements: ['bookings', 'metric_time__day'] SELECT - DATE_TRUNC(ds, day) AS metric_time__day + DATETIME_TRUNC(ds, day) AS metric_time__day , 1 AS bookings FROM ***************************.fct_bookings bookings_source_src_28000 ) subq_16 @@ -39,12 +39,12 @@ FROM ( -- Read Elements From Semantic Model 'bookings_source' -- Metric Time Dimension 'ds' SELECT - DATE_TRUNC(ds, day) AS metric_time__day + DATETIME_TRUNC(ds, day) AS metric_time__day , 1 AS bookings FROM ***************************.fct_bookings bookings_source_src_28000 ) subq_20 ON - DATE_TRUNC(subq_22.ds, month) = subq_20.metric_time__day + DATETIME_TRUNC(subq_22.ds, month) = subq_20.metric_time__day GROUP BY metric_time__day ) subq_26 diff --git a/tests_metricflow/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/BigQuery/test_derived_metric_with_offset_to_grain_and_granularity__plan0.sql b/tests_metricflow/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/BigQuery/test_derived_metric_with_offset_to_grain_and_granularity__plan0.sql index a22b40ecdf..5c258a4743 100644 --- a/tests_metricflow/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/BigQuery/test_derived_metric_with_offset_to_grain_and_granularity__plan0.sql +++ b/tests_metricflow/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/BigQuery/test_derived_metric_with_offset_to_grain_and_granularity__plan0.sql @@ -142,33 +142,33 @@ FROM ( , bookings_source_src_28000.booking_value AS approximate_continuous_booking_value_p99 , bookings_source_src_28000.booking_value AS approximate_discrete_booking_value_p99 , bookings_source_src_28000.is_instant - , DATE_TRUNC(bookings_source_src_28000.ds, day) AS ds__day - , DATE_TRUNC(bookings_source_src_28000.ds, isoweek) AS ds__week - , DATE_TRUNC(bookings_source_src_28000.ds, month) AS ds__month - , DATE_TRUNC(bookings_source_src_28000.ds, quarter) AS ds__quarter - , DATE_TRUNC(bookings_source_src_28000.ds, year) AS ds__year + , DATETIME_TRUNC(bookings_source_src_28000.ds, day) AS ds__day + , DATETIME_TRUNC(bookings_source_src_28000.ds, isoweek) AS ds__week + , DATETIME_TRUNC(bookings_source_src_28000.ds, month) AS ds__month + , DATETIME_TRUNC(bookings_source_src_28000.ds, quarter) AS ds__quarter + , DATETIME_TRUNC(bookings_source_src_28000.ds, year) AS ds__year , EXTRACT(year FROM bookings_source_src_28000.ds) AS ds__extract_year , EXTRACT(quarter FROM bookings_source_src_28000.ds) AS ds__extract_quarter , EXTRACT(month FROM bookings_source_src_28000.ds) AS ds__extract_month , EXTRACT(day FROM bookings_source_src_28000.ds) AS ds__extract_day , IF(EXTRACT(dayofweek FROM bookings_source_src_28000.ds) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_28000.ds) - 1) AS ds__extract_dow , EXTRACT(dayofyear FROM bookings_source_src_28000.ds) AS ds__extract_doy - , DATE_TRUNC(bookings_source_src_28000.ds_partitioned, day) AS ds_partitioned__day - , DATE_TRUNC(bookings_source_src_28000.ds_partitioned, isoweek) AS ds_partitioned__week - , DATE_TRUNC(bookings_source_src_28000.ds_partitioned, month) AS ds_partitioned__month - , DATE_TRUNC(bookings_source_src_28000.ds_partitioned, quarter) AS ds_partitioned__quarter - , DATE_TRUNC(bookings_source_src_28000.ds_partitioned, year) AS ds_partitioned__year + , DATETIME_TRUNC(bookings_source_src_28000.ds_partitioned, day) AS ds_partitioned__day + , DATETIME_TRUNC(bookings_source_src_28000.ds_partitioned, isoweek) AS ds_partitioned__week + , DATETIME_TRUNC(bookings_source_src_28000.ds_partitioned, month) AS ds_partitioned__month + , DATETIME_TRUNC(bookings_source_src_28000.ds_partitioned, quarter) AS ds_partitioned__quarter + , DATETIME_TRUNC(bookings_source_src_28000.ds_partitioned, year) AS ds_partitioned__year , EXTRACT(year FROM bookings_source_src_28000.ds_partitioned) AS ds_partitioned__extract_year , EXTRACT(quarter FROM bookings_source_src_28000.ds_partitioned) AS ds_partitioned__extract_quarter , EXTRACT(month FROM bookings_source_src_28000.ds_partitioned) AS ds_partitioned__extract_month , EXTRACT(day FROM bookings_source_src_28000.ds_partitioned) AS ds_partitioned__extract_day , IF(EXTRACT(dayofweek FROM bookings_source_src_28000.ds_partitioned) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_28000.ds_partitioned) - 1) AS ds_partitioned__extract_dow , EXTRACT(dayofyear FROM bookings_source_src_28000.ds_partitioned) AS ds_partitioned__extract_doy - , DATE_TRUNC(bookings_source_src_28000.paid_at, day) AS paid_at__day - , DATE_TRUNC(bookings_source_src_28000.paid_at, isoweek) AS paid_at__week - , DATE_TRUNC(bookings_source_src_28000.paid_at, month) AS paid_at__month - , DATE_TRUNC(bookings_source_src_28000.paid_at, quarter) AS paid_at__quarter - , DATE_TRUNC(bookings_source_src_28000.paid_at, year) AS paid_at__year + , DATETIME_TRUNC(bookings_source_src_28000.paid_at, day) AS paid_at__day + , DATETIME_TRUNC(bookings_source_src_28000.paid_at, isoweek) AS paid_at__week + , DATETIME_TRUNC(bookings_source_src_28000.paid_at, month) AS paid_at__month + , DATETIME_TRUNC(bookings_source_src_28000.paid_at, quarter) AS paid_at__quarter + , DATETIME_TRUNC(bookings_source_src_28000.paid_at, year) AS paid_at__year , EXTRACT(year FROM bookings_source_src_28000.paid_at) AS paid_at__extract_year , EXTRACT(quarter FROM bookings_source_src_28000.paid_at) AS paid_at__extract_quarter , EXTRACT(month FROM bookings_source_src_28000.paid_at) AS paid_at__extract_month @@ -176,33 +176,33 @@ FROM ( , IF(EXTRACT(dayofweek FROM bookings_source_src_28000.paid_at) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_28000.paid_at) - 1) AS paid_at__extract_dow , EXTRACT(dayofyear FROM bookings_source_src_28000.paid_at) AS paid_at__extract_doy , bookings_source_src_28000.is_instant AS booking__is_instant - , DATE_TRUNC(bookings_source_src_28000.ds, day) AS booking__ds__day - , DATE_TRUNC(bookings_source_src_28000.ds, isoweek) AS booking__ds__week - , DATE_TRUNC(bookings_source_src_28000.ds, month) AS booking__ds__month - , DATE_TRUNC(bookings_source_src_28000.ds, quarter) AS booking__ds__quarter - , DATE_TRUNC(bookings_source_src_28000.ds, year) AS booking__ds__year + , DATETIME_TRUNC(bookings_source_src_28000.ds, day) AS booking__ds__day + , DATETIME_TRUNC(bookings_source_src_28000.ds, isoweek) AS booking__ds__week + , DATETIME_TRUNC(bookings_source_src_28000.ds, month) AS booking__ds__month + , DATETIME_TRUNC(bookings_source_src_28000.ds, quarter) AS booking__ds__quarter + , DATETIME_TRUNC(bookings_source_src_28000.ds, year) AS booking__ds__year , EXTRACT(year FROM bookings_source_src_28000.ds) AS booking__ds__extract_year , EXTRACT(quarter FROM bookings_source_src_28000.ds) AS booking__ds__extract_quarter , EXTRACT(month FROM bookings_source_src_28000.ds) AS booking__ds__extract_month , EXTRACT(day FROM bookings_source_src_28000.ds) AS booking__ds__extract_day , IF(EXTRACT(dayofweek FROM bookings_source_src_28000.ds) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_28000.ds) - 1) AS booking__ds__extract_dow , EXTRACT(dayofyear FROM bookings_source_src_28000.ds) AS booking__ds__extract_doy - , DATE_TRUNC(bookings_source_src_28000.ds_partitioned, day) AS booking__ds_partitioned__day - , DATE_TRUNC(bookings_source_src_28000.ds_partitioned, isoweek) AS booking__ds_partitioned__week - , DATE_TRUNC(bookings_source_src_28000.ds_partitioned, month) AS booking__ds_partitioned__month - , DATE_TRUNC(bookings_source_src_28000.ds_partitioned, quarter) AS booking__ds_partitioned__quarter - , DATE_TRUNC(bookings_source_src_28000.ds_partitioned, year) AS booking__ds_partitioned__year + , DATETIME_TRUNC(bookings_source_src_28000.ds_partitioned, day) AS booking__ds_partitioned__day + , DATETIME_TRUNC(bookings_source_src_28000.ds_partitioned, isoweek) AS booking__ds_partitioned__week + , DATETIME_TRUNC(bookings_source_src_28000.ds_partitioned, month) AS booking__ds_partitioned__month + , DATETIME_TRUNC(bookings_source_src_28000.ds_partitioned, quarter) AS booking__ds_partitioned__quarter + , DATETIME_TRUNC(bookings_source_src_28000.ds_partitioned, year) AS booking__ds_partitioned__year , EXTRACT(year FROM bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__extract_year , EXTRACT(quarter FROM bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__extract_quarter , EXTRACT(month FROM bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__extract_month , EXTRACT(day FROM bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__extract_day , IF(EXTRACT(dayofweek FROM bookings_source_src_28000.ds_partitioned) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_28000.ds_partitioned) - 1) AS booking__ds_partitioned__extract_dow , EXTRACT(dayofyear FROM bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__extract_doy - , DATE_TRUNC(bookings_source_src_28000.paid_at, day) AS booking__paid_at__day - , DATE_TRUNC(bookings_source_src_28000.paid_at, isoweek) AS booking__paid_at__week - , DATE_TRUNC(bookings_source_src_28000.paid_at, month) AS booking__paid_at__month - , DATE_TRUNC(bookings_source_src_28000.paid_at, quarter) AS booking__paid_at__quarter - , DATE_TRUNC(bookings_source_src_28000.paid_at, year) AS booking__paid_at__year + , DATETIME_TRUNC(bookings_source_src_28000.paid_at, day) AS booking__paid_at__day + , DATETIME_TRUNC(bookings_source_src_28000.paid_at, isoweek) AS booking__paid_at__week + , DATETIME_TRUNC(bookings_source_src_28000.paid_at, month) AS booking__paid_at__month + , DATETIME_TRUNC(bookings_source_src_28000.paid_at, quarter) AS booking__paid_at__quarter + , DATETIME_TRUNC(bookings_source_src_28000.paid_at, year) AS booking__paid_at__year , EXTRACT(year FROM bookings_source_src_28000.paid_at) AS booking__paid_at__extract_year , EXTRACT(quarter FROM bookings_source_src_28000.paid_at) AS booking__paid_at__extract_quarter , EXTRACT(month FROM bookings_source_src_28000.paid_at) AS booking__paid_at__extract_month @@ -242,10 +242,10 @@ FROM ( -- Join to Time Spine Dataset SELECT subq_7.metric_time__day AS metric_time__day - , DATE_TRUNC(subq_7.metric_time__day, isoweek) AS metric_time__week - , DATE_TRUNC(subq_7.metric_time__day, month) AS metric_time__month - , DATE_TRUNC(subq_7.metric_time__day, quarter) AS metric_time__quarter - , DATE_TRUNC(subq_7.metric_time__day, year) AS metric_time__year + , DATETIME_TRUNC(subq_7.metric_time__day, isoweek) AS metric_time__week + , DATETIME_TRUNC(subq_7.metric_time__day, month) AS metric_time__month + , DATETIME_TRUNC(subq_7.metric_time__day, quarter) AS metric_time__quarter + , DATETIME_TRUNC(subq_7.metric_time__day, year) AS metric_time__year , EXTRACT(year FROM subq_7.metric_time__day) AS metric_time__extract_year , EXTRACT(quarter FROM subq_7.metric_time__day) AS metric_time__extract_quarter , EXTRACT(month FROM subq_7.metric_time__day) AS metric_time__extract_month @@ -464,33 +464,33 @@ FROM ( , bookings_source_src_28000.booking_value AS approximate_continuous_booking_value_p99 , bookings_source_src_28000.booking_value AS approximate_discrete_booking_value_p99 , bookings_source_src_28000.is_instant - , DATE_TRUNC(bookings_source_src_28000.ds, day) AS ds__day - , DATE_TRUNC(bookings_source_src_28000.ds, isoweek) AS ds__week - , DATE_TRUNC(bookings_source_src_28000.ds, month) AS ds__month - , DATE_TRUNC(bookings_source_src_28000.ds, quarter) AS ds__quarter - , DATE_TRUNC(bookings_source_src_28000.ds, year) AS ds__year + , DATETIME_TRUNC(bookings_source_src_28000.ds, day) AS ds__day + , DATETIME_TRUNC(bookings_source_src_28000.ds, isoweek) AS ds__week + , DATETIME_TRUNC(bookings_source_src_28000.ds, month) AS ds__month + , DATETIME_TRUNC(bookings_source_src_28000.ds, quarter) AS ds__quarter + , DATETIME_TRUNC(bookings_source_src_28000.ds, year) AS ds__year , EXTRACT(year FROM bookings_source_src_28000.ds) AS ds__extract_year , EXTRACT(quarter FROM bookings_source_src_28000.ds) AS ds__extract_quarter , EXTRACT(month FROM bookings_source_src_28000.ds) AS ds__extract_month , EXTRACT(day FROM bookings_source_src_28000.ds) AS ds__extract_day , IF(EXTRACT(dayofweek FROM bookings_source_src_28000.ds) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_28000.ds) - 1) AS ds__extract_dow , EXTRACT(dayofyear FROM bookings_source_src_28000.ds) AS ds__extract_doy - , DATE_TRUNC(bookings_source_src_28000.ds_partitioned, day) AS ds_partitioned__day - , DATE_TRUNC(bookings_source_src_28000.ds_partitioned, isoweek) AS ds_partitioned__week - , DATE_TRUNC(bookings_source_src_28000.ds_partitioned, month) AS ds_partitioned__month - , DATE_TRUNC(bookings_source_src_28000.ds_partitioned, quarter) AS ds_partitioned__quarter - , DATE_TRUNC(bookings_source_src_28000.ds_partitioned, year) AS ds_partitioned__year + , DATETIME_TRUNC(bookings_source_src_28000.ds_partitioned, day) AS ds_partitioned__day + , DATETIME_TRUNC(bookings_source_src_28000.ds_partitioned, isoweek) AS ds_partitioned__week + , DATETIME_TRUNC(bookings_source_src_28000.ds_partitioned, month) AS ds_partitioned__month + , DATETIME_TRUNC(bookings_source_src_28000.ds_partitioned, quarter) AS ds_partitioned__quarter + , DATETIME_TRUNC(bookings_source_src_28000.ds_partitioned, year) AS ds_partitioned__year , EXTRACT(year FROM bookings_source_src_28000.ds_partitioned) AS ds_partitioned__extract_year , EXTRACT(quarter FROM bookings_source_src_28000.ds_partitioned) AS ds_partitioned__extract_quarter , EXTRACT(month FROM bookings_source_src_28000.ds_partitioned) AS ds_partitioned__extract_month , EXTRACT(day FROM bookings_source_src_28000.ds_partitioned) AS ds_partitioned__extract_day , IF(EXTRACT(dayofweek FROM bookings_source_src_28000.ds_partitioned) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_28000.ds_partitioned) - 1) AS ds_partitioned__extract_dow , EXTRACT(dayofyear FROM bookings_source_src_28000.ds_partitioned) AS ds_partitioned__extract_doy - , DATE_TRUNC(bookings_source_src_28000.paid_at, day) AS paid_at__day - , DATE_TRUNC(bookings_source_src_28000.paid_at, isoweek) AS paid_at__week - , DATE_TRUNC(bookings_source_src_28000.paid_at, month) AS paid_at__month - , DATE_TRUNC(bookings_source_src_28000.paid_at, quarter) AS paid_at__quarter - , DATE_TRUNC(bookings_source_src_28000.paid_at, year) AS paid_at__year + , DATETIME_TRUNC(bookings_source_src_28000.paid_at, day) AS paid_at__day + , DATETIME_TRUNC(bookings_source_src_28000.paid_at, isoweek) AS paid_at__week + , DATETIME_TRUNC(bookings_source_src_28000.paid_at, month) AS paid_at__month + , DATETIME_TRUNC(bookings_source_src_28000.paid_at, quarter) AS paid_at__quarter + , DATETIME_TRUNC(bookings_source_src_28000.paid_at, year) AS paid_at__year , EXTRACT(year FROM bookings_source_src_28000.paid_at) AS paid_at__extract_year , EXTRACT(quarter FROM bookings_source_src_28000.paid_at) AS paid_at__extract_quarter , EXTRACT(month FROM bookings_source_src_28000.paid_at) AS paid_at__extract_month @@ -498,33 +498,33 @@ FROM ( , IF(EXTRACT(dayofweek FROM bookings_source_src_28000.paid_at) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_28000.paid_at) - 1) AS paid_at__extract_dow , EXTRACT(dayofyear FROM bookings_source_src_28000.paid_at) AS paid_at__extract_doy , bookings_source_src_28000.is_instant AS booking__is_instant - , DATE_TRUNC(bookings_source_src_28000.ds, day) AS booking__ds__day - , DATE_TRUNC(bookings_source_src_28000.ds, isoweek) AS booking__ds__week - , DATE_TRUNC(bookings_source_src_28000.ds, month) AS booking__ds__month - , DATE_TRUNC(bookings_source_src_28000.ds, quarter) AS booking__ds__quarter - , DATE_TRUNC(bookings_source_src_28000.ds, year) AS booking__ds__year + , DATETIME_TRUNC(bookings_source_src_28000.ds, day) AS booking__ds__day + , DATETIME_TRUNC(bookings_source_src_28000.ds, isoweek) AS booking__ds__week + , DATETIME_TRUNC(bookings_source_src_28000.ds, month) AS booking__ds__month + , DATETIME_TRUNC(bookings_source_src_28000.ds, quarter) AS booking__ds__quarter + , DATETIME_TRUNC(bookings_source_src_28000.ds, year) AS booking__ds__year , EXTRACT(year FROM bookings_source_src_28000.ds) AS booking__ds__extract_year , EXTRACT(quarter FROM bookings_source_src_28000.ds) AS booking__ds__extract_quarter , EXTRACT(month FROM bookings_source_src_28000.ds) AS booking__ds__extract_month , EXTRACT(day FROM bookings_source_src_28000.ds) AS booking__ds__extract_day , IF(EXTRACT(dayofweek FROM bookings_source_src_28000.ds) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_28000.ds) - 1) AS booking__ds__extract_dow , EXTRACT(dayofyear FROM bookings_source_src_28000.ds) AS booking__ds__extract_doy - , DATE_TRUNC(bookings_source_src_28000.ds_partitioned, day) AS booking__ds_partitioned__day - , DATE_TRUNC(bookings_source_src_28000.ds_partitioned, isoweek) AS booking__ds_partitioned__week - , DATE_TRUNC(bookings_source_src_28000.ds_partitioned, month) AS booking__ds_partitioned__month - , DATE_TRUNC(bookings_source_src_28000.ds_partitioned, quarter) AS booking__ds_partitioned__quarter - , DATE_TRUNC(bookings_source_src_28000.ds_partitioned, year) AS booking__ds_partitioned__year + , DATETIME_TRUNC(bookings_source_src_28000.ds_partitioned, day) AS booking__ds_partitioned__day + , DATETIME_TRUNC(bookings_source_src_28000.ds_partitioned, isoweek) AS booking__ds_partitioned__week + , DATETIME_TRUNC(bookings_source_src_28000.ds_partitioned, month) AS booking__ds_partitioned__month + , DATETIME_TRUNC(bookings_source_src_28000.ds_partitioned, quarter) AS booking__ds_partitioned__quarter + , DATETIME_TRUNC(bookings_source_src_28000.ds_partitioned, year) AS booking__ds_partitioned__year , EXTRACT(year FROM bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__extract_year , EXTRACT(quarter FROM bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__extract_quarter , EXTRACT(month FROM bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__extract_month , EXTRACT(day FROM bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__extract_day , IF(EXTRACT(dayofweek FROM bookings_source_src_28000.ds_partitioned) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_28000.ds_partitioned) - 1) AS booking__ds_partitioned__extract_dow , EXTRACT(dayofyear FROM bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__extract_doy - , DATE_TRUNC(bookings_source_src_28000.paid_at, day) AS booking__paid_at__day - , DATE_TRUNC(bookings_source_src_28000.paid_at, isoweek) AS booking__paid_at__week - , DATE_TRUNC(bookings_source_src_28000.paid_at, month) AS booking__paid_at__month - , DATE_TRUNC(bookings_source_src_28000.paid_at, quarter) AS booking__paid_at__quarter - , DATE_TRUNC(bookings_source_src_28000.paid_at, year) AS booking__paid_at__year + , DATETIME_TRUNC(bookings_source_src_28000.paid_at, day) AS booking__paid_at__day + , DATETIME_TRUNC(bookings_source_src_28000.paid_at, isoweek) AS booking__paid_at__week + , DATETIME_TRUNC(bookings_source_src_28000.paid_at, month) AS booking__paid_at__month + , DATETIME_TRUNC(bookings_source_src_28000.paid_at, quarter) AS booking__paid_at__quarter + , DATETIME_TRUNC(bookings_source_src_28000.paid_at, year) AS booking__paid_at__year , EXTRACT(year FROM bookings_source_src_28000.paid_at) AS booking__paid_at__extract_year , EXTRACT(quarter FROM bookings_source_src_28000.paid_at) AS booking__paid_at__extract_quarter , EXTRACT(month FROM bookings_source_src_28000.paid_at) AS booking__paid_at__extract_month @@ -541,8 +541,8 @@ FROM ( ) subq_5 ) subq_6 ON - DATE_TRUNC(subq_7.metric_time__day, month) = subq_6.metric_time__day - WHERE DATE_TRUNC(subq_7.metric_time__day, isoweek) = subq_7.metric_time__day + DATETIME_TRUNC(subq_7.metric_time__day, month) = subq_6.metric_time__day + WHERE DATETIME_TRUNC(subq_7.metric_time__day, isoweek) = subq_7.metric_time__day ) subq_9 ) subq_10 GROUP BY diff --git a/tests_metricflow/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/BigQuery/test_derived_metric_with_offset_to_grain_and_granularity__plan0_optimized.sql b/tests_metricflow/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/BigQuery/test_derived_metric_with_offset_to_grain_and_granularity__plan0_optimized.sql index 226ba59503..0adabcc5db 100644 --- a/tests_metricflow/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/BigQuery/test_derived_metric_with_offset_to_grain_and_granularity__plan0_optimized.sql +++ b/tests_metricflow/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/BigQuery/test_derived_metric_with_offset_to_grain_and_granularity__plan0_optimized.sql @@ -19,7 +19,7 @@ FROM ( -- Metric Time Dimension 'ds' -- Pass Only Elements: ['bookings', 'metric_time__week'] SELECT - DATE_TRUNC(ds, isoweek) AS metric_time__week + DATETIME_TRUNC(ds, isoweek) AS metric_time__week , 1 AS bookings FROM ***************************.fct_bookings bookings_source_src_28000 ) subq_16 @@ -32,20 +32,20 @@ FROM ( -- Aggregate Measures -- Compute Metrics via Expressions SELECT - DATE_TRUNC(subq_22.ds, isoweek) AS metric_time__week + DATETIME_TRUNC(subq_22.ds, isoweek) AS metric_time__week , SUM(subq_20.bookings) AS bookings_at_start_of_month FROM ***************************.mf_time_spine subq_22 INNER JOIN ( -- Read Elements From Semantic Model 'bookings_source' -- Metric Time Dimension 'ds' SELECT - DATE_TRUNC(ds, day) AS metric_time__day + DATETIME_TRUNC(ds, day) AS metric_time__day , 1 AS bookings FROM ***************************.fct_bookings bookings_source_src_28000 ) subq_20 ON - DATE_TRUNC(subq_22.ds, month) = subq_20.metric_time__day - WHERE DATE_TRUNC(subq_22.ds, isoweek) = subq_22.ds + DATETIME_TRUNC(subq_22.ds, month) = subq_20.metric_time__day + WHERE DATETIME_TRUNC(subq_22.ds, isoweek) = subq_22.ds GROUP BY metric_time__week ) subq_26 diff --git a/tests_metricflow/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/BigQuery/test_derived_metric_with_offset_window__plan0.sql b/tests_metricflow/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/BigQuery/test_derived_metric_with_offset_window__plan0.sql index 86803dec46..573fbfce44 100644 --- a/tests_metricflow/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/BigQuery/test_derived_metric_with_offset_window__plan0.sql +++ b/tests_metricflow/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/BigQuery/test_derived_metric_with_offset_window__plan0.sql @@ -142,33 +142,33 @@ FROM ( , bookings_source_src_28000.booking_value AS approximate_continuous_booking_value_p99 , bookings_source_src_28000.booking_value AS approximate_discrete_booking_value_p99 , bookings_source_src_28000.is_instant - , DATE_TRUNC(bookings_source_src_28000.ds, day) AS ds__day - , DATE_TRUNC(bookings_source_src_28000.ds, isoweek) AS ds__week - , DATE_TRUNC(bookings_source_src_28000.ds, month) AS ds__month - , DATE_TRUNC(bookings_source_src_28000.ds, quarter) AS ds__quarter - , DATE_TRUNC(bookings_source_src_28000.ds, year) AS ds__year + , DATETIME_TRUNC(bookings_source_src_28000.ds, day) AS ds__day + , DATETIME_TRUNC(bookings_source_src_28000.ds, isoweek) AS ds__week + , DATETIME_TRUNC(bookings_source_src_28000.ds, month) AS ds__month + , DATETIME_TRUNC(bookings_source_src_28000.ds, quarter) AS ds__quarter + , DATETIME_TRUNC(bookings_source_src_28000.ds, year) AS ds__year , EXTRACT(year FROM bookings_source_src_28000.ds) AS ds__extract_year , EXTRACT(quarter FROM bookings_source_src_28000.ds) AS ds__extract_quarter , EXTRACT(month FROM bookings_source_src_28000.ds) AS ds__extract_month , EXTRACT(day FROM bookings_source_src_28000.ds) AS ds__extract_day , IF(EXTRACT(dayofweek FROM bookings_source_src_28000.ds) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_28000.ds) - 1) AS ds__extract_dow , EXTRACT(dayofyear FROM bookings_source_src_28000.ds) AS ds__extract_doy - , DATE_TRUNC(bookings_source_src_28000.ds_partitioned, day) AS ds_partitioned__day - , DATE_TRUNC(bookings_source_src_28000.ds_partitioned, isoweek) AS ds_partitioned__week - , DATE_TRUNC(bookings_source_src_28000.ds_partitioned, month) AS ds_partitioned__month - , DATE_TRUNC(bookings_source_src_28000.ds_partitioned, quarter) AS ds_partitioned__quarter - , DATE_TRUNC(bookings_source_src_28000.ds_partitioned, year) AS ds_partitioned__year + , DATETIME_TRUNC(bookings_source_src_28000.ds_partitioned, day) AS ds_partitioned__day + , DATETIME_TRUNC(bookings_source_src_28000.ds_partitioned, isoweek) AS ds_partitioned__week + , DATETIME_TRUNC(bookings_source_src_28000.ds_partitioned, month) AS ds_partitioned__month + , DATETIME_TRUNC(bookings_source_src_28000.ds_partitioned, quarter) AS ds_partitioned__quarter + , DATETIME_TRUNC(bookings_source_src_28000.ds_partitioned, year) AS ds_partitioned__year , EXTRACT(year FROM bookings_source_src_28000.ds_partitioned) AS ds_partitioned__extract_year , EXTRACT(quarter FROM bookings_source_src_28000.ds_partitioned) AS ds_partitioned__extract_quarter , EXTRACT(month FROM bookings_source_src_28000.ds_partitioned) AS ds_partitioned__extract_month , EXTRACT(day FROM bookings_source_src_28000.ds_partitioned) AS ds_partitioned__extract_day , IF(EXTRACT(dayofweek FROM bookings_source_src_28000.ds_partitioned) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_28000.ds_partitioned) - 1) AS ds_partitioned__extract_dow , EXTRACT(dayofyear FROM bookings_source_src_28000.ds_partitioned) AS ds_partitioned__extract_doy - , DATE_TRUNC(bookings_source_src_28000.paid_at, day) AS paid_at__day - , DATE_TRUNC(bookings_source_src_28000.paid_at, isoweek) AS paid_at__week - , DATE_TRUNC(bookings_source_src_28000.paid_at, month) AS paid_at__month - , DATE_TRUNC(bookings_source_src_28000.paid_at, quarter) AS paid_at__quarter - , DATE_TRUNC(bookings_source_src_28000.paid_at, year) AS paid_at__year + , DATETIME_TRUNC(bookings_source_src_28000.paid_at, day) AS paid_at__day + , DATETIME_TRUNC(bookings_source_src_28000.paid_at, isoweek) AS paid_at__week + , DATETIME_TRUNC(bookings_source_src_28000.paid_at, month) AS paid_at__month + , DATETIME_TRUNC(bookings_source_src_28000.paid_at, quarter) AS paid_at__quarter + , DATETIME_TRUNC(bookings_source_src_28000.paid_at, year) AS paid_at__year , EXTRACT(year FROM bookings_source_src_28000.paid_at) AS paid_at__extract_year , EXTRACT(quarter FROM bookings_source_src_28000.paid_at) AS paid_at__extract_quarter , EXTRACT(month FROM bookings_source_src_28000.paid_at) AS paid_at__extract_month @@ -176,33 +176,33 @@ FROM ( , IF(EXTRACT(dayofweek FROM bookings_source_src_28000.paid_at) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_28000.paid_at) - 1) AS paid_at__extract_dow , EXTRACT(dayofyear FROM bookings_source_src_28000.paid_at) AS paid_at__extract_doy , bookings_source_src_28000.is_instant AS booking__is_instant - , DATE_TRUNC(bookings_source_src_28000.ds, day) AS booking__ds__day - , DATE_TRUNC(bookings_source_src_28000.ds, isoweek) AS booking__ds__week - , DATE_TRUNC(bookings_source_src_28000.ds, month) AS booking__ds__month - , DATE_TRUNC(bookings_source_src_28000.ds, quarter) AS booking__ds__quarter - , DATE_TRUNC(bookings_source_src_28000.ds, year) AS booking__ds__year + , DATETIME_TRUNC(bookings_source_src_28000.ds, day) AS booking__ds__day + , DATETIME_TRUNC(bookings_source_src_28000.ds, isoweek) AS booking__ds__week + , DATETIME_TRUNC(bookings_source_src_28000.ds, month) AS booking__ds__month + , DATETIME_TRUNC(bookings_source_src_28000.ds, quarter) AS booking__ds__quarter + , DATETIME_TRUNC(bookings_source_src_28000.ds, year) AS booking__ds__year , EXTRACT(year FROM bookings_source_src_28000.ds) AS booking__ds__extract_year , EXTRACT(quarter FROM bookings_source_src_28000.ds) AS booking__ds__extract_quarter , EXTRACT(month FROM bookings_source_src_28000.ds) AS booking__ds__extract_month , EXTRACT(day FROM bookings_source_src_28000.ds) AS booking__ds__extract_day , IF(EXTRACT(dayofweek FROM bookings_source_src_28000.ds) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_28000.ds) - 1) AS booking__ds__extract_dow , EXTRACT(dayofyear FROM bookings_source_src_28000.ds) AS booking__ds__extract_doy - , DATE_TRUNC(bookings_source_src_28000.ds_partitioned, day) AS booking__ds_partitioned__day - , DATE_TRUNC(bookings_source_src_28000.ds_partitioned, isoweek) AS booking__ds_partitioned__week - , DATE_TRUNC(bookings_source_src_28000.ds_partitioned, month) AS booking__ds_partitioned__month - , DATE_TRUNC(bookings_source_src_28000.ds_partitioned, quarter) AS booking__ds_partitioned__quarter - , DATE_TRUNC(bookings_source_src_28000.ds_partitioned, year) AS booking__ds_partitioned__year + , DATETIME_TRUNC(bookings_source_src_28000.ds_partitioned, day) AS booking__ds_partitioned__day + , DATETIME_TRUNC(bookings_source_src_28000.ds_partitioned, isoweek) AS booking__ds_partitioned__week + , DATETIME_TRUNC(bookings_source_src_28000.ds_partitioned, month) AS booking__ds_partitioned__month + , DATETIME_TRUNC(bookings_source_src_28000.ds_partitioned, quarter) AS booking__ds_partitioned__quarter + , DATETIME_TRUNC(bookings_source_src_28000.ds_partitioned, year) AS booking__ds_partitioned__year , EXTRACT(year FROM bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__extract_year , EXTRACT(quarter FROM bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__extract_quarter , EXTRACT(month FROM bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__extract_month , EXTRACT(day FROM bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__extract_day , IF(EXTRACT(dayofweek FROM bookings_source_src_28000.ds_partitioned) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_28000.ds_partitioned) - 1) AS booking__ds_partitioned__extract_dow , EXTRACT(dayofyear FROM bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__extract_doy - , DATE_TRUNC(bookings_source_src_28000.paid_at, day) AS booking__paid_at__day - , DATE_TRUNC(bookings_source_src_28000.paid_at, isoweek) AS booking__paid_at__week - , DATE_TRUNC(bookings_source_src_28000.paid_at, month) AS booking__paid_at__month - , DATE_TRUNC(bookings_source_src_28000.paid_at, quarter) AS booking__paid_at__quarter - , DATE_TRUNC(bookings_source_src_28000.paid_at, year) AS booking__paid_at__year + , DATETIME_TRUNC(bookings_source_src_28000.paid_at, day) AS booking__paid_at__day + , DATETIME_TRUNC(bookings_source_src_28000.paid_at, isoweek) AS booking__paid_at__week + , DATETIME_TRUNC(bookings_source_src_28000.paid_at, month) AS booking__paid_at__month + , DATETIME_TRUNC(bookings_source_src_28000.paid_at, quarter) AS booking__paid_at__quarter + , DATETIME_TRUNC(bookings_source_src_28000.paid_at, year) AS booking__paid_at__year , EXTRACT(year FROM bookings_source_src_28000.paid_at) AS booking__paid_at__extract_year , EXTRACT(quarter FROM bookings_source_src_28000.paid_at) AS booking__paid_at__extract_quarter , EXTRACT(month FROM bookings_source_src_28000.paid_at) AS booking__paid_at__extract_month @@ -242,10 +242,10 @@ FROM ( -- Join to Time Spine Dataset SELECT subq_7.metric_time__day AS metric_time__day - , DATE_TRUNC(subq_7.metric_time__day, isoweek) AS metric_time__week - , DATE_TRUNC(subq_7.metric_time__day, month) AS metric_time__month - , DATE_TRUNC(subq_7.metric_time__day, quarter) AS metric_time__quarter - , DATE_TRUNC(subq_7.metric_time__day, year) AS metric_time__year + , DATETIME_TRUNC(subq_7.metric_time__day, isoweek) AS metric_time__week + , DATETIME_TRUNC(subq_7.metric_time__day, month) AS metric_time__month + , DATETIME_TRUNC(subq_7.metric_time__day, quarter) AS metric_time__quarter + , DATETIME_TRUNC(subq_7.metric_time__day, year) AS metric_time__year , EXTRACT(year FROM subq_7.metric_time__day) AS metric_time__extract_year , EXTRACT(quarter FROM subq_7.metric_time__day) AS metric_time__extract_quarter , EXTRACT(month FROM subq_7.metric_time__day) AS metric_time__extract_month @@ -464,33 +464,33 @@ FROM ( , bookings_source_src_28000.booking_value AS approximate_continuous_booking_value_p99 , bookings_source_src_28000.booking_value AS approximate_discrete_booking_value_p99 , bookings_source_src_28000.is_instant - , DATE_TRUNC(bookings_source_src_28000.ds, day) AS ds__day - , DATE_TRUNC(bookings_source_src_28000.ds, isoweek) AS ds__week - , DATE_TRUNC(bookings_source_src_28000.ds, month) AS ds__month - , DATE_TRUNC(bookings_source_src_28000.ds, quarter) AS ds__quarter - , DATE_TRUNC(bookings_source_src_28000.ds, year) AS ds__year + , DATETIME_TRUNC(bookings_source_src_28000.ds, day) AS ds__day + , DATETIME_TRUNC(bookings_source_src_28000.ds, isoweek) AS ds__week + , DATETIME_TRUNC(bookings_source_src_28000.ds, month) AS ds__month + , DATETIME_TRUNC(bookings_source_src_28000.ds, quarter) AS ds__quarter + , DATETIME_TRUNC(bookings_source_src_28000.ds, year) AS ds__year , EXTRACT(year FROM bookings_source_src_28000.ds) AS ds__extract_year , EXTRACT(quarter FROM bookings_source_src_28000.ds) AS ds__extract_quarter , EXTRACT(month FROM bookings_source_src_28000.ds) AS ds__extract_month , EXTRACT(day FROM bookings_source_src_28000.ds) AS ds__extract_day , IF(EXTRACT(dayofweek FROM bookings_source_src_28000.ds) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_28000.ds) - 1) AS ds__extract_dow , EXTRACT(dayofyear FROM bookings_source_src_28000.ds) AS ds__extract_doy - , DATE_TRUNC(bookings_source_src_28000.ds_partitioned, day) AS ds_partitioned__day - , DATE_TRUNC(bookings_source_src_28000.ds_partitioned, isoweek) AS ds_partitioned__week - , DATE_TRUNC(bookings_source_src_28000.ds_partitioned, month) AS ds_partitioned__month - , DATE_TRUNC(bookings_source_src_28000.ds_partitioned, quarter) AS ds_partitioned__quarter - , DATE_TRUNC(bookings_source_src_28000.ds_partitioned, year) AS ds_partitioned__year + , DATETIME_TRUNC(bookings_source_src_28000.ds_partitioned, day) AS ds_partitioned__day + , DATETIME_TRUNC(bookings_source_src_28000.ds_partitioned, isoweek) AS ds_partitioned__week + , DATETIME_TRUNC(bookings_source_src_28000.ds_partitioned, month) AS ds_partitioned__month + , DATETIME_TRUNC(bookings_source_src_28000.ds_partitioned, quarter) AS ds_partitioned__quarter + , DATETIME_TRUNC(bookings_source_src_28000.ds_partitioned, year) AS ds_partitioned__year , EXTRACT(year FROM bookings_source_src_28000.ds_partitioned) AS ds_partitioned__extract_year , EXTRACT(quarter FROM bookings_source_src_28000.ds_partitioned) AS ds_partitioned__extract_quarter , EXTRACT(month FROM bookings_source_src_28000.ds_partitioned) AS ds_partitioned__extract_month , EXTRACT(day FROM bookings_source_src_28000.ds_partitioned) AS ds_partitioned__extract_day , IF(EXTRACT(dayofweek FROM bookings_source_src_28000.ds_partitioned) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_28000.ds_partitioned) - 1) AS ds_partitioned__extract_dow , EXTRACT(dayofyear FROM bookings_source_src_28000.ds_partitioned) AS ds_partitioned__extract_doy - , DATE_TRUNC(bookings_source_src_28000.paid_at, day) AS paid_at__day - , DATE_TRUNC(bookings_source_src_28000.paid_at, isoweek) AS paid_at__week - , DATE_TRUNC(bookings_source_src_28000.paid_at, month) AS paid_at__month - , DATE_TRUNC(bookings_source_src_28000.paid_at, quarter) AS paid_at__quarter - , DATE_TRUNC(bookings_source_src_28000.paid_at, year) AS paid_at__year + , DATETIME_TRUNC(bookings_source_src_28000.paid_at, day) AS paid_at__day + , DATETIME_TRUNC(bookings_source_src_28000.paid_at, isoweek) AS paid_at__week + , DATETIME_TRUNC(bookings_source_src_28000.paid_at, month) AS paid_at__month + , DATETIME_TRUNC(bookings_source_src_28000.paid_at, quarter) AS paid_at__quarter + , DATETIME_TRUNC(bookings_source_src_28000.paid_at, year) AS paid_at__year , EXTRACT(year FROM bookings_source_src_28000.paid_at) AS paid_at__extract_year , EXTRACT(quarter FROM bookings_source_src_28000.paid_at) AS paid_at__extract_quarter , EXTRACT(month FROM bookings_source_src_28000.paid_at) AS paid_at__extract_month @@ -498,33 +498,33 @@ FROM ( , IF(EXTRACT(dayofweek FROM bookings_source_src_28000.paid_at) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_28000.paid_at) - 1) AS paid_at__extract_dow , EXTRACT(dayofyear FROM bookings_source_src_28000.paid_at) AS paid_at__extract_doy , bookings_source_src_28000.is_instant AS booking__is_instant - , DATE_TRUNC(bookings_source_src_28000.ds, day) AS booking__ds__day - , DATE_TRUNC(bookings_source_src_28000.ds, isoweek) AS booking__ds__week - , DATE_TRUNC(bookings_source_src_28000.ds, month) AS booking__ds__month - , DATE_TRUNC(bookings_source_src_28000.ds, quarter) AS booking__ds__quarter - , DATE_TRUNC(bookings_source_src_28000.ds, year) AS booking__ds__year + , DATETIME_TRUNC(bookings_source_src_28000.ds, day) AS booking__ds__day + , DATETIME_TRUNC(bookings_source_src_28000.ds, isoweek) AS booking__ds__week + , DATETIME_TRUNC(bookings_source_src_28000.ds, month) AS booking__ds__month + , DATETIME_TRUNC(bookings_source_src_28000.ds, quarter) AS booking__ds__quarter + , DATETIME_TRUNC(bookings_source_src_28000.ds, year) AS booking__ds__year , EXTRACT(year FROM bookings_source_src_28000.ds) AS booking__ds__extract_year , EXTRACT(quarter FROM bookings_source_src_28000.ds) AS booking__ds__extract_quarter , EXTRACT(month FROM bookings_source_src_28000.ds) AS booking__ds__extract_month , EXTRACT(day FROM bookings_source_src_28000.ds) AS booking__ds__extract_day , IF(EXTRACT(dayofweek FROM bookings_source_src_28000.ds) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_28000.ds) - 1) AS booking__ds__extract_dow , EXTRACT(dayofyear FROM bookings_source_src_28000.ds) AS booking__ds__extract_doy - , DATE_TRUNC(bookings_source_src_28000.ds_partitioned, day) AS booking__ds_partitioned__day - , DATE_TRUNC(bookings_source_src_28000.ds_partitioned, isoweek) AS booking__ds_partitioned__week - , DATE_TRUNC(bookings_source_src_28000.ds_partitioned, month) AS booking__ds_partitioned__month - , DATE_TRUNC(bookings_source_src_28000.ds_partitioned, quarter) AS booking__ds_partitioned__quarter - , DATE_TRUNC(bookings_source_src_28000.ds_partitioned, year) AS booking__ds_partitioned__year + , DATETIME_TRUNC(bookings_source_src_28000.ds_partitioned, day) AS booking__ds_partitioned__day + , DATETIME_TRUNC(bookings_source_src_28000.ds_partitioned, isoweek) AS booking__ds_partitioned__week + , DATETIME_TRUNC(bookings_source_src_28000.ds_partitioned, month) AS booking__ds_partitioned__month + , DATETIME_TRUNC(bookings_source_src_28000.ds_partitioned, quarter) AS booking__ds_partitioned__quarter + , DATETIME_TRUNC(bookings_source_src_28000.ds_partitioned, year) AS booking__ds_partitioned__year , EXTRACT(year FROM bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__extract_year , EXTRACT(quarter FROM bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__extract_quarter , EXTRACT(month FROM bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__extract_month , EXTRACT(day FROM bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__extract_day , IF(EXTRACT(dayofweek FROM bookings_source_src_28000.ds_partitioned) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_28000.ds_partitioned) - 1) AS booking__ds_partitioned__extract_dow , EXTRACT(dayofyear FROM bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__extract_doy - , DATE_TRUNC(bookings_source_src_28000.paid_at, day) AS booking__paid_at__day - , DATE_TRUNC(bookings_source_src_28000.paid_at, isoweek) AS booking__paid_at__week - , DATE_TRUNC(bookings_source_src_28000.paid_at, month) AS booking__paid_at__month - , DATE_TRUNC(bookings_source_src_28000.paid_at, quarter) AS booking__paid_at__quarter - , DATE_TRUNC(bookings_source_src_28000.paid_at, year) AS booking__paid_at__year + , DATETIME_TRUNC(bookings_source_src_28000.paid_at, day) AS booking__paid_at__day + , DATETIME_TRUNC(bookings_source_src_28000.paid_at, isoweek) AS booking__paid_at__week + , DATETIME_TRUNC(bookings_source_src_28000.paid_at, month) AS booking__paid_at__month + , DATETIME_TRUNC(bookings_source_src_28000.paid_at, quarter) AS booking__paid_at__quarter + , DATETIME_TRUNC(bookings_source_src_28000.paid_at, year) AS booking__paid_at__year , EXTRACT(year FROM bookings_source_src_28000.paid_at) AS booking__paid_at__extract_year , EXTRACT(quarter FROM bookings_source_src_28000.paid_at) AS booking__paid_at__extract_quarter , EXTRACT(month FROM bookings_source_src_28000.paid_at) AS booking__paid_at__extract_month diff --git a/tests_metricflow/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/BigQuery/test_derived_metric_with_offset_window__plan0_optimized.sql b/tests_metricflow/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/BigQuery/test_derived_metric_with_offset_window__plan0_optimized.sql index 441d10e4d3..afd37a8346 100644 --- a/tests_metricflow/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/BigQuery/test_derived_metric_with_offset_window__plan0_optimized.sql +++ b/tests_metricflow/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/BigQuery/test_derived_metric_with_offset_window__plan0_optimized.sql @@ -19,7 +19,7 @@ FROM ( -- Metric Time Dimension 'ds' -- Pass Only Elements: ['bookings', 'metric_time__day'] SELECT - DATE_TRUNC(ds, day) AS metric_time__day + DATETIME_TRUNC(ds, day) AS metric_time__day , 1 AS bookings FROM ***************************.fct_bookings bookings_source_src_28000 ) subq_16 @@ -39,7 +39,7 @@ FROM ( -- Read Elements From Semantic Model 'bookings_source' -- Metric Time Dimension 'ds' SELECT - DATE_TRUNC(ds, day) AS metric_time__day + DATETIME_TRUNC(ds, day) AS metric_time__day , 1 AS bookings FROM ***************************.fct_bookings bookings_source_src_28000 ) subq_20 diff --git a/tests_metricflow/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/BigQuery/test_derived_metric_with_offset_window_and_granularity__plan0.sql b/tests_metricflow/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/BigQuery/test_derived_metric_with_offset_window_and_granularity__plan0.sql index 46ddd5cc8e..7c1434ec44 100644 --- a/tests_metricflow/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/BigQuery/test_derived_metric_with_offset_window_and_granularity__plan0.sql +++ b/tests_metricflow/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/BigQuery/test_derived_metric_with_offset_window_and_granularity__plan0.sql @@ -142,33 +142,33 @@ FROM ( , bookings_source_src_28000.booking_value AS approximate_continuous_booking_value_p99 , bookings_source_src_28000.booking_value AS approximate_discrete_booking_value_p99 , bookings_source_src_28000.is_instant - , DATE_TRUNC(bookings_source_src_28000.ds, day) AS ds__day - , DATE_TRUNC(bookings_source_src_28000.ds, isoweek) AS ds__week - , DATE_TRUNC(bookings_source_src_28000.ds, month) AS ds__month - , DATE_TRUNC(bookings_source_src_28000.ds, quarter) AS ds__quarter - , DATE_TRUNC(bookings_source_src_28000.ds, year) AS ds__year + , DATETIME_TRUNC(bookings_source_src_28000.ds, day) AS ds__day + , DATETIME_TRUNC(bookings_source_src_28000.ds, isoweek) AS ds__week + , DATETIME_TRUNC(bookings_source_src_28000.ds, month) AS ds__month + , DATETIME_TRUNC(bookings_source_src_28000.ds, quarter) AS ds__quarter + , DATETIME_TRUNC(bookings_source_src_28000.ds, year) AS ds__year , EXTRACT(year FROM bookings_source_src_28000.ds) AS ds__extract_year , EXTRACT(quarter FROM bookings_source_src_28000.ds) AS ds__extract_quarter , EXTRACT(month FROM bookings_source_src_28000.ds) AS ds__extract_month , EXTRACT(day FROM bookings_source_src_28000.ds) AS ds__extract_day , IF(EXTRACT(dayofweek FROM bookings_source_src_28000.ds) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_28000.ds) - 1) AS ds__extract_dow , EXTRACT(dayofyear FROM bookings_source_src_28000.ds) AS ds__extract_doy - , DATE_TRUNC(bookings_source_src_28000.ds_partitioned, day) AS ds_partitioned__day - , DATE_TRUNC(bookings_source_src_28000.ds_partitioned, isoweek) AS ds_partitioned__week - , DATE_TRUNC(bookings_source_src_28000.ds_partitioned, month) AS ds_partitioned__month - , DATE_TRUNC(bookings_source_src_28000.ds_partitioned, quarter) AS ds_partitioned__quarter - , DATE_TRUNC(bookings_source_src_28000.ds_partitioned, year) AS ds_partitioned__year + , DATETIME_TRUNC(bookings_source_src_28000.ds_partitioned, day) AS ds_partitioned__day + , DATETIME_TRUNC(bookings_source_src_28000.ds_partitioned, isoweek) AS ds_partitioned__week + , DATETIME_TRUNC(bookings_source_src_28000.ds_partitioned, month) AS ds_partitioned__month + , DATETIME_TRUNC(bookings_source_src_28000.ds_partitioned, quarter) AS ds_partitioned__quarter + , DATETIME_TRUNC(bookings_source_src_28000.ds_partitioned, year) AS ds_partitioned__year , EXTRACT(year FROM bookings_source_src_28000.ds_partitioned) AS ds_partitioned__extract_year , EXTRACT(quarter FROM bookings_source_src_28000.ds_partitioned) AS ds_partitioned__extract_quarter , EXTRACT(month FROM bookings_source_src_28000.ds_partitioned) AS ds_partitioned__extract_month , EXTRACT(day FROM bookings_source_src_28000.ds_partitioned) AS ds_partitioned__extract_day , IF(EXTRACT(dayofweek FROM bookings_source_src_28000.ds_partitioned) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_28000.ds_partitioned) - 1) AS ds_partitioned__extract_dow , EXTRACT(dayofyear FROM bookings_source_src_28000.ds_partitioned) AS ds_partitioned__extract_doy - , DATE_TRUNC(bookings_source_src_28000.paid_at, day) AS paid_at__day - , DATE_TRUNC(bookings_source_src_28000.paid_at, isoweek) AS paid_at__week - , DATE_TRUNC(bookings_source_src_28000.paid_at, month) AS paid_at__month - , DATE_TRUNC(bookings_source_src_28000.paid_at, quarter) AS paid_at__quarter - , DATE_TRUNC(bookings_source_src_28000.paid_at, year) AS paid_at__year + , DATETIME_TRUNC(bookings_source_src_28000.paid_at, day) AS paid_at__day + , DATETIME_TRUNC(bookings_source_src_28000.paid_at, isoweek) AS paid_at__week + , DATETIME_TRUNC(bookings_source_src_28000.paid_at, month) AS paid_at__month + , DATETIME_TRUNC(bookings_source_src_28000.paid_at, quarter) AS paid_at__quarter + , DATETIME_TRUNC(bookings_source_src_28000.paid_at, year) AS paid_at__year , EXTRACT(year FROM bookings_source_src_28000.paid_at) AS paid_at__extract_year , EXTRACT(quarter FROM bookings_source_src_28000.paid_at) AS paid_at__extract_quarter , EXTRACT(month FROM bookings_source_src_28000.paid_at) AS paid_at__extract_month @@ -176,33 +176,33 @@ FROM ( , IF(EXTRACT(dayofweek FROM bookings_source_src_28000.paid_at) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_28000.paid_at) - 1) AS paid_at__extract_dow , EXTRACT(dayofyear FROM bookings_source_src_28000.paid_at) AS paid_at__extract_doy , bookings_source_src_28000.is_instant AS booking__is_instant - , DATE_TRUNC(bookings_source_src_28000.ds, day) AS booking__ds__day - , DATE_TRUNC(bookings_source_src_28000.ds, isoweek) AS booking__ds__week - , DATE_TRUNC(bookings_source_src_28000.ds, month) AS booking__ds__month - , DATE_TRUNC(bookings_source_src_28000.ds, quarter) AS booking__ds__quarter - , DATE_TRUNC(bookings_source_src_28000.ds, year) AS booking__ds__year + , DATETIME_TRUNC(bookings_source_src_28000.ds, day) AS booking__ds__day + , DATETIME_TRUNC(bookings_source_src_28000.ds, isoweek) AS booking__ds__week + , DATETIME_TRUNC(bookings_source_src_28000.ds, month) AS booking__ds__month + , DATETIME_TRUNC(bookings_source_src_28000.ds, quarter) AS booking__ds__quarter + , DATETIME_TRUNC(bookings_source_src_28000.ds, year) AS booking__ds__year , EXTRACT(year FROM bookings_source_src_28000.ds) AS booking__ds__extract_year , EXTRACT(quarter FROM bookings_source_src_28000.ds) AS booking__ds__extract_quarter , EXTRACT(month FROM bookings_source_src_28000.ds) AS booking__ds__extract_month , EXTRACT(day FROM bookings_source_src_28000.ds) AS booking__ds__extract_day , IF(EXTRACT(dayofweek FROM bookings_source_src_28000.ds) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_28000.ds) - 1) AS booking__ds__extract_dow , EXTRACT(dayofyear FROM bookings_source_src_28000.ds) AS booking__ds__extract_doy - , DATE_TRUNC(bookings_source_src_28000.ds_partitioned, day) AS booking__ds_partitioned__day - , DATE_TRUNC(bookings_source_src_28000.ds_partitioned, isoweek) AS booking__ds_partitioned__week - , DATE_TRUNC(bookings_source_src_28000.ds_partitioned, month) AS booking__ds_partitioned__month - , DATE_TRUNC(bookings_source_src_28000.ds_partitioned, quarter) AS booking__ds_partitioned__quarter - , DATE_TRUNC(bookings_source_src_28000.ds_partitioned, year) AS booking__ds_partitioned__year + , DATETIME_TRUNC(bookings_source_src_28000.ds_partitioned, day) AS booking__ds_partitioned__day + , DATETIME_TRUNC(bookings_source_src_28000.ds_partitioned, isoweek) AS booking__ds_partitioned__week + , DATETIME_TRUNC(bookings_source_src_28000.ds_partitioned, month) AS booking__ds_partitioned__month + , DATETIME_TRUNC(bookings_source_src_28000.ds_partitioned, quarter) AS booking__ds_partitioned__quarter + , DATETIME_TRUNC(bookings_source_src_28000.ds_partitioned, year) AS booking__ds_partitioned__year , EXTRACT(year FROM bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__extract_year , EXTRACT(quarter FROM bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__extract_quarter , EXTRACT(month FROM bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__extract_month , EXTRACT(day FROM bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__extract_day , IF(EXTRACT(dayofweek FROM bookings_source_src_28000.ds_partitioned) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_28000.ds_partitioned) - 1) AS booking__ds_partitioned__extract_dow , EXTRACT(dayofyear FROM bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__extract_doy - , DATE_TRUNC(bookings_source_src_28000.paid_at, day) AS booking__paid_at__day - , DATE_TRUNC(bookings_source_src_28000.paid_at, isoweek) AS booking__paid_at__week - , DATE_TRUNC(bookings_source_src_28000.paid_at, month) AS booking__paid_at__month - , DATE_TRUNC(bookings_source_src_28000.paid_at, quarter) AS booking__paid_at__quarter - , DATE_TRUNC(bookings_source_src_28000.paid_at, year) AS booking__paid_at__year + , DATETIME_TRUNC(bookings_source_src_28000.paid_at, day) AS booking__paid_at__day + , DATETIME_TRUNC(bookings_source_src_28000.paid_at, isoweek) AS booking__paid_at__week + , DATETIME_TRUNC(bookings_source_src_28000.paid_at, month) AS booking__paid_at__month + , DATETIME_TRUNC(bookings_source_src_28000.paid_at, quarter) AS booking__paid_at__quarter + , DATETIME_TRUNC(bookings_source_src_28000.paid_at, year) AS booking__paid_at__year , EXTRACT(year FROM bookings_source_src_28000.paid_at) AS booking__paid_at__extract_year , EXTRACT(quarter FROM bookings_source_src_28000.paid_at) AS booking__paid_at__extract_quarter , EXTRACT(month FROM bookings_source_src_28000.paid_at) AS booking__paid_at__extract_month @@ -242,10 +242,10 @@ FROM ( -- Join to Time Spine Dataset SELECT subq_7.metric_time__day AS metric_time__day - , DATE_TRUNC(subq_7.metric_time__day, isoweek) AS metric_time__week - , DATE_TRUNC(subq_7.metric_time__day, month) AS metric_time__month - , DATE_TRUNC(subq_7.metric_time__day, quarter) AS metric_time__quarter - , DATE_TRUNC(subq_7.metric_time__day, year) AS metric_time__year + , DATETIME_TRUNC(subq_7.metric_time__day, isoweek) AS metric_time__week + , DATETIME_TRUNC(subq_7.metric_time__day, month) AS metric_time__month + , DATETIME_TRUNC(subq_7.metric_time__day, quarter) AS metric_time__quarter + , DATETIME_TRUNC(subq_7.metric_time__day, year) AS metric_time__year , EXTRACT(year FROM subq_7.metric_time__day) AS metric_time__extract_year , EXTRACT(quarter FROM subq_7.metric_time__day) AS metric_time__extract_quarter , EXTRACT(month FROM subq_7.metric_time__day) AS metric_time__extract_month @@ -464,33 +464,33 @@ FROM ( , bookings_source_src_28000.booking_value AS approximate_continuous_booking_value_p99 , bookings_source_src_28000.booking_value AS approximate_discrete_booking_value_p99 , bookings_source_src_28000.is_instant - , DATE_TRUNC(bookings_source_src_28000.ds, day) AS ds__day - , DATE_TRUNC(bookings_source_src_28000.ds, isoweek) AS ds__week - , DATE_TRUNC(bookings_source_src_28000.ds, month) AS ds__month - , DATE_TRUNC(bookings_source_src_28000.ds, quarter) AS ds__quarter - , DATE_TRUNC(bookings_source_src_28000.ds, year) AS ds__year + , DATETIME_TRUNC(bookings_source_src_28000.ds, day) AS ds__day + , DATETIME_TRUNC(bookings_source_src_28000.ds, isoweek) AS ds__week + , DATETIME_TRUNC(bookings_source_src_28000.ds, month) AS ds__month + , DATETIME_TRUNC(bookings_source_src_28000.ds, quarter) AS ds__quarter + , DATETIME_TRUNC(bookings_source_src_28000.ds, year) AS ds__year , EXTRACT(year FROM bookings_source_src_28000.ds) AS ds__extract_year , EXTRACT(quarter FROM bookings_source_src_28000.ds) AS ds__extract_quarter , EXTRACT(month FROM bookings_source_src_28000.ds) AS ds__extract_month , EXTRACT(day FROM bookings_source_src_28000.ds) AS ds__extract_day , IF(EXTRACT(dayofweek FROM bookings_source_src_28000.ds) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_28000.ds) - 1) AS ds__extract_dow , EXTRACT(dayofyear FROM bookings_source_src_28000.ds) AS ds__extract_doy - , DATE_TRUNC(bookings_source_src_28000.ds_partitioned, day) AS ds_partitioned__day - , DATE_TRUNC(bookings_source_src_28000.ds_partitioned, isoweek) AS ds_partitioned__week - , DATE_TRUNC(bookings_source_src_28000.ds_partitioned, month) AS ds_partitioned__month - , DATE_TRUNC(bookings_source_src_28000.ds_partitioned, quarter) AS ds_partitioned__quarter - , DATE_TRUNC(bookings_source_src_28000.ds_partitioned, year) AS ds_partitioned__year + , DATETIME_TRUNC(bookings_source_src_28000.ds_partitioned, day) AS ds_partitioned__day + , DATETIME_TRUNC(bookings_source_src_28000.ds_partitioned, isoweek) AS ds_partitioned__week + , DATETIME_TRUNC(bookings_source_src_28000.ds_partitioned, month) AS ds_partitioned__month + , DATETIME_TRUNC(bookings_source_src_28000.ds_partitioned, quarter) AS ds_partitioned__quarter + , DATETIME_TRUNC(bookings_source_src_28000.ds_partitioned, year) AS ds_partitioned__year , EXTRACT(year FROM bookings_source_src_28000.ds_partitioned) AS ds_partitioned__extract_year , EXTRACT(quarter FROM bookings_source_src_28000.ds_partitioned) AS ds_partitioned__extract_quarter , EXTRACT(month FROM bookings_source_src_28000.ds_partitioned) AS ds_partitioned__extract_month , EXTRACT(day FROM bookings_source_src_28000.ds_partitioned) AS ds_partitioned__extract_day , IF(EXTRACT(dayofweek FROM bookings_source_src_28000.ds_partitioned) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_28000.ds_partitioned) - 1) AS ds_partitioned__extract_dow , EXTRACT(dayofyear FROM bookings_source_src_28000.ds_partitioned) AS ds_partitioned__extract_doy - , DATE_TRUNC(bookings_source_src_28000.paid_at, day) AS paid_at__day - , DATE_TRUNC(bookings_source_src_28000.paid_at, isoweek) AS paid_at__week - , DATE_TRUNC(bookings_source_src_28000.paid_at, month) AS paid_at__month - , DATE_TRUNC(bookings_source_src_28000.paid_at, quarter) AS paid_at__quarter - , DATE_TRUNC(bookings_source_src_28000.paid_at, year) AS paid_at__year + , DATETIME_TRUNC(bookings_source_src_28000.paid_at, day) AS paid_at__day + , DATETIME_TRUNC(bookings_source_src_28000.paid_at, isoweek) AS paid_at__week + , DATETIME_TRUNC(bookings_source_src_28000.paid_at, month) AS paid_at__month + , DATETIME_TRUNC(bookings_source_src_28000.paid_at, quarter) AS paid_at__quarter + , DATETIME_TRUNC(bookings_source_src_28000.paid_at, year) AS paid_at__year , EXTRACT(year FROM bookings_source_src_28000.paid_at) AS paid_at__extract_year , EXTRACT(quarter FROM bookings_source_src_28000.paid_at) AS paid_at__extract_quarter , EXTRACT(month FROM bookings_source_src_28000.paid_at) AS paid_at__extract_month @@ -498,33 +498,33 @@ FROM ( , IF(EXTRACT(dayofweek FROM bookings_source_src_28000.paid_at) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_28000.paid_at) - 1) AS paid_at__extract_dow , EXTRACT(dayofyear FROM bookings_source_src_28000.paid_at) AS paid_at__extract_doy , bookings_source_src_28000.is_instant AS booking__is_instant - , DATE_TRUNC(bookings_source_src_28000.ds, day) AS booking__ds__day - , DATE_TRUNC(bookings_source_src_28000.ds, isoweek) AS booking__ds__week - , DATE_TRUNC(bookings_source_src_28000.ds, month) AS booking__ds__month - , DATE_TRUNC(bookings_source_src_28000.ds, quarter) AS booking__ds__quarter - , DATE_TRUNC(bookings_source_src_28000.ds, year) AS booking__ds__year + , DATETIME_TRUNC(bookings_source_src_28000.ds, day) AS booking__ds__day + , DATETIME_TRUNC(bookings_source_src_28000.ds, isoweek) AS booking__ds__week + , DATETIME_TRUNC(bookings_source_src_28000.ds, month) AS booking__ds__month + , DATETIME_TRUNC(bookings_source_src_28000.ds, quarter) AS booking__ds__quarter + , DATETIME_TRUNC(bookings_source_src_28000.ds, year) AS booking__ds__year , EXTRACT(year FROM bookings_source_src_28000.ds) AS booking__ds__extract_year , EXTRACT(quarter FROM bookings_source_src_28000.ds) AS booking__ds__extract_quarter , EXTRACT(month FROM bookings_source_src_28000.ds) AS booking__ds__extract_month , EXTRACT(day FROM bookings_source_src_28000.ds) AS booking__ds__extract_day , IF(EXTRACT(dayofweek FROM bookings_source_src_28000.ds) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_28000.ds) - 1) AS booking__ds__extract_dow , EXTRACT(dayofyear FROM bookings_source_src_28000.ds) AS booking__ds__extract_doy - , DATE_TRUNC(bookings_source_src_28000.ds_partitioned, day) AS booking__ds_partitioned__day - , DATE_TRUNC(bookings_source_src_28000.ds_partitioned, isoweek) AS booking__ds_partitioned__week - , DATE_TRUNC(bookings_source_src_28000.ds_partitioned, month) AS booking__ds_partitioned__month - , DATE_TRUNC(bookings_source_src_28000.ds_partitioned, quarter) AS booking__ds_partitioned__quarter - , DATE_TRUNC(bookings_source_src_28000.ds_partitioned, year) AS booking__ds_partitioned__year + , DATETIME_TRUNC(bookings_source_src_28000.ds_partitioned, day) AS booking__ds_partitioned__day + , DATETIME_TRUNC(bookings_source_src_28000.ds_partitioned, isoweek) AS booking__ds_partitioned__week + , DATETIME_TRUNC(bookings_source_src_28000.ds_partitioned, month) AS booking__ds_partitioned__month + , DATETIME_TRUNC(bookings_source_src_28000.ds_partitioned, quarter) AS booking__ds_partitioned__quarter + , DATETIME_TRUNC(bookings_source_src_28000.ds_partitioned, year) AS booking__ds_partitioned__year , EXTRACT(year FROM bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__extract_year , EXTRACT(quarter FROM bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__extract_quarter , EXTRACT(month FROM bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__extract_month , EXTRACT(day FROM bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__extract_day , IF(EXTRACT(dayofweek FROM bookings_source_src_28000.ds_partitioned) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_28000.ds_partitioned) - 1) AS booking__ds_partitioned__extract_dow , EXTRACT(dayofyear FROM bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__extract_doy - , DATE_TRUNC(bookings_source_src_28000.paid_at, day) AS booking__paid_at__day - , DATE_TRUNC(bookings_source_src_28000.paid_at, isoweek) AS booking__paid_at__week - , DATE_TRUNC(bookings_source_src_28000.paid_at, month) AS booking__paid_at__month - , DATE_TRUNC(bookings_source_src_28000.paid_at, quarter) AS booking__paid_at__quarter - , DATE_TRUNC(bookings_source_src_28000.paid_at, year) AS booking__paid_at__year + , DATETIME_TRUNC(bookings_source_src_28000.paid_at, day) AS booking__paid_at__day + , DATETIME_TRUNC(bookings_source_src_28000.paid_at, isoweek) AS booking__paid_at__week + , DATETIME_TRUNC(bookings_source_src_28000.paid_at, month) AS booking__paid_at__month + , DATETIME_TRUNC(bookings_source_src_28000.paid_at, quarter) AS booking__paid_at__quarter + , DATETIME_TRUNC(bookings_source_src_28000.paid_at, year) AS booking__paid_at__year , EXTRACT(year FROM bookings_source_src_28000.paid_at) AS booking__paid_at__extract_year , EXTRACT(quarter FROM bookings_source_src_28000.paid_at) AS booking__paid_at__extract_quarter , EXTRACT(month FROM bookings_source_src_28000.paid_at) AS booking__paid_at__extract_month diff --git a/tests_metricflow/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/BigQuery/test_derived_metric_with_offset_window_and_granularity__plan0_optimized.sql b/tests_metricflow/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/BigQuery/test_derived_metric_with_offset_window_and_granularity__plan0_optimized.sql index f59596ba6d..a53541bac3 100644 --- a/tests_metricflow/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/BigQuery/test_derived_metric_with_offset_window_and_granularity__plan0_optimized.sql +++ b/tests_metricflow/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/BigQuery/test_derived_metric_with_offset_window_and_granularity__plan0_optimized.sql @@ -19,7 +19,7 @@ FROM ( -- Metric Time Dimension 'ds' -- Pass Only Elements: ['bookings', 'metric_time__quarter'] SELECT - DATE_TRUNC(ds, quarter) AS metric_time__quarter + DATETIME_TRUNC(ds, quarter) AS metric_time__quarter , 1 AS bookings FROM ***************************.fct_bookings bookings_source_src_28000 ) subq_16 @@ -32,14 +32,14 @@ FROM ( -- Aggregate Measures -- Compute Metrics via Expressions SELECT - DATE_TRUNC(subq_22.ds, quarter) AS metric_time__quarter + DATETIME_TRUNC(subq_22.ds, quarter) AS metric_time__quarter , SUM(subq_20.bookings) AS bookings_2_weeks_ago FROM ***************************.mf_time_spine subq_22 INNER JOIN ( -- Read Elements From Semantic Model 'bookings_source' -- Metric Time Dimension 'ds' SELECT - DATE_TRUNC(ds, day) AS metric_time__day + DATETIME_TRUNC(ds, day) AS metric_time__day , 1 AS bookings FROM ***************************.fct_bookings bookings_source_src_28000 ) subq_20 diff --git a/tests_metricflow/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/BigQuery/test_derived_metric_with_offset_window_and_offset_to_grain__plan0.sql b/tests_metricflow/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/BigQuery/test_derived_metric_with_offset_window_and_offset_to_grain__plan0.sql index a2e78b069b..233c22cc2f 100644 --- a/tests_metricflow/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/BigQuery/test_derived_metric_with_offset_window_and_offset_to_grain__plan0.sql +++ b/tests_metricflow/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/BigQuery/test_derived_metric_with_offset_window_and_offset_to_grain__plan0.sql @@ -27,10 +27,10 @@ FROM ( -- Join to Time Spine Dataset SELECT subq_2.metric_time__day AS metric_time__day - , DATE_TRUNC(subq_2.metric_time__day, isoweek) AS metric_time__week - , DATE_TRUNC(subq_2.metric_time__day, month) AS metric_time__month - , DATE_TRUNC(subq_2.metric_time__day, quarter) AS metric_time__quarter - , DATE_TRUNC(subq_2.metric_time__day, year) AS metric_time__year + , DATETIME_TRUNC(subq_2.metric_time__day, isoweek) AS metric_time__week + , DATETIME_TRUNC(subq_2.metric_time__day, month) AS metric_time__month + , DATETIME_TRUNC(subq_2.metric_time__day, quarter) AS metric_time__quarter + , DATETIME_TRUNC(subq_2.metric_time__day, year) AS metric_time__year , EXTRACT(year FROM subq_2.metric_time__day) AS metric_time__extract_year , EXTRACT(quarter FROM subq_2.metric_time__day) AS metric_time__extract_quarter , EXTRACT(month FROM subq_2.metric_time__day) AS metric_time__extract_month @@ -249,33 +249,33 @@ FROM ( , bookings_source_src_28000.booking_value AS approximate_continuous_booking_value_p99 , bookings_source_src_28000.booking_value AS approximate_discrete_booking_value_p99 , bookings_source_src_28000.is_instant - , DATE_TRUNC(bookings_source_src_28000.ds, day) AS ds__day - , DATE_TRUNC(bookings_source_src_28000.ds, isoweek) AS ds__week - , DATE_TRUNC(bookings_source_src_28000.ds, month) AS ds__month - , DATE_TRUNC(bookings_source_src_28000.ds, quarter) AS ds__quarter - , DATE_TRUNC(bookings_source_src_28000.ds, year) AS ds__year + , DATETIME_TRUNC(bookings_source_src_28000.ds, day) AS ds__day + , DATETIME_TRUNC(bookings_source_src_28000.ds, isoweek) AS ds__week + , DATETIME_TRUNC(bookings_source_src_28000.ds, month) AS ds__month + , DATETIME_TRUNC(bookings_source_src_28000.ds, quarter) AS ds__quarter + , DATETIME_TRUNC(bookings_source_src_28000.ds, year) AS ds__year , EXTRACT(year FROM bookings_source_src_28000.ds) AS ds__extract_year , EXTRACT(quarter FROM bookings_source_src_28000.ds) AS ds__extract_quarter , EXTRACT(month FROM bookings_source_src_28000.ds) AS ds__extract_month , EXTRACT(day FROM bookings_source_src_28000.ds) AS ds__extract_day , IF(EXTRACT(dayofweek FROM bookings_source_src_28000.ds) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_28000.ds) - 1) AS ds__extract_dow , EXTRACT(dayofyear FROM bookings_source_src_28000.ds) AS ds__extract_doy - , DATE_TRUNC(bookings_source_src_28000.ds_partitioned, day) AS ds_partitioned__day - , DATE_TRUNC(bookings_source_src_28000.ds_partitioned, isoweek) AS ds_partitioned__week - , DATE_TRUNC(bookings_source_src_28000.ds_partitioned, month) AS ds_partitioned__month - , DATE_TRUNC(bookings_source_src_28000.ds_partitioned, quarter) AS ds_partitioned__quarter - , DATE_TRUNC(bookings_source_src_28000.ds_partitioned, year) AS ds_partitioned__year + , DATETIME_TRUNC(bookings_source_src_28000.ds_partitioned, day) AS ds_partitioned__day + , DATETIME_TRUNC(bookings_source_src_28000.ds_partitioned, isoweek) AS ds_partitioned__week + , DATETIME_TRUNC(bookings_source_src_28000.ds_partitioned, month) AS ds_partitioned__month + , DATETIME_TRUNC(bookings_source_src_28000.ds_partitioned, quarter) AS ds_partitioned__quarter + , DATETIME_TRUNC(bookings_source_src_28000.ds_partitioned, year) AS ds_partitioned__year , EXTRACT(year FROM bookings_source_src_28000.ds_partitioned) AS ds_partitioned__extract_year , EXTRACT(quarter FROM bookings_source_src_28000.ds_partitioned) AS ds_partitioned__extract_quarter , EXTRACT(month FROM bookings_source_src_28000.ds_partitioned) AS ds_partitioned__extract_month , EXTRACT(day FROM bookings_source_src_28000.ds_partitioned) AS ds_partitioned__extract_day , IF(EXTRACT(dayofweek FROM bookings_source_src_28000.ds_partitioned) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_28000.ds_partitioned) - 1) AS ds_partitioned__extract_dow , EXTRACT(dayofyear FROM bookings_source_src_28000.ds_partitioned) AS ds_partitioned__extract_doy - , DATE_TRUNC(bookings_source_src_28000.paid_at, day) AS paid_at__day - , DATE_TRUNC(bookings_source_src_28000.paid_at, isoweek) AS paid_at__week - , DATE_TRUNC(bookings_source_src_28000.paid_at, month) AS paid_at__month - , DATE_TRUNC(bookings_source_src_28000.paid_at, quarter) AS paid_at__quarter - , DATE_TRUNC(bookings_source_src_28000.paid_at, year) AS paid_at__year + , DATETIME_TRUNC(bookings_source_src_28000.paid_at, day) AS paid_at__day + , DATETIME_TRUNC(bookings_source_src_28000.paid_at, isoweek) AS paid_at__week + , DATETIME_TRUNC(bookings_source_src_28000.paid_at, month) AS paid_at__month + , DATETIME_TRUNC(bookings_source_src_28000.paid_at, quarter) AS paid_at__quarter + , DATETIME_TRUNC(bookings_source_src_28000.paid_at, year) AS paid_at__year , EXTRACT(year FROM bookings_source_src_28000.paid_at) AS paid_at__extract_year , EXTRACT(quarter FROM bookings_source_src_28000.paid_at) AS paid_at__extract_quarter , EXTRACT(month FROM bookings_source_src_28000.paid_at) AS paid_at__extract_month @@ -283,33 +283,33 @@ FROM ( , IF(EXTRACT(dayofweek FROM bookings_source_src_28000.paid_at) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_28000.paid_at) - 1) AS paid_at__extract_dow , EXTRACT(dayofyear FROM bookings_source_src_28000.paid_at) AS paid_at__extract_doy , bookings_source_src_28000.is_instant AS booking__is_instant - , DATE_TRUNC(bookings_source_src_28000.ds, day) AS booking__ds__day - , DATE_TRUNC(bookings_source_src_28000.ds, isoweek) AS booking__ds__week - , DATE_TRUNC(bookings_source_src_28000.ds, month) AS booking__ds__month - , DATE_TRUNC(bookings_source_src_28000.ds, quarter) AS booking__ds__quarter - , DATE_TRUNC(bookings_source_src_28000.ds, year) AS booking__ds__year + , DATETIME_TRUNC(bookings_source_src_28000.ds, day) AS booking__ds__day + , DATETIME_TRUNC(bookings_source_src_28000.ds, isoweek) AS booking__ds__week + , DATETIME_TRUNC(bookings_source_src_28000.ds, month) AS booking__ds__month + , DATETIME_TRUNC(bookings_source_src_28000.ds, quarter) AS booking__ds__quarter + , DATETIME_TRUNC(bookings_source_src_28000.ds, year) AS booking__ds__year , EXTRACT(year FROM bookings_source_src_28000.ds) AS booking__ds__extract_year , EXTRACT(quarter FROM bookings_source_src_28000.ds) AS booking__ds__extract_quarter , EXTRACT(month FROM bookings_source_src_28000.ds) AS booking__ds__extract_month , EXTRACT(day FROM bookings_source_src_28000.ds) AS booking__ds__extract_day , IF(EXTRACT(dayofweek FROM bookings_source_src_28000.ds) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_28000.ds) - 1) AS booking__ds__extract_dow , EXTRACT(dayofyear FROM bookings_source_src_28000.ds) AS booking__ds__extract_doy - , DATE_TRUNC(bookings_source_src_28000.ds_partitioned, day) AS booking__ds_partitioned__day - , DATE_TRUNC(bookings_source_src_28000.ds_partitioned, isoweek) AS booking__ds_partitioned__week - , DATE_TRUNC(bookings_source_src_28000.ds_partitioned, month) AS booking__ds_partitioned__month - , DATE_TRUNC(bookings_source_src_28000.ds_partitioned, quarter) AS booking__ds_partitioned__quarter - , DATE_TRUNC(bookings_source_src_28000.ds_partitioned, year) AS booking__ds_partitioned__year + , DATETIME_TRUNC(bookings_source_src_28000.ds_partitioned, day) AS booking__ds_partitioned__day + , DATETIME_TRUNC(bookings_source_src_28000.ds_partitioned, isoweek) AS booking__ds_partitioned__week + , DATETIME_TRUNC(bookings_source_src_28000.ds_partitioned, month) AS booking__ds_partitioned__month + , DATETIME_TRUNC(bookings_source_src_28000.ds_partitioned, quarter) AS booking__ds_partitioned__quarter + , DATETIME_TRUNC(bookings_source_src_28000.ds_partitioned, year) AS booking__ds_partitioned__year , EXTRACT(year FROM bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__extract_year , EXTRACT(quarter FROM bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__extract_quarter , EXTRACT(month FROM bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__extract_month , EXTRACT(day FROM bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__extract_day , IF(EXTRACT(dayofweek FROM bookings_source_src_28000.ds_partitioned) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_28000.ds_partitioned) - 1) AS booking__ds_partitioned__extract_dow , EXTRACT(dayofyear FROM bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__extract_doy - , DATE_TRUNC(bookings_source_src_28000.paid_at, day) AS booking__paid_at__day - , DATE_TRUNC(bookings_source_src_28000.paid_at, isoweek) AS booking__paid_at__week - , DATE_TRUNC(bookings_source_src_28000.paid_at, month) AS booking__paid_at__month - , DATE_TRUNC(bookings_source_src_28000.paid_at, quarter) AS booking__paid_at__quarter - , DATE_TRUNC(bookings_source_src_28000.paid_at, year) AS booking__paid_at__year + , DATETIME_TRUNC(bookings_source_src_28000.paid_at, day) AS booking__paid_at__day + , DATETIME_TRUNC(bookings_source_src_28000.paid_at, isoweek) AS booking__paid_at__week + , DATETIME_TRUNC(bookings_source_src_28000.paid_at, month) AS booking__paid_at__month + , DATETIME_TRUNC(bookings_source_src_28000.paid_at, quarter) AS booking__paid_at__quarter + , DATETIME_TRUNC(bookings_source_src_28000.paid_at, year) AS booking__paid_at__year , EXTRACT(year FROM bookings_source_src_28000.paid_at) AS booking__paid_at__extract_year , EXTRACT(quarter FROM bookings_source_src_28000.paid_at) AS booking__paid_at__extract_quarter , EXTRACT(month FROM bookings_source_src_28000.paid_at) AS booking__paid_at__extract_month @@ -326,7 +326,7 @@ FROM ( ) subq_0 ) subq_1 ON - DATE_TRUNC(subq_2.metric_time__day, month) = subq_1.metric_time__day + DATETIME_TRUNC(subq_2.metric_time__day, month) = subq_1.metric_time__day ) subq_4 ) subq_5 GROUP BY @@ -352,10 +352,10 @@ FROM ( -- Join to Time Spine Dataset SELECT subq_10.metric_time__day AS metric_time__day - , DATE_TRUNC(subq_10.metric_time__day, isoweek) AS metric_time__week - , DATE_TRUNC(subq_10.metric_time__day, month) AS metric_time__month - , DATE_TRUNC(subq_10.metric_time__day, quarter) AS metric_time__quarter - , DATE_TRUNC(subq_10.metric_time__day, year) AS metric_time__year + , DATETIME_TRUNC(subq_10.metric_time__day, isoweek) AS metric_time__week + , DATETIME_TRUNC(subq_10.metric_time__day, month) AS metric_time__month + , DATETIME_TRUNC(subq_10.metric_time__day, quarter) AS metric_time__quarter + , DATETIME_TRUNC(subq_10.metric_time__day, year) AS metric_time__year , EXTRACT(year FROM subq_10.metric_time__day) AS metric_time__extract_year , EXTRACT(quarter FROM subq_10.metric_time__day) AS metric_time__extract_quarter , EXTRACT(month FROM subq_10.metric_time__day) AS metric_time__extract_month @@ -574,33 +574,33 @@ FROM ( , bookings_source_src_28000.booking_value AS approximate_continuous_booking_value_p99 , bookings_source_src_28000.booking_value AS approximate_discrete_booking_value_p99 , bookings_source_src_28000.is_instant - , DATE_TRUNC(bookings_source_src_28000.ds, day) AS ds__day - , DATE_TRUNC(bookings_source_src_28000.ds, isoweek) AS ds__week - , DATE_TRUNC(bookings_source_src_28000.ds, month) AS ds__month - , DATE_TRUNC(bookings_source_src_28000.ds, quarter) AS ds__quarter - , DATE_TRUNC(bookings_source_src_28000.ds, year) AS ds__year + , DATETIME_TRUNC(bookings_source_src_28000.ds, day) AS ds__day + , DATETIME_TRUNC(bookings_source_src_28000.ds, isoweek) AS ds__week + , DATETIME_TRUNC(bookings_source_src_28000.ds, month) AS ds__month + , DATETIME_TRUNC(bookings_source_src_28000.ds, quarter) AS ds__quarter + , DATETIME_TRUNC(bookings_source_src_28000.ds, year) AS ds__year , EXTRACT(year FROM bookings_source_src_28000.ds) AS ds__extract_year , EXTRACT(quarter FROM bookings_source_src_28000.ds) AS ds__extract_quarter , EXTRACT(month FROM bookings_source_src_28000.ds) AS ds__extract_month , EXTRACT(day FROM bookings_source_src_28000.ds) AS ds__extract_day , IF(EXTRACT(dayofweek FROM bookings_source_src_28000.ds) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_28000.ds) - 1) AS ds__extract_dow , EXTRACT(dayofyear FROM bookings_source_src_28000.ds) AS ds__extract_doy - , DATE_TRUNC(bookings_source_src_28000.ds_partitioned, day) AS ds_partitioned__day - , DATE_TRUNC(bookings_source_src_28000.ds_partitioned, isoweek) AS ds_partitioned__week - , DATE_TRUNC(bookings_source_src_28000.ds_partitioned, month) AS ds_partitioned__month - , DATE_TRUNC(bookings_source_src_28000.ds_partitioned, quarter) AS ds_partitioned__quarter - , DATE_TRUNC(bookings_source_src_28000.ds_partitioned, year) AS ds_partitioned__year + , DATETIME_TRUNC(bookings_source_src_28000.ds_partitioned, day) AS ds_partitioned__day + , DATETIME_TRUNC(bookings_source_src_28000.ds_partitioned, isoweek) AS ds_partitioned__week + , DATETIME_TRUNC(bookings_source_src_28000.ds_partitioned, month) AS ds_partitioned__month + , DATETIME_TRUNC(bookings_source_src_28000.ds_partitioned, quarter) AS ds_partitioned__quarter + , DATETIME_TRUNC(bookings_source_src_28000.ds_partitioned, year) AS ds_partitioned__year , EXTRACT(year FROM bookings_source_src_28000.ds_partitioned) AS ds_partitioned__extract_year , EXTRACT(quarter FROM bookings_source_src_28000.ds_partitioned) AS ds_partitioned__extract_quarter , EXTRACT(month FROM bookings_source_src_28000.ds_partitioned) AS ds_partitioned__extract_month , EXTRACT(day FROM bookings_source_src_28000.ds_partitioned) AS ds_partitioned__extract_day , IF(EXTRACT(dayofweek FROM bookings_source_src_28000.ds_partitioned) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_28000.ds_partitioned) - 1) AS ds_partitioned__extract_dow , EXTRACT(dayofyear FROM bookings_source_src_28000.ds_partitioned) AS ds_partitioned__extract_doy - , DATE_TRUNC(bookings_source_src_28000.paid_at, day) AS paid_at__day - , DATE_TRUNC(bookings_source_src_28000.paid_at, isoweek) AS paid_at__week - , DATE_TRUNC(bookings_source_src_28000.paid_at, month) AS paid_at__month - , DATE_TRUNC(bookings_source_src_28000.paid_at, quarter) AS paid_at__quarter - , DATE_TRUNC(bookings_source_src_28000.paid_at, year) AS paid_at__year + , DATETIME_TRUNC(bookings_source_src_28000.paid_at, day) AS paid_at__day + , DATETIME_TRUNC(bookings_source_src_28000.paid_at, isoweek) AS paid_at__week + , DATETIME_TRUNC(bookings_source_src_28000.paid_at, month) AS paid_at__month + , DATETIME_TRUNC(bookings_source_src_28000.paid_at, quarter) AS paid_at__quarter + , DATETIME_TRUNC(bookings_source_src_28000.paid_at, year) AS paid_at__year , EXTRACT(year FROM bookings_source_src_28000.paid_at) AS paid_at__extract_year , EXTRACT(quarter FROM bookings_source_src_28000.paid_at) AS paid_at__extract_quarter , EXTRACT(month FROM bookings_source_src_28000.paid_at) AS paid_at__extract_month @@ -608,33 +608,33 @@ FROM ( , IF(EXTRACT(dayofweek FROM bookings_source_src_28000.paid_at) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_28000.paid_at) - 1) AS paid_at__extract_dow , EXTRACT(dayofyear FROM bookings_source_src_28000.paid_at) AS paid_at__extract_doy , bookings_source_src_28000.is_instant AS booking__is_instant - , DATE_TRUNC(bookings_source_src_28000.ds, day) AS booking__ds__day - , DATE_TRUNC(bookings_source_src_28000.ds, isoweek) AS booking__ds__week - , DATE_TRUNC(bookings_source_src_28000.ds, month) AS booking__ds__month - , DATE_TRUNC(bookings_source_src_28000.ds, quarter) AS booking__ds__quarter - , DATE_TRUNC(bookings_source_src_28000.ds, year) AS booking__ds__year + , DATETIME_TRUNC(bookings_source_src_28000.ds, day) AS booking__ds__day + , DATETIME_TRUNC(bookings_source_src_28000.ds, isoweek) AS booking__ds__week + , DATETIME_TRUNC(bookings_source_src_28000.ds, month) AS booking__ds__month + , DATETIME_TRUNC(bookings_source_src_28000.ds, quarter) AS booking__ds__quarter + , DATETIME_TRUNC(bookings_source_src_28000.ds, year) AS booking__ds__year , EXTRACT(year FROM bookings_source_src_28000.ds) AS booking__ds__extract_year , EXTRACT(quarter FROM bookings_source_src_28000.ds) AS booking__ds__extract_quarter , EXTRACT(month FROM bookings_source_src_28000.ds) AS booking__ds__extract_month , EXTRACT(day FROM bookings_source_src_28000.ds) AS booking__ds__extract_day , IF(EXTRACT(dayofweek FROM bookings_source_src_28000.ds) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_28000.ds) - 1) AS booking__ds__extract_dow , EXTRACT(dayofyear FROM bookings_source_src_28000.ds) AS booking__ds__extract_doy - , DATE_TRUNC(bookings_source_src_28000.ds_partitioned, day) AS booking__ds_partitioned__day - , DATE_TRUNC(bookings_source_src_28000.ds_partitioned, isoweek) AS booking__ds_partitioned__week - , DATE_TRUNC(bookings_source_src_28000.ds_partitioned, month) AS booking__ds_partitioned__month - , DATE_TRUNC(bookings_source_src_28000.ds_partitioned, quarter) AS booking__ds_partitioned__quarter - , DATE_TRUNC(bookings_source_src_28000.ds_partitioned, year) AS booking__ds_partitioned__year + , DATETIME_TRUNC(bookings_source_src_28000.ds_partitioned, day) AS booking__ds_partitioned__day + , DATETIME_TRUNC(bookings_source_src_28000.ds_partitioned, isoweek) AS booking__ds_partitioned__week + , DATETIME_TRUNC(bookings_source_src_28000.ds_partitioned, month) AS booking__ds_partitioned__month + , DATETIME_TRUNC(bookings_source_src_28000.ds_partitioned, quarter) AS booking__ds_partitioned__quarter + , DATETIME_TRUNC(bookings_source_src_28000.ds_partitioned, year) AS booking__ds_partitioned__year , EXTRACT(year FROM bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__extract_year , EXTRACT(quarter FROM bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__extract_quarter , EXTRACT(month FROM bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__extract_month , EXTRACT(day FROM bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__extract_day , IF(EXTRACT(dayofweek FROM bookings_source_src_28000.ds_partitioned) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_28000.ds_partitioned) - 1) AS booking__ds_partitioned__extract_dow , EXTRACT(dayofyear FROM bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__extract_doy - , DATE_TRUNC(bookings_source_src_28000.paid_at, day) AS booking__paid_at__day - , DATE_TRUNC(bookings_source_src_28000.paid_at, isoweek) AS booking__paid_at__week - , DATE_TRUNC(bookings_source_src_28000.paid_at, month) AS booking__paid_at__month - , DATE_TRUNC(bookings_source_src_28000.paid_at, quarter) AS booking__paid_at__quarter - , DATE_TRUNC(bookings_source_src_28000.paid_at, year) AS booking__paid_at__year + , DATETIME_TRUNC(bookings_source_src_28000.paid_at, day) AS booking__paid_at__day + , DATETIME_TRUNC(bookings_source_src_28000.paid_at, isoweek) AS booking__paid_at__week + , DATETIME_TRUNC(bookings_source_src_28000.paid_at, month) AS booking__paid_at__month + , DATETIME_TRUNC(bookings_source_src_28000.paid_at, quarter) AS booking__paid_at__quarter + , DATETIME_TRUNC(bookings_source_src_28000.paid_at, year) AS booking__paid_at__year , EXTRACT(year FROM bookings_source_src_28000.paid_at) AS booking__paid_at__extract_year , EXTRACT(quarter FROM bookings_source_src_28000.paid_at) AS booking__paid_at__extract_quarter , EXTRACT(month FROM bookings_source_src_28000.paid_at) AS booking__paid_at__extract_month diff --git a/tests_metricflow/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/BigQuery/test_derived_metric_with_offset_window_and_offset_to_grain__plan0_optimized.sql b/tests_metricflow/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/BigQuery/test_derived_metric_with_offset_window_and_offset_to_grain__plan0_optimized.sql index 16ed33026e..40ca32a94a 100644 --- a/tests_metricflow/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/BigQuery/test_derived_metric_with_offset_window_and_offset_to_grain__plan0_optimized.sql +++ b/tests_metricflow/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/BigQuery/test_derived_metric_with_offset_window_and_offset_to_grain__plan0_optimized.sql @@ -21,12 +21,12 @@ FROM ( -- Read Elements From Semantic Model 'bookings_source' -- Metric Time Dimension 'ds' SELECT - DATE_TRUNC(ds, day) AS metric_time__day + DATETIME_TRUNC(ds, day) AS metric_time__day , 1 AS bookings FROM ***************************.fct_bookings bookings_source_src_28000 ) subq_18 ON - DATE_TRUNC(subq_20.ds, month) = subq_18.metric_time__day + DATETIME_TRUNC(subq_20.ds, month) = subq_18.metric_time__day GROUP BY metric_time__day ) subq_24 @@ -43,7 +43,7 @@ FROM ( -- Read Elements From Semantic Model 'bookings_source' -- Metric Time Dimension 'ds' SELECT - DATE_TRUNC(ds, day) AS metric_time__day + DATETIME_TRUNC(ds, day) AS metric_time__day , 1 AS bookings FROM ***************************.fct_bookings bookings_source_src_28000 ) subq_26 diff --git a/tests_metricflow/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/BigQuery/test_derived_metric_with_offset_window_and_offset_to_grain_and_granularity__plan0.sql b/tests_metricflow/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/BigQuery/test_derived_metric_with_offset_window_and_offset_to_grain_and_granularity__plan0.sql index 8ddffc82cf..71afc56e73 100644 --- a/tests_metricflow/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/BigQuery/test_derived_metric_with_offset_window_and_offset_to_grain_and_granularity__plan0.sql +++ b/tests_metricflow/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/BigQuery/test_derived_metric_with_offset_window_and_offset_to_grain_and_granularity__plan0.sql @@ -27,10 +27,10 @@ FROM ( -- Join to Time Spine Dataset SELECT subq_2.metric_time__day AS metric_time__day - , DATE_TRUNC(subq_2.metric_time__day, isoweek) AS metric_time__week - , DATE_TRUNC(subq_2.metric_time__day, month) AS metric_time__month - , DATE_TRUNC(subq_2.metric_time__day, quarter) AS metric_time__quarter - , DATE_TRUNC(subq_2.metric_time__day, year) AS metric_time__year + , DATETIME_TRUNC(subq_2.metric_time__day, isoweek) AS metric_time__week + , DATETIME_TRUNC(subq_2.metric_time__day, month) AS metric_time__month + , DATETIME_TRUNC(subq_2.metric_time__day, quarter) AS metric_time__quarter + , DATETIME_TRUNC(subq_2.metric_time__day, year) AS metric_time__year , EXTRACT(year FROM subq_2.metric_time__day) AS metric_time__extract_year , EXTRACT(quarter FROM subq_2.metric_time__day) AS metric_time__extract_quarter , EXTRACT(month FROM subq_2.metric_time__day) AS metric_time__extract_month @@ -249,33 +249,33 @@ FROM ( , bookings_source_src_28000.booking_value AS approximate_continuous_booking_value_p99 , bookings_source_src_28000.booking_value AS approximate_discrete_booking_value_p99 , bookings_source_src_28000.is_instant - , DATE_TRUNC(bookings_source_src_28000.ds, day) AS ds__day - , DATE_TRUNC(bookings_source_src_28000.ds, isoweek) AS ds__week - , DATE_TRUNC(bookings_source_src_28000.ds, month) AS ds__month - , DATE_TRUNC(bookings_source_src_28000.ds, quarter) AS ds__quarter - , DATE_TRUNC(bookings_source_src_28000.ds, year) AS ds__year + , DATETIME_TRUNC(bookings_source_src_28000.ds, day) AS ds__day + , DATETIME_TRUNC(bookings_source_src_28000.ds, isoweek) AS ds__week + , DATETIME_TRUNC(bookings_source_src_28000.ds, month) AS ds__month + , DATETIME_TRUNC(bookings_source_src_28000.ds, quarter) AS ds__quarter + , DATETIME_TRUNC(bookings_source_src_28000.ds, year) AS ds__year , EXTRACT(year FROM bookings_source_src_28000.ds) AS ds__extract_year , EXTRACT(quarter FROM bookings_source_src_28000.ds) AS ds__extract_quarter , EXTRACT(month FROM bookings_source_src_28000.ds) AS ds__extract_month , EXTRACT(day FROM bookings_source_src_28000.ds) AS ds__extract_day , IF(EXTRACT(dayofweek FROM bookings_source_src_28000.ds) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_28000.ds) - 1) AS ds__extract_dow , EXTRACT(dayofyear FROM bookings_source_src_28000.ds) AS ds__extract_doy - , DATE_TRUNC(bookings_source_src_28000.ds_partitioned, day) AS ds_partitioned__day - , DATE_TRUNC(bookings_source_src_28000.ds_partitioned, isoweek) AS ds_partitioned__week - , DATE_TRUNC(bookings_source_src_28000.ds_partitioned, month) AS ds_partitioned__month - , DATE_TRUNC(bookings_source_src_28000.ds_partitioned, quarter) AS ds_partitioned__quarter - , DATE_TRUNC(bookings_source_src_28000.ds_partitioned, year) AS ds_partitioned__year + , DATETIME_TRUNC(bookings_source_src_28000.ds_partitioned, day) AS ds_partitioned__day + , DATETIME_TRUNC(bookings_source_src_28000.ds_partitioned, isoweek) AS ds_partitioned__week + , DATETIME_TRUNC(bookings_source_src_28000.ds_partitioned, month) AS ds_partitioned__month + , DATETIME_TRUNC(bookings_source_src_28000.ds_partitioned, quarter) AS ds_partitioned__quarter + , DATETIME_TRUNC(bookings_source_src_28000.ds_partitioned, year) AS ds_partitioned__year , EXTRACT(year FROM bookings_source_src_28000.ds_partitioned) AS ds_partitioned__extract_year , EXTRACT(quarter FROM bookings_source_src_28000.ds_partitioned) AS ds_partitioned__extract_quarter , EXTRACT(month FROM bookings_source_src_28000.ds_partitioned) AS ds_partitioned__extract_month , EXTRACT(day FROM bookings_source_src_28000.ds_partitioned) AS ds_partitioned__extract_day , IF(EXTRACT(dayofweek FROM bookings_source_src_28000.ds_partitioned) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_28000.ds_partitioned) - 1) AS ds_partitioned__extract_dow , EXTRACT(dayofyear FROM bookings_source_src_28000.ds_partitioned) AS ds_partitioned__extract_doy - , DATE_TRUNC(bookings_source_src_28000.paid_at, day) AS paid_at__day - , DATE_TRUNC(bookings_source_src_28000.paid_at, isoweek) AS paid_at__week - , DATE_TRUNC(bookings_source_src_28000.paid_at, month) AS paid_at__month - , DATE_TRUNC(bookings_source_src_28000.paid_at, quarter) AS paid_at__quarter - , DATE_TRUNC(bookings_source_src_28000.paid_at, year) AS paid_at__year + , DATETIME_TRUNC(bookings_source_src_28000.paid_at, day) AS paid_at__day + , DATETIME_TRUNC(bookings_source_src_28000.paid_at, isoweek) AS paid_at__week + , DATETIME_TRUNC(bookings_source_src_28000.paid_at, month) AS paid_at__month + , DATETIME_TRUNC(bookings_source_src_28000.paid_at, quarter) AS paid_at__quarter + , DATETIME_TRUNC(bookings_source_src_28000.paid_at, year) AS paid_at__year , EXTRACT(year FROM bookings_source_src_28000.paid_at) AS paid_at__extract_year , EXTRACT(quarter FROM bookings_source_src_28000.paid_at) AS paid_at__extract_quarter , EXTRACT(month FROM bookings_source_src_28000.paid_at) AS paid_at__extract_month @@ -283,33 +283,33 @@ FROM ( , IF(EXTRACT(dayofweek FROM bookings_source_src_28000.paid_at) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_28000.paid_at) - 1) AS paid_at__extract_dow , EXTRACT(dayofyear FROM bookings_source_src_28000.paid_at) AS paid_at__extract_doy , bookings_source_src_28000.is_instant AS booking__is_instant - , DATE_TRUNC(bookings_source_src_28000.ds, day) AS booking__ds__day - , DATE_TRUNC(bookings_source_src_28000.ds, isoweek) AS booking__ds__week - , DATE_TRUNC(bookings_source_src_28000.ds, month) AS booking__ds__month - , DATE_TRUNC(bookings_source_src_28000.ds, quarter) AS booking__ds__quarter - , DATE_TRUNC(bookings_source_src_28000.ds, year) AS booking__ds__year + , DATETIME_TRUNC(bookings_source_src_28000.ds, day) AS booking__ds__day + , DATETIME_TRUNC(bookings_source_src_28000.ds, isoweek) AS booking__ds__week + , DATETIME_TRUNC(bookings_source_src_28000.ds, month) AS booking__ds__month + , DATETIME_TRUNC(bookings_source_src_28000.ds, quarter) AS booking__ds__quarter + , DATETIME_TRUNC(bookings_source_src_28000.ds, year) AS booking__ds__year , EXTRACT(year FROM bookings_source_src_28000.ds) AS booking__ds__extract_year , EXTRACT(quarter FROM bookings_source_src_28000.ds) AS booking__ds__extract_quarter , EXTRACT(month FROM bookings_source_src_28000.ds) AS booking__ds__extract_month , EXTRACT(day FROM bookings_source_src_28000.ds) AS booking__ds__extract_day , IF(EXTRACT(dayofweek FROM bookings_source_src_28000.ds) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_28000.ds) - 1) AS booking__ds__extract_dow , EXTRACT(dayofyear FROM bookings_source_src_28000.ds) AS booking__ds__extract_doy - , DATE_TRUNC(bookings_source_src_28000.ds_partitioned, day) AS booking__ds_partitioned__day - , DATE_TRUNC(bookings_source_src_28000.ds_partitioned, isoweek) AS booking__ds_partitioned__week - , DATE_TRUNC(bookings_source_src_28000.ds_partitioned, month) AS booking__ds_partitioned__month - , DATE_TRUNC(bookings_source_src_28000.ds_partitioned, quarter) AS booking__ds_partitioned__quarter - , DATE_TRUNC(bookings_source_src_28000.ds_partitioned, year) AS booking__ds_partitioned__year + , DATETIME_TRUNC(bookings_source_src_28000.ds_partitioned, day) AS booking__ds_partitioned__day + , DATETIME_TRUNC(bookings_source_src_28000.ds_partitioned, isoweek) AS booking__ds_partitioned__week + , DATETIME_TRUNC(bookings_source_src_28000.ds_partitioned, month) AS booking__ds_partitioned__month + , DATETIME_TRUNC(bookings_source_src_28000.ds_partitioned, quarter) AS booking__ds_partitioned__quarter + , DATETIME_TRUNC(bookings_source_src_28000.ds_partitioned, year) AS booking__ds_partitioned__year , EXTRACT(year FROM bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__extract_year , EXTRACT(quarter FROM bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__extract_quarter , EXTRACT(month FROM bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__extract_month , EXTRACT(day FROM bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__extract_day , IF(EXTRACT(dayofweek FROM bookings_source_src_28000.ds_partitioned) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_28000.ds_partitioned) - 1) AS booking__ds_partitioned__extract_dow , EXTRACT(dayofyear FROM bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__extract_doy - , DATE_TRUNC(bookings_source_src_28000.paid_at, day) AS booking__paid_at__day - , DATE_TRUNC(bookings_source_src_28000.paid_at, isoweek) AS booking__paid_at__week - , DATE_TRUNC(bookings_source_src_28000.paid_at, month) AS booking__paid_at__month - , DATE_TRUNC(bookings_source_src_28000.paid_at, quarter) AS booking__paid_at__quarter - , DATE_TRUNC(bookings_source_src_28000.paid_at, year) AS booking__paid_at__year + , DATETIME_TRUNC(bookings_source_src_28000.paid_at, day) AS booking__paid_at__day + , DATETIME_TRUNC(bookings_source_src_28000.paid_at, isoweek) AS booking__paid_at__week + , DATETIME_TRUNC(bookings_source_src_28000.paid_at, month) AS booking__paid_at__month + , DATETIME_TRUNC(bookings_source_src_28000.paid_at, quarter) AS booking__paid_at__quarter + , DATETIME_TRUNC(bookings_source_src_28000.paid_at, year) AS booking__paid_at__year , EXTRACT(year FROM bookings_source_src_28000.paid_at) AS booking__paid_at__extract_year , EXTRACT(quarter FROM bookings_source_src_28000.paid_at) AS booking__paid_at__extract_quarter , EXTRACT(month FROM bookings_source_src_28000.paid_at) AS booking__paid_at__extract_month @@ -326,8 +326,8 @@ FROM ( ) subq_0 ) subq_1 ON - DATE_TRUNC(subq_2.metric_time__day, month) = subq_1.metric_time__day - WHERE DATE_TRUNC(subq_2.metric_time__day, year) = subq_2.metric_time__day + DATETIME_TRUNC(subq_2.metric_time__day, month) = subq_1.metric_time__day + WHERE DATETIME_TRUNC(subq_2.metric_time__day, year) = subq_2.metric_time__day ) subq_4 ) subq_5 GROUP BY @@ -353,10 +353,10 @@ FROM ( -- Join to Time Spine Dataset SELECT subq_10.metric_time__day AS metric_time__day - , DATE_TRUNC(subq_10.metric_time__day, isoweek) AS metric_time__week - , DATE_TRUNC(subq_10.metric_time__day, month) AS metric_time__month - , DATE_TRUNC(subq_10.metric_time__day, quarter) AS metric_time__quarter - , DATE_TRUNC(subq_10.metric_time__day, year) AS metric_time__year + , DATETIME_TRUNC(subq_10.metric_time__day, isoweek) AS metric_time__week + , DATETIME_TRUNC(subq_10.metric_time__day, month) AS metric_time__month + , DATETIME_TRUNC(subq_10.metric_time__day, quarter) AS metric_time__quarter + , DATETIME_TRUNC(subq_10.metric_time__day, year) AS metric_time__year , EXTRACT(year FROM subq_10.metric_time__day) AS metric_time__extract_year , EXTRACT(quarter FROM subq_10.metric_time__day) AS metric_time__extract_quarter , EXTRACT(month FROM subq_10.metric_time__day) AS metric_time__extract_month @@ -575,33 +575,33 @@ FROM ( , bookings_source_src_28000.booking_value AS approximate_continuous_booking_value_p99 , bookings_source_src_28000.booking_value AS approximate_discrete_booking_value_p99 , bookings_source_src_28000.is_instant - , DATE_TRUNC(bookings_source_src_28000.ds, day) AS ds__day - , DATE_TRUNC(bookings_source_src_28000.ds, isoweek) AS ds__week - , DATE_TRUNC(bookings_source_src_28000.ds, month) AS ds__month - , DATE_TRUNC(bookings_source_src_28000.ds, quarter) AS ds__quarter - , DATE_TRUNC(bookings_source_src_28000.ds, year) AS ds__year + , DATETIME_TRUNC(bookings_source_src_28000.ds, day) AS ds__day + , DATETIME_TRUNC(bookings_source_src_28000.ds, isoweek) AS ds__week + , DATETIME_TRUNC(bookings_source_src_28000.ds, month) AS ds__month + , DATETIME_TRUNC(bookings_source_src_28000.ds, quarter) AS ds__quarter + , DATETIME_TRUNC(bookings_source_src_28000.ds, year) AS ds__year , EXTRACT(year FROM bookings_source_src_28000.ds) AS ds__extract_year , EXTRACT(quarter FROM bookings_source_src_28000.ds) AS ds__extract_quarter , EXTRACT(month FROM bookings_source_src_28000.ds) AS ds__extract_month , EXTRACT(day FROM bookings_source_src_28000.ds) AS ds__extract_day , IF(EXTRACT(dayofweek FROM bookings_source_src_28000.ds) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_28000.ds) - 1) AS ds__extract_dow , EXTRACT(dayofyear FROM bookings_source_src_28000.ds) AS ds__extract_doy - , DATE_TRUNC(bookings_source_src_28000.ds_partitioned, day) AS ds_partitioned__day - , DATE_TRUNC(bookings_source_src_28000.ds_partitioned, isoweek) AS ds_partitioned__week - , DATE_TRUNC(bookings_source_src_28000.ds_partitioned, month) AS ds_partitioned__month - , DATE_TRUNC(bookings_source_src_28000.ds_partitioned, quarter) AS ds_partitioned__quarter - , DATE_TRUNC(bookings_source_src_28000.ds_partitioned, year) AS ds_partitioned__year + , DATETIME_TRUNC(bookings_source_src_28000.ds_partitioned, day) AS ds_partitioned__day + , DATETIME_TRUNC(bookings_source_src_28000.ds_partitioned, isoweek) AS ds_partitioned__week + , DATETIME_TRUNC(bookings_source_src_28000.ds_partitioned, month) AS ds_partitioned__month + , DATETIME_TRUNC(bookings_source_src_28000.ds_partitioned, quarter) AS ds_partitioned__quarter + , DATETIME_TRUNC(bookings_source_src_28000.ds_partitioned, year) AS ds_partitioned__year , EXTRACT(year FROM bookings_source_src_28000.ds_partitioned) AS ds_partitioned__extract_year , EXTRACT(quarter FROM bookings_source_src_28000.ds_partitioned) AS ds_partitioned__extract_quarter , EXTRACT(month FROM bookings_source_src_28000.ds_partitioned) AS ds_partitioned__extract_month , EXTRACT(day FROM bookings_source_src_28000.ds_partitioned) AS ds_partitioned__extract_day , IF(EXTRACT(dayofweek FROM bookings_source_src_28000.ds_partitioned) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_28000.ds_partitioned) - 1) AS ds_partitioned__extract_dow , EXTRACT(dayofyear FROM bookings_source_src_28000.ds_partitioned) AS ds_partitioned__extract_doy - , DATE_TRUNC(bookings_source_src_28000.paid_at, day) AS paid_at__day - , DATE_TRUNC(bookings_source_src_28000.paid_at, isoweek) AS paid_at__week - , DATE_TRUNC(bookings_source_src_28000.paid_at, month) AS paid_at__month - , DATE_TRUNC(bookings_source_src_28000.paid_at, quarter) AS paid_at__quarter - , DATE_TRUNC(bookings_source_src_28000.paid_at, year) AS paid_at__year + , DATETIME_TRUNC(bookings_source_src_28000.paid_at, day) AS paid_at__day + , DATETIME_TRUNC(bookings_source_src_28000.paid_at, isoweek) AS paid_at__week + , DATETIME_TRUNC(bookings_source_src_28000.paid_at, month) AS paid_at__month + , DATETIME_TRUNC(bookings_source_src_28000.paid_at, quarter) AS paid_at__quarter + , DATETIME_TRUNC(bookings_source_src_28000.paid_at, year) AS paid_at__year , EXTRACT(year FROM bookings_source_src_28000.paid_at) AS paid_at__extract_year , EXTRACT(quarter FROM bookings_source_src_28000.paid_at) AS paid_at__extract_quarter , EXTRACT(month FROM bookings_source_src_28000.paid_at) AS paid_at__extract_month @@ -609,33 +609,33 @@ FROM ( , IF(EXTRACT(dayofweek FROM bookings_source_src_28000.paid_at) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_28000.paid_at) - 1) AS paid_at__extract_dow , EXTRACT(dayofyear FROM bookings_source_src_28000.paid_at) AS paid_at__extract_doy , bookings_source_src_28000.is_instant AS booking__is_instant - , DATE_TRUNC(bookings_source_src_28000.ds, day) AS booking__ds__day - , DATE_TRUNC(bookings_source_src_28000.ds, isoweek) AS booking__ds__week - , DATE_TRUNC(bookings_source_src_28000.ds, month) AS booking__ds__month - , DATE_TRUNC(bookings_source_src_28000.ds, quarter) AS booking__ds__quarter - , DATE_TRUNC(bookings_source_src_28000.ds, year) AS booking__ds__year + , DATETIME_TRUNC(bookings_source_src_28000.ds, day) AS booking__ds__day + , DATETIME_TRUNC(bookings_source_src_28000.ds, isoweek) AS booking__ds__week + , DATETIME_TRUNC(bookings_source_src_28000.ds, month) AS booking__ds__month + , DATETIME_TRUNC(bookings_source_src_28000.ds, quarter) AS booking__ds__quarter + , DATETIME_TRUNC(bookings_source_src_28000.ds, year) AS booking__ds__year , EXTRACT(year FROM bookings_source_src_28000.ds) AS booking__ds__extract_year , EXTRACT(quarter FROM bookings_source_src_28000.ds) AS booking__ds__extract_quarter , EXTRACT(month FROM bookings_source_src_28000.ds) AS booking__ds__extract_month , EXTRACT(day FROM bookings_source_src_28000.ds) AS booking__ds__extract_day , IF(EXTRACT(dayofweek FROM bookings_source_src_28000.ds) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_28000.ds) - 1) AS booking__ds__extract_dow , EXTRACT(dayofyear FROM bookings_source_src_28000.ds) AS booking__ds__extract_doy - , DATE_TRUNC(bookings_source_src_28000.ds_partitioned, day) AS booking__ds_partitioned__day - , DATE_TRUNC(bookings_source_src_28000.ds_partitioned, isoweek) AS booking__ds_partitioned__week - , DATE_TRUNC(bookings_source_src_28000.ds_partitioned, month) AS booking__ds_partitioned__month - , DATE_TRUNC(bookings_source_src_28000.ds_partitioned, quarter) AS booking__ds_partitioned__quarter - , DATE_TRUNC(bookings_source_src_28000.ds_partitioned, year) AS booking__ds_partitioned__year + , DATETIME_TRUNC(bookings_source_src_28000.ds_partitioned, day) AS booking__ds_partitioned__day + , DATETIME_TRUNC(bookings_source_src_28000.ds_partitioned, isoweek) AS booking__ds_partitioned__week + , DATETIME_TRUNC(bookings_source_src_28000.ds_partitioned, month) AS booking__ds_partitioned__month + , DATETIME_TRUNC(bookings_source_src_28000.ds_partitioned, quarter) AS booking__ds_partitioned__quarter + , DATETIME_TRUNC(bookings_source_src_28000.ds_partitioned, year) AS booking__ds_partitioned__year , EXTRACT(year FROM bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__extract_year , EXTRACT(quarter FROM bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__extract_quarter , EXTRACT(month FROM bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__extract_month , EXTRACT(day FROM bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__extract_day , IF(EXTRACT(dayofweek FROM bookings_source_src_28000.ds_partitioned) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_28000.ds_partitioned) - 1) AS booking__ds_partitioned__extract_dow , EXTRACT(dayofyear FROM bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__extract_doy - , DATE_TRUNC(bookings_source_src_28000.paid_at, day) AS booking__paid_at__day - , DATE_TRUNC(bookings_source_src_28000.paid_at, isoweek) AS booking__paid_at__week - , DATE_TRUNC(bookings_source_src_28000.paid_at, month) AS booking__paid_at__month - , DATE_TRUNC(bookings_source_src_28000.paid_at, quarter) AS booking__paid_at__quarter - , DATE_TRUNC(bookings_source_src_28000.paid_at, year) AS booking__paid_at__year + , DATETIME_TRUNC(bookings_source_src_28000.paid_at, day) AS booking__paid_at__day + , DATETIME_TRUNC(bookings_source_src_28000.paid_at, isoweek) AS booking__paid_at__week + , DATETIME_TRUNC(bookings_source_src_28000.paid_at, month) AS booking__paid_at__month + , DATETIME_TRUNC(bookings_source_src_28000.paid_at, quarter) AS booking__paid_at__quarter + , DATETIME_TRUNC(bookings_source_src_28000.paid_at, year) AS booking__paid_at__year , EXTRACT(year FROM bookings_source_src_28000.paid_at) AS booking__paid_at__extract_year , EXTRACT(quarter FROM bookings_source_src_28000.paid_at) AS booking__paid_at__extract_quarter , EXTRACT(month FROM bookings_source_src_28000.paid_at) AS booking__paid_at__extract_month diff --git a/tests_metricflow/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/BigQuery/test_derived_metric_with_offset_window_and_offset_to_grain_and_granularity__plan0_optimized.sql b/tests_metricflow/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/BigQuery/test_derived_metric_with_offset_window_and_offset_to_grain_and_granularity__plan0_optimized.sql index 5fd9063987..84e29631ce 100644 --- a/tests_metricflow/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/BigQuery/test_derived_metric_with_offset_window_and_offset_to_grain_and_granularity__plan0_optimized.sql +++ b/tests_metricflow/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/BigQuery/test_derived_metric_with_offset_window_and_offset_to_grain_and_granularity__plan0_optimized.sql @@ -14,20 +14,20 @@ FROM ( -- Aggregate Measures -- Compute Metrics via Expressions SELECT - DATE_TRUNC(subq_20.ds, year) AS metric_time__year + DATETIME_TRUNC(subq_20.ds, year) AS metric_time__year , SUM(subq_18.bookings) AS month_start_bookings FROM ***************************.mf_time_spine subq_20 INNER JOIN ( -- Read Elements From Semantic Model 'bookings_source' -- Metric Time Dimension 'ds' SELECT - DATE_TRUNC(ds, day) AS metric_time__day + DATETIME_TRUNC(ds, day) AS metric_time__day , 1 AS bookings FROM ***************************.fct_bookings bookings_source_src_28000 ) subq_18 ON - DATE_TRUNC(subq_20.ds, month) = subq_18.metric_time__day - WHERE DATE_TRUNC(subq_20.ds, year) = subq_20.ds + DATETIME_TRUNC(subq_20.ds, month) = subq_18.metric_time__day + WHERE DATETIME_TRUNC(subq_20.ds, year) = subq_20.ds GROUP BY metric_time__year ) subq_24 @@ -37,14 +37,14 @@ FROM ( -- Aggregate Measures -- Compute Metrics via Expressions SELECT - DATE_TRUNC(subq_28.ds, year) AS metric_time__year + DATETIME_TRUNC(subq_28.ds, year) AS metric_time__year , SUM(subq_26.bookings) AS bookings_1_month_ago FROM ***************************.mf_time_spine subq_28 INNER JOIN ( -- Read Elements From Semantic Model 'bookings_source' -- Metric Time Dimension 'ds' SELECT - DATE_TRUNC(ds, day) AS metric_time__day + DATETIME_TRUNC(ds, day) AS metric_time__day , 1 AS bookings FROM ***************************.fct_bookings bookings_source_src_28000 ) subq_26 diff --git a/tests_metricflow/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/BigQuery/test_derived_metric_with_offset_window_and_time_filter__plan0.sql b/tests_metricflow/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/BigQuery/test_derived_metric_with_offset_window_and_time_filter__plan0.sql index e98d771f86..8a5180f7c6 100644 --- a/tests_metricflow/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/BigQuery/test_derived_metric_with_offset_window_and_time_filter__plan0.sql +++ b/tests_metricflow/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/BigQuery/test_derived_metric_with_offset_window_and_time_filter__plan0.sql @@ -147,33 +147,33 @@ FROM ( , bookings_source_src_28000.booking_value AS approximate_continuous_booking_value_p99 , bookings_source_src_28000.booking_value AS approximate_discrete_booking_value_p99 , bookings_source_src_28000.is_instant - , DATE_TRUNC(bookings_source_src_28000.ds, day) AS ds__day - , DATE_TRUNC(bookings_source_src_28000.ds, isoweek) AS ds__week - , DATE_TRUNC(bookings_source_src_28000.ds, month) AS ds__month - , DATE_TRUNC(bookings_source_src_28000.ds, quarter) AS ds__quarter - , DATE_TRUNC(bookings_source_src_28000.ds, year) AS ds__year + , DATETIME_TRUNC(bookings_source_src_28000.ds, day) AS ds__day + , DATETIME_TRUNC(bookings_source_src_28000.ds, isoweek) AS ds__week + , DATETIME_TRUNC(bookings_source_src_28000.ds, month) AS ds__month + , DATETIME_TRUNC(bookings_source_src_28000.ds, quarter) AS ds__quarter + , DATETIME_TRUNC(bookings_source_src_28000.ds, year) AS ds__year , EXTRACT(year FROM bookings_source_src_28000.ds) AS ds__extract_year , EXTRACT(quarter FROM bookings_source_src_28000.ds) AS ds__extract_quarter , EXTRACT(month FROM bookings_source_src_28000.ds) AS ds__extract_month , EXTRACT(day FROM bookings_source_src_28000.ds) AS ds__extract_day , IF(EXTRACT(dayofweek FROM bookings_source_src_28000.ds) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_28000.ds) - 1) AS ds__extract_dow , EXTRACT(dayofyear FROM bookings_source_src_28000.ds) AS ds__extract_doy - , DATE_TRUNC(bookings_source_src_28000.ds_partitioned, day) AS ds_partitioned__day - , DATE_TRUNC(bookings_source_src_28000.ds_partitioned, isoweek) AS ds_partitioned__week - , DATE_TRUNC(bookings_source_src_28000.ds_partitioned, month) AS ds_partitioned__month - , DATE_TRUNC(bookings_source_src_28000.ds_partitioned, quarter) AS ds_partitioned__quarter - , DATE_TRUNC(bookings_source_src_28000.ds_partitioned, year) AS ds_partitioned__year + , DATETIME_TRUNC(bookings_source_src_28000.ds_partitioned, day) AS ds_partitioned__day + , DATETIME_TRUNC(bookings_source_src_28000.ds_partitioned, isoweek) AS ds_partitioned__week + , DATETIME_TRUNC(bookings_source_src_28000.ds_partitioned, month) AS ds_partitioned__month + , DATETIME_TRUNC(bookings_source_src_28000.ds_partitioned, quarter) AS ds_partitioned__quarter + , DATETIME_TRUNC(bookings_source_src_28000.ds_partitioned, year) AS ds_partitioned__year , EXTRACT(year FROM bookings_source_src_28000.ds_partitioned) AS ds_partitioned__extract_year , EXTRACT(quarter FROM bookings_source_src_28000.ds_partitioned) AS ds_partitioned__extract_quarter , EXTRACT(month FROM bookings_source_src_28000.ds_partitioned) AS ds_partitioned__extract_month , EXTRACT(day FROM bookings_source_src_28000.ds_partitioned) AS ds_partitioned__extract_day , IF(EXTRACT(dayofweek FROM bookings_source_src_28000.ds_partitioned) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_28000.ds_partitioned) - 1) AS ds_partitioned__extract_dow , EXTRACT(dayofyear FROM bookings_source_src_28000.ds_partitioned) AS ds_partitioned__extract_doy - , DATE_TRUNC(bookings_source_src_28000.paid_at, day) AS paid_at__day - , DATE_TRUNC(bookings_source_src_28000.paid_at, isoweek) AS paid_at__week - , DATE_TRUNC(bookings_source_src_28000.paid_at, month) AS paid_at__month - , DATE_TRUNC(bookings_source_src_28000.paid_at, quarter) AS paid_at__quarter - , DATE_TRUNC(bookings_source_src_28000.paid_at, year) AS paid_at__year + , DATETIME_TRUNC(bookings_source_src_28000.paid_at, day) AS paid_at__day + , DATETIME_TRUNC(bookings_source_src_28000.paid_at, isoweek) AS paid_at__week + , DATETIME_TRUNC(bookings_source_src_28000.paid_at, month) AS paid_at__month + , DATETIME_TRUNC(bookings_source_src_28000.paid_at, quarter) AS paid_at__quarter + , DATETIME_TRUNC(bookings_source_src_28000.paid_at, year) AS paid_at__year , EXTRACT(year FROM bookings_source_src_28000.paid_at) AS paid_at__extract_year , EXTRACT(quarter FROM bookings_source_src_28000.paid_at) AS paid_at__extract_quarter , EXTRACT(month FROM bookings_source_src_28000.paid_at) AS paid_at__extract_month @@ -181,33 +181,33 @@ FROM ( , IF(EXTRACT(dayofweek FROM bookings_source_src_28000.paid_at) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_28000.paid_at) - 1) AS paid_at__extract_dow , EXTRACT(dayofyear FROM bookings_source_src_28000.paid_at) AS paid_at__extract_doy , bookings_source_src_28000.is_instant AS booking__is_instant - , DATE_TRUNC(bookings_source_src_28000.ds, day) AS booking__ds__day - , DATE_TRUNC(bookings_source_src_28000.ds, isoweek) AS booking__ds__week - , DATE_TRUNC(bookings_source_src_28000.ds, month) AS booking__ds__month - , DATE_TRUNC(bookings_source_src_28000.ds, quarter) AS booking__ds__quarter - , DATE_TRUNC(bookings_source_src_28000.ds, year) AS booking__ds__year + , DATETIME_TRUNC(bookings_source_src_28000.ds, day) AS booking__ds__day + , DATETIME_TRUNC(bookings_source_src_28000.ds, isoweek) AS booking__ds__week + , DATETIME_TRUNC(bookings_source_src_28000.ds, month) AS booking__ds__month + , DATETIME_TRUNC(bookings_source_src_28000.ds, quarter) AS booking__ds__quarter + , DATETIME_TRUNC(bookings_source_src_28000.ds, year) AS booking__ds__year , EXTRACT(year FROM bookings_source_src_28000.ds) AS booking__ds__extract_year , EXTRACT(quarter FROM bookings_source_src_28000.ds) AS booking__ds__extract_quarter , EXTRACT(month FROM bookings_source_src_28000.ds) AS booking__ds__extract_month , EXTRACT(day FROM bookings_source_src_28000.ds) AS booking__ds__extract_day , IF(EXTRACT(dayofweek FROM bookings_source_src_28000.ds) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_28000.ds) - 1) AS booking__ds__extract_dow , EXTRACT(dayofyear FROM bookings_source_src_28000.ds) AS booking__ds__extract_doy - , DATE_TRUNC(bookings_source_src_28000.ds_partitioned, day) AS booking__ds_partitioned__day - , DATE_TRUNC(bookings_source_src_28000.ds_partitioned, isoweek) AS booking__ds_partitioned__week - , DATE_TRUNC(bookings_source_src_28000.ds_partitioned, month) AS booking__ds_partitioned__month - , DATE_TRUNC(bookings_source_src_28000.ds_partitioned, quarter) AS booking__ds_partitioned__quarter - , DATE_TRUNC(bookings_source_src_28000.ds_partitioned, year) AS booking__ds_partitioned__year + , DATETIME_TRUNC(bookings_source_src_28000.ds_partitioned, day) AS booking__ds_partitioned__day + , DATETIME_TRUNC(bookings_source_src_28000.ds_partitioned, isoweek) AS booking__ds_partitioned__week + , DATETIME_TRUNC(bookings_source_src_28000.ds_partitioned, month) AS booking__ds_partitioned__month + , DATETIME_TRUNC(bookings_source_src_28000.ds_partitioned, quarter) AS booking__ds_partitioned__quarter + , DATETIME_TRUNC(bookings_source_src_28000.ds_partitioned, year) AS booking__ds_partitioned__year , EXTRACT(year FROM bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__extract_year , EXTRACT(quarter FROM bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__extract_quarter , EXTRACT(month FROM bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__extract_month , EXTRACT(day FROM bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__extract_day , IF(EXTRACT(dayofweek FROM bookings_source_src_28000.ds_partitioned) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_28000.ds_partitioned) - 1) AS booking__ds_partitioned__extract_dow , EXTRACT(dayofyear FROM bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__extract_doy - , DATE_TRUNC(bookings_source_src_28000.paid_at, day) AS booking__paid_at__day - , DATE_TRUNC(bookings_source_src_28000.paid_at, isoweek) AS booking__paid_at__week - , DATE_TRUNC(bookings_source_src_28000.paid_at, month) AS booking__paid_at__month - , DATE_TRUNC(bookings_source_src_28000.paid_at, quarter) AS booking__paid_at__quarter - , DATE_TRUNC(bookings_source_src_28000.paid_at, year) AS booking__paid_at__year + , DATETIME_TRUNC(bookings_source_src_28000.paid_at, day) AS booking__paid_at__day + , DATETIME_TRUNC(bookings_source_src_28000.paid_at, isoweek) AS booking__paid_at__week + , DATETIME_TRUNC(bookings_source_src_28000.paid_at, month) AS booking__paid_at__month + , DATETIME_TRUNC(bookings_source_src_28000.paid_at, quarter) AS booking__paid_at__quarter + , DATETIME_TRUNC(bookings_source_src_28000.paid_at, year) AS booking__paid_at__year , EXTRACT(year FROM bookings_source_src_28000.paid_at) AS booking__paid_at__extract_year , EXTRACT(quarter FROM bookings_source_src_28000.paid_at) AS booking__paid_at__extract_quarter , EXTRACT(month FROM bookings_source_src_28000.paid_at) AS booking__paid_at__extract_month @@ -254,10 +254,10 @@ FROM ( -- Join to Time Spine Dataset SELECT subq_8.metric_time__day AS metric_time__day - , DATE_TRUNC(subq_8.metric_time__day, isoweek) AS metric_time__week - , DATE_TRUNC(subq_8.metric_time__day, month) AS metric_time__month - , DATE_TRUNC(subq_8.metric_time__day, quarter) AS metric_time__quarter - , DATE_TRUNC(subq_8.metric_time__day, year) AS metric_time__year + , DATETIME_TRUNC(subq_8.metric_time__day, isoweek) AS metric_time__week + , DATETIME_TRUNC(subq_8.metric_time__day, month) AS metric_time__month + , DATETIME_TRUNC(subq_8.metric_time__day, quarter) AS metric_time__quarter + , DATETIME_TRUNC(subq_8.metric_time__day, year) AS metric_time__year , EXTRACT(year FROM subq_8.metric_time__day) AS metric_time__extract_year , EXTRACT(quarter FROM subq_8.metric_time__day) AS metric_time__extract_quarter , EXTRACT(month FROM subq_8.metric_time__day) AS metric_time__extract_month @@ -476,33 +476,33 @@ FROM ( , bookings_source_src_28000.booking_value AS approximate_continuous_booking_value_p99 , bookings_source_src_28000.booking_value AS approximate_discrete_booking_value_p99 , bookings_source_src_28000.is_instant - , DATE_TRUNC(bookings_source_src_28000.ds, day) AS ds__day - , DATE_TRUNC(bookings_source_src_28000.ds, isoweek) AS ds__week - , DATE_TRUNC(bookings_source_src_28000.ds, month) AS ds__month - , DATE_TRUNC(bookings_source_src_28000.ds, quarter) AS ds__quarter - , DATE_TRUNC(bookings_source_src_28000.ds, year) AS ds__year + , DATETIME_TRUNC(bookings_source_src_28000.ds, day) AS ds__day + , DATETIME_TRUNC(bookings_source_src_28000.ds, isoweek) AS ds__week + , DATETIME_TRUNC(bookings_source_src_28000.ds, month) AS ds__month + , DATETIME_TRUNC(bookings_source_src_28000.ds, quarter) AS ds__quarter + , DATETIME_TRUNC(bookings_source_src_28000.ds, year) AS ds__year , EXTRACT(year FROM bookings_source_src_28000.ds) AS ds__extract_year , EXTRACT(quarter FROM bookings_source_src_28000.ds) AS ds__extract_quarter , EXTRACT(month FROM bookings_source_src_28000.ds) AS ds__extract_month , EXTRACT(day FROM bookings_source_src_28000.ds) AS ds__extract_day , IF(EXTRACT(dayofweek FROM bookings_source_src_28000.ds) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_28000.ds) - 1) AS ds__extract_dow , EXTRACT(dayofyear FROM bookings_source_src_28000.ds) AS ds__extract_doy - , DATE_TRUNC(bookings_source_src_28000.ds_partitioned, day) AS ds_partitioned__day - , DATE_TRUNC(bookings_source_src_28000.ds_partitioned, isoweek) AS ds_partitioned__week - , DATE_TRUNC(bookings_source_src_28000.ds_partitioned, month) AS ds_partitioned__month - , DATE_TRUNC(bookings_source_src_28000.ds_partitioned, quarter) AS ds_partitioned__quarter - , DATE_TRUNC(bookings_source_src_28000.ds_partitioned, year) AS ds_partitioned__year + , DATETIME_TRUNC(bookings_source_src_28000.ds_partitioned, day) AS ds_partitioned__day + , DATETIME_TRUNC(bookings_source_src_28000.ds_partitioned, isoweek) AS ds_partitioned__week + , DATETIME_TRUNC(bookings_source_src_28000.ds_partitioned, month) AS ds_partitioned__month + , DATETIME_TRUNC(bookings_source_src_28000.ds_partitioned, quarter) AS ds_partitioned__quarter + , DATETIME_TRUNC(bookings_source_src_28000.ds_partitioned, year) AS ds_partitioned__year , EXTRACT(year FROM bookings_source_src_28000.ds_partitioned) AS ds_partitioned__extract_year , EXTRACT(quarter FROM bookings_source_src_28000.ds_partitioned) AS ds_partitioned__extract_quarter , EXTRACT(month FROM bookings_source_src_28000.ds_partitioned) AS ds_partitioned__extract_month , EXTRACT(day FROM bookings_source_src_28000.ds_partitioned) AS ds_partitioned__extract_day , IF(EXTRACT(dayofweek FROM bookings_source_src_28000.ds_partitioned) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_28000.ds_partitioned) - 1) AS ds_partitioned__extract_dow , EXTRACT(dayofyear FROM bookings_source_src_28000.ds_partitioned) AS ds_partitioned__extract_doy - , DATE_TRUNC(bookings_source_src_28000.paid_at, day) AS paid_at__day - , DATE_TRUNC(bookings_source_src_28000.paid_at, isoweek) AS paid_at__week - , DATE_TRUNC(bookings_source_src_28000.paid_at, month) AS paid_at__month - , DATE_TRUNC(bookings_source_src_28000.paid_at, quarter) AS paid_at__quarter - , DATE_TRUNC(bookings_source_src_28000.paid_at, year) AS paid_at__year + , DATETIME_TRUNC(bookings_source_src_28000.paid_at, day) AS paid_at__day + , DATETIME_TRUNC(bookings_source_src_28000.paid_at, isoweek) AS paid_at__week + , DATETIME_TRUNC(bookings_source_src_28000.paid_at, month) AS paid_at__month + , DATETIME_TRUNC(bookings_source_src_28000.paid_at, quarter) AS paid_at__quarter + , DATETIME_TRUNC(bookings_source_src_28000.paid_at, year) AS paid_at__year , EXTRACT(year FROM bookings_source_src_28000.paid_at) AS paid_at__extract_year , EXTRACT(quarter FROM bookings_source_src_28000.paid_at) AS paid_at__extract_quarter , EXTRACT(month FROM bookings_source_src_28000.paid_at) AS paid_at__extract_month @@ -510,33 +510,33 @@ FROM ( , IF(EXTRACT(dayofweek FROM bookings_source_src_28000.paid_at) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_28000.paid_at) - 1) AS paid_at__extract_dow , EXTRACT(dayofyear FROM bookings_source_src_28000.paid_at) AS paid_at__extract_doy , bookings_source_src_28000.is_instant AS booking__is_instant - , DATE_TRUNC(bookings_source_src_28000.ds, day) AS booking__ds__day - , DATE_TRUNC(bookings_source_src_28000.ds, isoweek) AS booking__ds__week - , DATE_TRUNC(bookings_source_src_28000.ds, month) AS booking__ds__month - , DATE_TRUNC(bookings_source_src_28000.ds, quarter) AS booking__ds__quarter - , DATE_TRUNC(bookings_source_src_28000.ds, year) AS booking__ds__year + , DATETIME_TRUNC(bookings_source_src_28000.ds, day) AS booking__ds__day + , DATETIME_TRUNC(bookings_source_src_28000.ds, isoweek) AS booking__ds__week + , DATETIME_TRUNC(bookings_source_src_28000.ds, month) AS booking__ds__month + , DATETIME_TRUNC(bookings_source_src_28000.ds, quarter) AS booking__ds__quarter + , DATETIME_TRUNC(bookings_source_src_28000.ds, year) AS booking__ds__year , EXTRACT(year FROM bookings_source_src_28000.ds) AS booking__ds__extract_year , EXTRACT(quarter FROM bookings_source_src_28000.ds) AS booking__ds__extract_quarter , EXTRACT(month FROM bookings_source_src_28000.ds) AS booking__ds__extract_month , EXTRACT(day FROM bookings_source_src_28000.ds) AS booking__ds__extract_day , IF(EXTRACT(dayofweek FROM bookings_source_src_28000.ds) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_28000.ds) - 1) AS booking__ds__extract_dow , EXTRACT(dayofyear FROM bookings_source_src_28000.ds) AS booking__ds__extract_doy - , DATE_TRUNC(bookings_source_src_28000.ds_partitioned, day) AS booking__ds_partitioned__day - , DATE_TRUNC(bookings_source_src_28000.ds_partitioned, isoweek) AS booking__ds_partitioned__week - , DATE_TRUNC(bookings_source_src_28000.ds_partitioned, month) AS booking__ds_partitioned__month - , DATE_TRUNC(bookings_source_src_28000.ds_partitioned, quarter) AS booking__ds_partitioned__quarter - , DATE_TRUNC(bookings_source_src_28000.ds_partitioned, year) AS booking__ds_partitioned__year + , DATETIME_TRUNC(bookings_source_src_28000.ds_partitioned, day) AS booking__ds_partitioned__day + , DATETIME_TRUNC(bookings_source_src_28000.ds_partitioned, isoweek) AS booking__ds_partitioned__week + , DATETIME_TRUNC(bookings_source_src_28000.ds_partitioned, month) AS booking__ds_partitioned__month + , DATETIME_TRUNC(bookings_source_src_28000.ds_partitioned, quarter) AS booking__ds_partitioned__quarter + , DATETIME_TRUNC(bookings_source_src_28000.ds_partitioned, year) AS booking__ds_partitioned__year , EXTRACT(year FROM bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__extract_year , EXTRACT(quarter FROM bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__extract_quarter , EXTRACT(month FROM bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__extract_month , EXTRACT(day FROM bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__extract_day , IF(EXTRACT(dayofweek FROM bookings_source_src_28000.ds_partitioned) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_28000.ds_partitioned) - 1) AS booking__ds_partitioned__extract_dow , EXTRACT(dayofyear FROM bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__extract_doy - , DATE_TRUNC(bookings_source_src_28000.paid_at, day) AS booking__paid_at__day - , DATE_TRUNC(bookings_source_src_28000.paid_at, isoweek) AS booking__paid_at__week - , DATE_TRUNC(bookings_source_src_28000.paid_at, month) AS booking__paid_at__month - , DATE_TRUNC(bookings_source_src_28000.paid_at, quarter) AS booking__paid_at__quarter - , DATE_TRUNC(bookings_source_src_28000.paid_at, year) AS booking__paid_at__year + , DATETIME_TRUNC(bookings_source_src_28000.paid_at, day) AS booking__paid_at__day + , DATETIME_TRUNC(bookings_source_src_28000.paid_at, isoweek) AS booking__paid_at__week + , DATETIME_TRUNC(bookings_source_src_28000.paid_at, month) AS booking__paid_at__month + , DATETIME_TRUNC(bookings_source_src_28000.paid_at, quarter) AS booking__paid_at__quarter + , DATETIME_TRUNC(bookings_source_src_28000.paid_at, year) AS booking__paid_at__year , EXTRACT(year FROM bookings_source_src_28000.paid_at) AS booking__paid_at__extract_year , EXTRACT(quarter FROM bookings_source_src_28000.paid_at) AS booking__paid_at__extract_quarter , EXTRACT(month FROM bookings_source_src_28000.paid_at) AS booking__paid_at__extract_month diff --git a/tests_metricflow/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/BigQuery/test_derived_metric_with_offset_window_and_time_filter__plan0_optimized.sql b/tests_metricflow/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/BigQuery/test_derived_metric_with_offset_window_and_time_filter__plan0_optimized.sql index fb644a39ae..de4960ffcf 100644 --- a/tests_metricflow/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/BigQuery/test_derived_metric_with_offset_window_and_time_filter__plan0_optimized.sql +++ b/tests_metricflow/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/BigQuery/test_derived_metric_with_offset_window_and_time_filter__plan0_optimized.sql @@ -20,7 +20,7 @@ FROM ( -- Metric Time Dimension 'ds' -- Pass Only Elements: ['bookings', 'metric_time__day'] SELECT - DATE_TRUNC(ds, day) AS metric_time__day + DATETIME_TRUNC(ds, day) AS metric_time__day , 1 AS bookings FROM ***************************.fct_bookings bookings_source_src_28000 ) subq_18 @@ -46,7 +46,7 @@ FROM ( -- Read Elements From Semantic Model 'bookings_source' -- Metric Time Dimension 'ds' SELECT - DATE_TRUNC(ds, day) AS metric_time__day + DATETIME_TRUNC(ds, day) AS metric_time__day , 1 AS bookings FROM ***************************.fct_bookings bookings_source_src_28000 ) subq_23 diff --git a/tests_metricflow/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/BigQuery/test_derived_offset_cumulative_metric__plan0.sql b/tests_metricflow/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/BigQuery/test_derived_offset_cumulative_metric__plan0.sql index 22c78e3564..c384bf36f4 100644 --- a/tests_metricflow/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/BigQuery/test_derived_offset_cumulative_metric__plan0.sql +++ b/tests_metricflow/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/BigQuery/test_derived_offset_cumulative_metric__plan0.sql @@ -21,10 +21,10 @@ FROM ( -- Join to Time Spine Dataset SELECT subq_5.metric_time__day AS metric_time__day - , DATE_TRUNC(subq_5.metric_time__day, isoweek) AS metric_time__week - , DATE_TRUNC(subq_5.metric_time__day, month) AS metric_time__month - , DATE_TRUNC(subq_5.metric_time__day, quarter) AS metric_time__quarter - , DATE_TRUNC(subq_5.metric_time__day, year) AS metric_time__year + , DATETIME_TRUNC(subq_5.metric_time__day, isoweek) AS metric_time__week + , DATETIME_TRUNC(subq_5.metric_time__day, month) AS metric_time__month + , DATETIME_TRUNC(subq_5.metric_time__day, quarter) AS metric_time__quarter + , DATETIME_TRUNC(subq_5.metric_time__day, year) AS metric_time__year , EXTRACT(year FROM subq_5.metric_time__day) AS metric_time__extract_year , EXTRACT(quarter FROM subq_5.metric_time__day) AS metric_time__extract_quarter , EXTRACT(month FROM subq_5.metric_time__day) AS metric_time__extract_month @@ -350,33 +350,33 @@ FROM ( , bookings_source_src_28000.booking_value AS approximate_continuous_booking_value_p99 , bookings_source_src_28000.booking_value AS approximate_discrete_booking_value_p99 , bookings_source_src_28000.is_instant - , DATE_TRUNC(bookings_source_src_28000.ds, day) AS ds__day - , DATE_TRUNC(bookings_source_src_28000.ds, isoweek) AS ds__week - , DATE_TRUNC(bookings_source_src_28000.ds, month) AS ds__month - , DATE_TRUNC(bookings_source_src_28000.ds, quarter) AS ds__quarter - , DATE_TRUNC(bookings_source_src_28000.ds, year) AS ds__year + , DATETIME_TRUNC(bookings_source_src_28000.ds, day) AS ds__day + , DATETIME_TRUNC(bookings_source_src_28000.ds, isoweek) AS ds__week + , DATETIME_TRUNC(bookings_source_src_28000.ds, month) AS ds__month + , DATETIME_TRUNC(bookings_source_src_28000.ds, quarter) AS ds__quarter + , DATETIME_TRUNC(bookings_source_src_28000.ds, year) AS ds__year , EXTRACT(year FROM bookings_source_src_28000.ds) AS ds__extract_year , EXTRACT(quarter FROM bookings_source_src_28000.ds) AS ds__extract_quarter , EXTRACT(month FROM bookings_source_src_28000.ds) AS ds__extract_month , EXTRACT(day FROM bookings_source_src_28000.ds) AS ds__extract_day , IF(EXTRACT(dayofweek FROM bookings_source_src_28000.ds) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_28000.ds) - 1) AS ds__extract_dow , EXTRACT(dayofyear FROM bookings_source_src_28000.ds) AS ds__extract_doy - , DATE_TRUNC(bookings_source_src_28000.ds_partitioned, day) AS ds_partitioned__day - , DATE_TRUNC(bookings_source_src_28000.ds_partitioned, isoweek) AS ds_partitioned__week - , DATE_TRUNC(bookings_source_src_28000.ds_partitioned, month) AS ds_partitioned__month - , DATE_TRUNC(bookings_source_src_28000.ds_partitioned, quarter) AS ds_partitioned__quarter - , DATE_TRUNC(bookings_source_src_28000.ds_partitioned, year) AS ds_partitioned__year + , DATETIME_TRUNC(bookings_source_src_28000.ds_partitioned, day) AS ds_partitioned__day + , DATETIME_TRUNC(bookings_source_src_28000.ds_partitioned, isoweek) AS ds_partitioned__week + , DATETIME_TRUNC(bookings_source_src_28000.ds_partitioned, month) AS ds_partitioned__month + , DATETIME_TRUNC(bookings_source_src_28000.ds_partitioned, quarter) AS ds_partitioned__quarter + , DATETIME_TRUNC(bookings_source_src_28000.ds_partitioned, year) AS ds_partitioned__year , EXTRACT(year FROM bookings_source_src_28000.ds_partitioned) AS ds_partitioned__extract_year , EXTRACT(quarter FROM bookings_source_src_28000.ds_partitioned) AS ds_partitioned__extract_quarter , EXTRACT(month FROM bookings_source_src_28000.ds_partitioned) AS ds_partitioned__extract_month , EXTRACT(day FROM bookings_source_src_28000.ds_partitioned) AS ds_partitioned__extract_day , IF(EXTRACT(dayofweek FROM bookings_source_src_28000.ds_partitioned) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_28000.ds_partitioned) - 1) AS ds_partitioned__extract_dow , EXTRACT(dayofyear FROM bookings_source_src_28000.ds_partitioned) AS ds_partitioned__extract_doy - , DATE_TRUNC(bookings_source_src_28000.paid_at, day) AS paid_at__day - , DATE_TRUNC(bookings_source_src_28000.paid_at, isoweek) AS paid_at__week - , DATE_TRUNC(bookings_source_src_28000.paid_at, month) AS paid_at__month - , DATE_TRUNC(bookings_source_src_28000.paid_at, quarter) AS paid_at__quarter - , DATE_TRUNC(bookings_source_src_28000.paid_at, year) AS paid_at__year + , DATETIME_TRUNC(bookings_source_src_28000.paid_at, day) AS paid_at__day + , DATETIME_TRUNC(bookings_source_src_28000.paid_at, isoweek) AS paid_at__week + , DATETIME_TRUNC(bookings_source_src_28000.paid_at, month) AS paid_at__month + , DATETIME_TRUNC(bookings_source_src_28000.paid_at, quarter) AS paid_at__quarter + , DATETIME_TRUNC(bookings_source_src_28000.paid_at, year) AS paid_at__year , EXTRACT(year FROM bookings_source_src_28000.paid_at) AS paid_at__extract_year , EXTRACT(quarter FROM bookings_source_src_28000.paid_at) AS paid_at__extract_quarter , EXTRACT(month FROM bookings_source_src_28000.paid_at) AS paid_at__extract_month @@ -384,33 +384,33 @@ FROM ( , IF(EXTRACT(dayofweek FROM bookings_source_src_28000.paid_at) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_28000.paid_at) - 1) AS paid_at__extract_dow , EXTRACT(dayofyear FROM bookings_source_src_28000.paid_at) AS paid_at__extract_doy , bookings_source_src_28000.is_instant AS booking__is_instant - , DATE_TRUNC(bookings_source_src_28000.ds, day) AS booking__ds__day - , DATE_TRUNC(bookings_source_src_28000.ds, isoweek) AS booking__ds__week - , DATE_TRUNC(bookings_source_src_28000.ds, month) AS booking__ds__month - , DATE_TRUNC(bookings_source_src_28000.ds, quarter) AS booking__ds__quarter - , DATE_TRUNC(bookings_source_src_28000.ds, year) AS booking__ds__year + , DATETIME_TRUNC(bookings_source_src_28000.ds, day) AS booking__ds__day + , DATETIME_TRUNC(bookings_source_src_28000.ds, isoweek) AS booking__ds__week + , DATETIME_TRUNC(bookings_source_src_28000.ds, month) AS booking__ds__month + , DATETIME_TRUNC(bookings_source_src_28000.ds, quarter) AS booking__ds__quarter + , DATETIME_TRUNC(bookings_source_src_28000.ds, year) AS booking__ds__year , EXTRACT(year FROM bookings_source_src_28000.ds) AS booking__ds__extract_year , EXTRACT(quarter FROM bookings_source_src_28000.ds) AS booking__ds__extract_quarter , EXTRACT(month FROM bookings_source_src_28000.ds) AS booking__ds__extract_month , EXTRACT(day FROM bookings_source_src_28000.ds) AS booking__ds__extract_day , IF(EXTRACT(dayofweek FROM bookings_source_src_28000.ds) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_28000.ds) - 1) AS booking__ds__extract_dow , EXTRACT(dayofyear FROM bookings_source_src_28000.ds) AS booking__ds__extract_doy - , DATE_TRUNC(bookings_source_src_28000.ds_partitioned, day) AS booking__ds_partitioned__day - , DATE_TRUNC(bookings_source_src_28000.ds_partitioned, isoweek) AS booking__ds_partitioned__week - , DATE_TRUNC(bookings_source_src_28000.ds_partitioned, month) AS booking__ds_partitioned__month - , DATE_TRUNC(bookings_source_src_28000.ds_partitioned, quarter) AS booking__ds_partitioned__quarter - , DATE_TRUNC(bookings_source_src_28000.ds_partitioned, year) AS booking__ds_partitioned__year + , DATETIME_TRUNC(bookings_source_src_28000.ds_partitioned, day) AS booking__ds_partitioned__day + , DATETIME_TRUNC(bookings_source_src_28000.ds_partitioned, isoweek) AS booking__ds_partitioned__week + , DATETIME_TRUNC(bookings_source_src_28000.ds_partitioned, month) AS booking__ds_partitioned__month + , DATETIME_TRUNC(bookings_source_src_28000.ds_partitioned, quarter) AS booking__ds_partitioned__quarter + , DATETIME_TRUNC(bookings_source_src_28000.ds_partitioned, year) AS booking__ds_partitioned__year , EXTRACT(year FROM bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__extract_year , EXTRACT(quarter FROM bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__extract_quarter , EXTRACT(month FROM bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__extract_month , EXTRACT(day FROM bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__extract_day , IF(EXTRACT(dayofweek FROM bookings_source_src_28000.ds_partitioned) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_28000.ds_partitioned) - 1) AS booking__ds_partitioned__extract_dow , EXTRACT(dayofyear FROM bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__extract_doy - , DATE_TRUNC(bookings_source_src_28000.paid_at, day) AS booking__paid_at__day - , DATE_TRUNC(bookings_source_src_28000.paid_at, isoweek) AS booking__paid_at__week - , DATE_TRUNC(bookings_source_src_28000.paid_at, month) AS booking__paid_at__month - , DATE_TRUNC(bookings_source_src_28000.paid_at, quarter) AS booking__paid_at__quarter - , DATE_TRUNC(bookings_source_src_28000.paid_at, year) AS booking__paid_at__year + , DATETIME_TRUNC(bookings_source_src_28000.paid_at, day) AS booking__paid_at__day + , DATETIME_TRUNC(bookings_source_src_28000.paid_at, isoweek) AS booking__paid_at__week + , DATETIME_TRUNC(bookings_source_src_28000.paid_at, month) AS booking__paid_at__month + , DATETIME_TRUNC(bookings_source_src_28000.paid_at, quarter) AS booking__paid_at__quarter + , DATETIME_TRUNC(bookings_source_src_28000.paid_at, year) AS booking__paid_at__year , EXTRACT(year FROM bookings_source_src_28000.paid_at) AS booking__paid_at__extract_year , EXTRACT(quarter FROM bookings_source_src_28000.paid_at) AS booking__paid_at__extract_quarter , EXTRACT(month FROM bookings_source_src_28000.paid_at) AS booking__paid_at__extract_month diff --git a/tests_metricflow/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/BigQuery/test_derived_offset_cumulative_metric__plan0_optimized.sql b/tests_metricflow/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/BigQuery/test_derived_offset_cumulative_metric__plan0_optimized.sql index 0cb7f36e72..4b9b513bb2 100644 --- a/tests_metricflow/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/BigQuery/test_derived_offset_cumulative_metric__plan0_optimized.sql +++ b/tests_metricflow/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/BigQuery/test_derived_offset_cumulative_metric__plan0_optimized.sql @@ -21,9 +21,9 @@ FROM ( ***************************.fct_bookings bookings_source_src_28000 ON ( - DATE_TRUNC(bookings_source_src_28000.ds, day) <= subq_14.ds + DATETIME_TRUNC(bookings_source_src_28000.ds, day) <= subq_14.ds ) AND ( - DATE_TRUNC(bookings_source_src_28000.ds, day) > DATE_SUB(CAST(subq_14.ds AS DATETIME), INTERVAL 2 day) + DATETIME_TRUNC(bookings_source_src_28000.ds, day) > DATE_SUB(CAST(subq_14.ds AS DATETIME), INTERVAL 2 day) ) ) subq_15 ON diff --git a/tests_metricflow/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/BigQuery/test_derived_offset_metric_with_agg_time_dim__plan0.sql b/tests_metricflow/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/BigQuery/test_derived_offset_metric_with_agg_time_dim__plan0.sql index 17bd3518cd..92af66db4c 100644 --- a/tests_metricflow/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/BigQuery/test_derived_offset_metric_with_agg_time_dim__plan0.sql +++ b/tests_metricflow/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/BigQuery/test_derived_offset_metric_with_agg_time_dim__plan0.sql @@ -27,10 +27,10 @@ FROM ( -- Join to Time Spine Dataset SELECT subq_2.booking__ds__day AS booking__ds__day - , DATE_TRUNC(subq_2.booking__ds__day, isoweek) AS booking__ds__week - , DATE_TRUNC(subq_2.booking__ds__day, month) AS booking__ds__month - , DATE_TRUNC(subq_2.booking__ds__day, quarter) AS booking__ds__quarter - , DATE_TRUNC(subq_2.booking__ds__day, year) AS booking__ds__year + , DATETIME_TRUNC(subq_2.booking__ds__day, isoweek) AS booking__ds__week + , DATETIME_TRUNC(subq_2.booking__ds__day, month) AS booking__ds__month + , DATETIME_TRUNC(subq_2.booking__ds__day, quarter) AS booking__ds__quarter + , DATETIME_TRUNC(subq_2.booking__ds__day, year) AS booking__ds__year , EXTRACT(year FROM subq_2.booking__ds__day) AS booking__ds__extract_year , EXTRACT(quarter FROM subq_2.booking__ds__day) AS booking__ds__extract_quarter , EXTRACT(month FROM subq_2.booking__ds__day) AS booking__ds__extract_month @@ -249,33 +249,33 @@ FROM ( , bookings_source_src_28000.booking_value AS approximate_continuous_booking_value_p99 , bookings_source_src_28000.booking_value AS approximate_discrete_booking_value_p99 , bookings_source_src_28000.is_instant - , DATE_TRUNC(bookings_source_src_28000.ds, day) AS ds__day - , DATE_TRUNC(bookings_source_src_28000.ds, isoweek) AS ds__week - , DATE_TRUNC(bookings_source_src_28000.ds, month) AS ds__month - , DATE_TRUNC(bookings_source_src_28000.ds, quarter) AS ds__quarter - , DATE_TRUNC(bookings_source_src_28000.ds, year) AS ds__year + , DATETIME_TRUNC(bookings_source_src_28000.ds, day) AS ds__day + , DATETIME_TRUNC(bookings_source_src_28000.ds, isoweek) AS ds__week + , DATETIME_TRUNC(bookings_source_src_28000.ds, month) AS ds__month + , DATETIME_TRUNC(bookings_source_src_28000.ds, quarter) AS ds__quarter + , DATETIME_TRUNC(bookings_source_src_28000.ds, year) AS ds__year , EXTRACT(year FROM bookings_source_src_28000.ds) AS ds__extract_year , EXTRACT(quarter FROM bookings_source_src_28000.ds) AS ds__extract_quarter , EXTRACT(month FROM bookings_source_src_28000.ds) AS ds__extract_month , EXTRACT(day FROM bookings_source_src_28000.ds) AS ds__extract_day , IF(EXTRACT(dayofweek FROM bookings_source_src_28000.ds) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_28000.ds) - 1) AS ds__extract_dow , EXTRACT(dayofyear FROM bookings_source_src_28000.ds) AS ds__extract_doy - , DATE_TRUNC(bookings_source_src_28000.ds_partitioned, day) AS ds_partitioned__day - , DATE_TRUNC(bookings_source_src_28000.ds_partitioned, isoweek) AS ds_partitioned__week - , DATE_TRUNC(bookings_source_src_28000.ds_partitioned, month) AS ds_partitioned__month - , DATE_TRUNC(bookings_source_src_28000.ds_partitioned, quarter) AS ds_partitioned__quarter - , DATE_TRUNC(bookings_source_src_28000.ds_partitioned, year) AS ds_partitioned__year + , DATETIME_TRUNC(bookings_source_src_28000.ds_partitioned, day) AS ds_partitioned__day + , DATETIME_TRUNC(bookings_source_src_28000.ds_partitioned, isoweek) AS ds_partitioned__week + , DATETIME_TRUNC(bookings_source_src_28000.ds_partitioned, month) AS ds_partitioned__month + , DATETIME_TRUNC(bookings_source_src_28000.ds_partitioned, quarter) AS ds_partitioned__quarter + , DATETIME_TRUNC(bookings_source_src_28000.ds_partitioned, year) AS ds_partitioned__year , EXTRACT(year FROM bookings_source_src_28000.ds_partitioned) AS ds_partitioned__extract_year , EXTRACT(quarter FROM bookings_source_src_28000.ds_partitioned) AS ds_partitioned__extract_quarter , EXTRACT(month FROM bookings_source_src_28000.ds_partitioned) AS ds_partitioned__extract_month , EXTRACT(day FROM bookings_source_src_28000.ds_partitioned) AS ds_partitioned__extract_day , IF(EXTRACT(dayofweek FROM bookings_source_src_28000.ds_partitioned) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_28000.ds_partitioned) - 1) AS ds_partitioned__extract_dow , EXTRACT(dayofyear FROM bookings_source_src_28000.ds_partitioned) AS ds_partitioned__extract_doy - , DATE_TRUNC(bookings_source_src_28000.paid_at, day) AS paid_at__day - , DATE_TRUNC(bookings_source_src_28000.paid_at, isoweek) AS paid_at__week - , DATE_TRUNC(bookings_source_src_28000.paid_at, month) AS paid_at__month - , DATE_TRUNC(bookings_source_src_28000.paid_at, quarter) AS paid_at__quarter - , DATE_TRUNC(bookings_source_src_28000.paid_at, year) AS paid_at__year + , DATETIME_TRUNC(bookings_source_src_28000.paid_at, day) AS paid_at__day + , DATETIME_TRUNC(bookings_source_src_28000.paid_at, isoweek) AS paid_at__week + , DATETIME_TRUNC(bookings_source_src_28000.paid_at, month) AS paid_at__month + , DATETIME_TRUNC(bookings_source_src_28000.paid_at, quarter) AS paid_at__quarter + , DATETIME_TRUNC(bookings_source_src_28000.paid_at, year) AS paid_at__year , EXTRACT(year FROM bookings_source_src_28000.paid_at) AS paid_at__extract_year , EXTRACT(quarter FROM bookings_source_src_28000.paid_at) AS paid_at__extract_quarter , EXTRACT(month FROM bookings_source_src_28000.paid_at) AS paid_at__extract_month @@ -283,33 +283,33 @@ FROM ( , IF(EXTRACT(dayofweek FROM bookings_source_src_28000.paid_at) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_28000.paid_at) - 1) AS paid_at__extract_dow , EXTRACT(dayofyear FROM bookings_source_src_28000.paid_at) AS paid_at__extract_doy , bookings_source_src_28000.is_instant AS booking__is_instant - , DATE_TRUNC(bookings_source_src_28000.ds, day) AS booking__ds__day - , DATE_TRUNC(bookings_source_src_28000.ds, isoweek) AS booking__ds__week - , DATE_TRUNC(bookings_source_src_28000.ds, month) AS booking__ds__month - , DATE_TRUNC(bookings_source_src_28000.ds, quarter) AS booking__ds__quarter - , DATE_TRUNC(bookings_source_src_28000.ds, year) AS booking__ds__year + , DATETIME_TRUNC(bookings_source_src_28000.ds, day) AS booking__ds__day + , DATETIME_TRUNC(bookings_source_src_28000.ds, isoweek) AS booking__ds__week + , DATETIME_TRUNC(bookings_source_src_28000.ds, month) AS booking__ds__month + , DATETIME_TRUNC(bookings_source_src_28000.ds, quarter) AS booking__ds__quarter + , DATETIME_TRUNC(bookings_source_src_28000.ds, year) AS booking__ds__year , EXTRACT(year FROM bookings_source_src_28000.ds) AS booking__ds__extract_year , EXTRACT(quarter FROM bookings_source_src_28000.ds) AS booking__ds__extract_quarter , EXTRACT(month FROM bookings_source_src_28000.ds) AS booking__ds__extract_month , EXTRACT(day FROM bookings_source_src_28000.ds) AS booking__ds__extract_day , IF(EXTRACT(dayofweek FROM bookings_source_src_28000.ds) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_28000.ds) - 1) AS booking__ds__extract_dow , EXTRACT(dayofyear FROM bookings_source_src_28000.ds) AS booking__ds__extract_doy - , DATE_TRUNC(bookings_source_src_28000.ds_partitioned, day) AS booking__ds_partitioned__day - , DATE_TRUNC(bookings_source_src_28000.ds_partitioned, isoweek) AS booking__ds_partitioned__week - , DATE_TRUNC(bookings_source_src_28000.ds_partitioned, month) AS booking__ds_partitioned__month - , DATE_TRUNC(bookings_source_src_28000.ds_partitioned, quarter) AS booking__ds_partitioned__quarter - , DATE_TRUNC(bookings_source_src_28000.ds_partitioned, year) AS booking__ds_partitioned__year + , DATETIME_TRUNC(bookings_source_src_28000.ds_partitioned, day) AS booking__ds_partitioned__day + , DATETIME_TRUNC(bookings_source_src_28000.ds_partitioned, isoweek) AS booking__ds_partitioned__week + , DATETIME_TRUNC(bookings_source_src_28000.ds_partitioned, month) AS booking__ds_partitioned__month + , DATETIME_TRUNC(bookings_source_src_28000.ds_partitioned, quarter) AS booking__ds_partitioned__quarter + , DATETIME_TRUNC(bookings_source_src_28000.ds_partitioned, year) AS booking__ds_partitioned__year , EXTRACT(year FROM bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__extract_year , EXTRACT(quarter FROM bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__extract_quarter , EXTRACT(month FROM bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__extract_month , EXTRACT(day FROM bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__extract_day , IF(EXTRACT(dayofweek FROM bookings_source_src_28000.ds_partitioned) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_28000.ds_partitioned) - 1) AS booking__ds_partitioned__extract_dow , EXTRACT(dayofyear FROM bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__extract_doy - , DATE_TRUNC(bookings_source_src_28000.paid_at, day) AS booking__paid_at__day - , DATE_TRUNC(bookings_source_src_28000.paid_at, isoweek) AS booking__paid_at__week - , DATE_TRUNC(bookings_source_src_28000.paid_at, month) AS booking__paid_at__month - , DATE_TRUNC(bookings_source_src_28000.paid_at, quarter) AS booking__paid_at__quarter - , DATE_TRUNC(bookings_source_src_28000.paid_at, year) AS booking__paid_at__year + , DATETIME_TRUNC(bookings_source_src_28000.paid_at, day) AS booking__paid_at__day + , DATETIME_TRUNC(bookings_source_src_28000.paid_at, isoweek) AS booking__paid_at__week + , DATETIME_TRUNC(bookings_source_src_28000.paid_at, month) AS booking__paid_at__month + , DATETIME_TRUNC(bookings_source_src_28000.paid_at, quarter) AS booking__paid_at__quarter + , DATETIME_TRUNC(bookings_source_src_28000.paid_at, year) AS booking__paid_at__year , EXTRACT(year FROM bookings_source_src_28000.paid_at) AS booking__paid_at__extract_year , EXTRACT(quarter FROM bookings_source_src_28000.paid_at) AS booking__paid_at__extract_quarter , EXTRACT(month FROM bookings_source_src_28000.paid_at) AS booking__paid_at__extract_month @@ -467,33 +467,33 @@ FROM ( , bookings_source_src_28000.booking_value AS approximate_continuous_booking_value_p99 , bookings_source_src_28000.booking_value AS approximate_discrete_booking_value_p99 , bookings_source_src_28000.is_instant - , DATE_TRUNC(bookings_source_src_28000.ds, day) AS ds__day - , DATE_TRUNC(bookings_source_src_28000.ds, isoweek) AS ds__week - , DATE_TRUNC(bookings_source_src_28000.ds, month) AS ds__month - , DATE_TRUNC(bookings_source_src_28000.ds, quarter) AS ds__quarter - , DATE_TRUNC(bookings_source_src_28000.ds, year) AS ds__year + , DATETIME_TRUNC(bookings_source_src_28000.ds, day) AS ds__day + , DATETIME_TRUNC(bookings_source_src_28000.ds, isoweek) AS ds__week + , DATETIME_TRUNC(bookings_source_src_28000.ds, month) AS ds__month + , DATETIME_TRUNC(bookings_source_src_28000.ds, quarter) AS ds__quarter + , DATETIME_TRUNC(bookings_source_src_28000.ds, year) AS ds__year , EXTRACT(year FROM bookings_source_src_28000.ds) AS ds__extract_year , EXTRACT(quarter FROM bookings_source_src_28000.ds) AS ds__extract_quarter , EXTRACT(month FROM bookings_source_src_28000.ds) AS ds__extract_month , EXTRACT(day FROM bookings_source_src_28000.ds) AS ds__extract_day , IF(EXTRACT(dayofweek FROM bookings_source_src_28000.ds) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_28000.ds) - 1) AS ds__extract_dow , EXTRACT(dayofyear FROM bookings_source_src_28000.ds) AS ds__extract_doy - , DATE_TRUNC(bookings_source_src_28000.ds_partitioned, day) AS ds_partitioned__day - , DATE_TRUNC(bookings_source_src_28000.ds_partitioned, isoweek) AS ds_partitioned__week - , DATE_TRUNC(bookings_source_src_28000.ds_partitioned, month) AS ds_partitioned__month - , DATE_TRUNC(bookings_source_src_28000.ds_partitioned, quarter) AS ds_partitioned__quarter - , DATE_TRUNC(bookings_source_src_28000.ds_partitioned, year) AS ds_partitioned__year + , DATETIME_TRUNC(bookings_source_src_28000.ds_partitioned, day) AS ds_partitioned__day + , DATETIME_TRUNC(bookings_source_src_28000.ds_partitioned, isoweek) AS ds_partitioned__week + , DATETIME_TRUNC(bookings_source_src_28000.ds_partitioned, month) AS ds_partitioned__month + , DATETIME_TRUNC(bookings_source_src_28000.ds_partitioned, quarter) AS ds_partitioned__quarter + , DATETIME_TRUNC(bookings_source_src_28000.ds_partitioned, year) AS ds_partitioned__year , EXTRACT(year FROM bookings_source_src_28000.ds_partitioned) AS ds_partitioned__extract_year , EXTRACT(quarter FROM bookings_source_src_28000.ds_partitioned) AS ds_partitioned__extract_quarter , EXTRACT(month FROM bookings_source_src_28000.ds_partitioned) AS ds_partitioned__extract_month , EXTRACT(day FROM bookings_source_src_28000.ds_partitioned) AS ds_partitioned__extract_day , IF(EXTRACT(dayofweek FROM bookings_source_src_28000.ds_partitioned) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_28000.ds_partitioned) - 1) AS ds_partitioned__extract_dow , EXTRACT(dayofyear FROM bookings_source_src_28000.ds_partitioned) AS ds_partitioned__extract_doy - , DATE_TRUNC(bookings_source_src_28000.paid_at, day) AS paid_at__day - , DATE_TRUNC(bookings_source_src_28000.paid_at, isoweek) AS paid_at__week - , DATE_TRUNC(bookings_source_src_28000.paid_at, month) AS paid_at__month - , DATE_TRUNC(bookings_source_src_28000.paid_at, quarter) AS paid_at__quarter - , DATE_TRUNC(bookings_source_src_28000.paid_at, year) AS paid_at__year + , DATETIME_TRUNC(bookings_source_src_28000.paid_at, day) AS paid_at__day + , DATETIME_TRUNC(bookings_source_src_28000.paid_at, isoweek) AS paid_at__week + , DATETIME_TRUNC(bookings_source_src_28000.paid_at, month) AS paid_at__month + , DATETIME_TRUNC(bookings_source_src_28000.paid_at, quarter) AS paid_at__quarter + , DATETIME_TRUNC(bookings_source_src_28000.paid_at, year) AS paid_at__year , EXTRACT(year FROM bookings_source_src_28000.paid_at) AS paid_at__extract_year , EXTRACT(quarter FROM bookings_source_src_28000.paid_at) AS paid_at__extract_quarter , EXTRACT(month FROM bookings_source_src_28000.paid_at) AS paid_at__extract_month @@ -501,33 +501,33 @@ FROM ( , IF(EXTRACT(dayofweek FROM bookings_source_src_28000.paid_at) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_28000.paid_at) - 1) AS paid_at__extract_dow , EXTRACT(dayofyear FROM bookings_source_src_28000.paid_at) AS paid_at__extract_doy , bookings_source_src_28000.is_instant AS booking__is_instant - , DATE_TRUNC(bookings_source_src_28000.ds, day) AS booking__ds__day - , DATE_TRUNC(bookings_source_src_28000.ds, isoweek) AS booking__ds__week - , DATE_TRUNC(bookings_source_src_28000.ds, month) AS booking__ds__month - , DATE_TRUNC(bookings_source_src_28000.ds, quarter) AS booking__ds__quarter - , DATE_TRUNC(bookings_source_src_28000.ds, year) AS booking__ds__year + , DATETIME_TRUNC(bookings_source_src_28000.ds, day) AS booking__ds__day + , DATETIME_TRUNC(bookings_source_src_28000.ds, isoweek) AS booking__ds__week + , DATETIME_TRUNC(bookings_source_src_28000.ds, month) AS booking__ds__month + , DATETIME_TRUNC(bookings_source_src_28000.ds, quarter) AS booking__ds__quarter + , DATETIME_TRUNC(bookings_source_src_28000.ds, year) AS booking__ds__year , EXTRACT(year FROM bookings_source_src_28000.ds) AS booking__ds__extract_year , EXTRACT(quarter FROM bookings_source_src_28000.ds) AS booking__ds__extract_quarter , EXTRACT(month FROM bookings_source_src_28000.ds) AS booking__ds__extract_month , EXTRACT(day FROM bookings_source_src_28000.ds) AS booking__ds__extract_day , IF(EXTRACT(dayofweek FROM bookings_source_src_28000.ds) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_28000.ds) - 1) AS booking__ds__extract_dow , EXTRACT(dayofyear FROM bookings_source_src_28000.ds) AS booking__ds__extract_doy - , DATE_TRUNC(bookings_source_src_28000.ds_partitioned, day) AS booking__ds_partitioned__day - , DATE_TRUNC(bookings_source_src_28000.ds_partitioned, isoweek) AS booking__ds_partitioned__week - , DATE_TRUNC(bookings_source_src_28000.ds_partitioned, month) AS booking__ds_partitioned__month - , DATE_TRUNC(bookings_source_src_28000.ds_partitioned, quarter) AS booking__ds_partitioned__quarter - , DATE_TRUNC(bookings_source_src_28000.ds_partitioned, year) AS booking__ds_partitioned__year + , DATETIME_TRUNC(bookings_source_src_28000.ds_partitioned, day) AS booking__ds_partitioned__day + , DATETIME_TRUNC(bookings_source_src_28000.ds_partitioned, isoweek) AS booking__ds_partitioned__week + , DATETIME_TRUNC(bookings_source_src_28000.ds_partitioned, month) AS booking__ds_partitioned__month + , DATETIME_TRUNC(bookings_source_src_28000.ds_partitioned, quarter) AS booking__ds_partitioned__quarter + , DATETIME_TRUNC(bookings_source_src_28000.ds_partitioned, year) AS booking__ds_partitioned__year , EXTRACT(year FROM bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__extract_year , EXTRACT(quarter FROM bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__extract_quarter , EXTRACT(month FROM bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__extract_month , EXTRACT(day FROM bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__extract_day , IF(EXTRACT(dayofweek FROM bookings_source_src_28000.ds_partitioned) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_28000.ds_partitioned) - 1) AS booking__ds_partitioned__extract_dow , EXTRACT(dayofyear FROM bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__extract_doy - , DATE_TRUNC(bookings_source_src_28000.paid_at, day) AS booking__paid_at__day - , DATE_TRUNC(bookings_source_src_28000.paid_at, isoweek) AS booking__paid_at__week - , DATE_TRUNC(bookings_source_src_28000.paid_at, month) AS booking__paid_at__month - , DATE_TRUNC(bookings_source_src_28000.paid_at, quarter) AS booking__paid_at__quarter - , DATE_TRUNC(bookings_source_src_28000.paid_at, year) AS booking__paid_at__year + , DATETIME_TRUNC(bookings_source_src_28000.paid_at, day) AS booking__paid_at__day + , DATETIME_TRUNC(bookings_source_src_28000.paid_at, isoweek) AS booking__paid_at__week + , DATETIME_TRUNC(bookings_source_src_28000.paid_at, month) AS booking__paid_at__month + , DATETIME_TRUNC(bookings_source_src_28000.paid_at, quarter) AS booking__paid_at__quarter + , DATETIME_TRUNC(bookings_source_src_28000.paid_at, year) AS booking__paid_at__year , EXTRACT(year FROM bookings_source_src_28000.paid_at) AS booking__paid_at__extract_year , EXTRACT(quarter FROM bookings_source_src_28000.paid_at) AS booking__paid_at__extract_quarter , EXTRACT(month FROM bookings_source_src_28000.paid_at) AS booking__paid_at__extract_month diff --git a/tests_metricflow/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/BigQuery/test_derived_offset_metric_with_agg_time_dim__plan0_optimized.sql b/tests_metricflow/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/BigQuery/test_derived_offset_metric_with_agg_time_dim__plan0_optimized.sql index 0eaf526c06..6e331d4e16 100644 --- a/tests_metricflow/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/BigQuery/test_derived_offset_metric_with_agg_time_dim__plan0_optimized.sql +++ b/tests_metricflow/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/BigQuery/test_derived_offset_metric_with_agg_time_dim__plan0_optimized.sql @@ -20,7 +20,7 @@ FROM ( INNER JOIN ***************************.fct_bookings bookings_source_src_28000 ON - DATE_SUB(CAST(subq_17.ds AS DATETIME), INTERVAL 1 week) = DATE_TRUNC(bookings_source_src_28000.ds, day) + DATE_SUB(CAST(subq_17.ds AS DATETIME), INTERVAL 1 week) = DATETIME_TRUNC(bookings_source_src_28000.ds, day) GROUP BY booking__ds__day ) subq_21 @@ -31,7 +31,7 @@ FROM ( -- Aggregate Measures -- Compute Metrics via Expressions SELECT - DATE_TRUNC(ds, day) AS booking__ds__day + DATETIME_TRUNC(ds, day) AS booking__ds__day , COUNT(DISTINCT guest_id) AS bookers FROM ***************************.fct_bookings bookings_source_src_28000 GROUP BY diff --git a/tests_metricflow/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/BigQuery/test_derived_offset_metric_with_one_input_metric__plan0.sql b/tests_metricflow/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/BigQuery/test_derived_offset_metric_with_one_input_metric__plan0.sql index 66f2a0fafe..5c4ee22ca1 100644 --- a/tests_metricflow/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/BigQuery/test_derived_offset_metric_with_one_input_metric__plan0.sql +++ b/tests_metricflow/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/BigQuery/test_derived_offset_metric_with_one_input_metric__plan0.sql @@ -21,10 +21,10 @@ FROM ( -- Join to Time Spine Dataset SELECT subq_2.metric_time__day AS metric_time__day - , DATE_TRUNC(subq_2.metric_time__day, isoweek) AS metric_time__week - , DATE_TRUNC(subq_2.metric_time__day, month) AS metric_time__month - , DATE_TRUNC(subq_2.metric_time__day, quarter) AS metric_time__quarter - , DATE_TRUNC(subq_2.metric_time__day, year) AS metric_time__year + , DATETIME_TRUNC(subq_2.metric_time__day, isoweek) AS metric_time__week + , DATETIME_TRUNC(subq_2.metric_time__day, month) AS metric_time__month + , DATETIME_TRUNC(subq_2.metric_time__day, quarter) AS metric_time__quarter + , DATETIME_TRUNC(subq_2.metric_time__day, year) AS metric_time__year , EXTRACT(year FROM subq_2.metric_time__day) AS metric_time__extract_year , EXTRACT(quarter FROM subq_2.metric_time__day) AS metric_time__extract_quarter , EXTRACT(month FROM subq_2.metric_time__day) AS metric_time__extract_month @@ -243,33 +243,33 @@ FROM ( , bookings_source_src_28000.booking_value AS approximate_continuous_booking_value_p99 , bookings_source_src_28000.booking_value AS approximate_discrete_booking_value_p99 , bookings_source_src_28000.is_instant - , DATE_TRUNC(bookings_source_src_28000.ds, day) AS ds__day - , DATE_TRUNC(bookings_source_src_28000.ds, isoweek) AS ds__week - , DATE_TRUNC(bookings_source_src_28000.ds, month) AS ds__month - , DATE_TRUNC(bookings_source_src_28000.ds, quarter) AS ds__quarter - , DATE_TRUNC(bookings_source_src_28000.ds, year) AS ds__year + , DATETIME_TRUNC(bookings_source_src_28000.ds, day) AS ds__day + , DATETIME_TRUNC(bookings_source_src_28000.ds, isoweek) AS ds__week + , DATETIME_TRUNC(bookings_source_src_28000.ds, month) AS ds__month + , DATETIME_TRUNC(bookings_source_src_28000.ds, quarter) AS ds__quarter + , DATETIME_TRUNC(bookings_source_src_28000.ds, year) AS ds__year , EXTRACT(year FROM bookings_source_src_28000.ds) AS ds__extract_year , EXTRACT(quarter FROM bookings_source_src_28000.ds) AS ds__extract_quarter , EXTRACT(month FROM bookings_source_src_28000.ds) AS ds__extract_month , EXTRACT(day FROM bookings_source_src_28000.ds) AS ds__extract_day , IF(EXTRACT(dayofweek FROM bookings_source_src_28000.ds) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_28000.ds) - 1) AS ds__extract_dow , EXTRACT(dayofyear FROM bookings_source_src_28000.ds) AS ds__extract_doy - , DATE_TRUNC(bookings_source_src_28000.ds_partitioned, day) AS ds_partitioned__day - , DATE_TRUNC(bookings_source_src_28000.ds_partitioned, isoweek) AS ds_partitioned__week - , DATE_TRUNC(bookings_source_src_28000.ds_partitioned, month) AS ds_partitioned__month - , DATE_TRUNC(bookings_source_src_28000.ds_partitioned, quarter) AS ds_partitioned__quarter - , DATE_TRUNC(bookings_source_src_28000.ds_partitioned, year) AS ds_partitioned__year + , DATETIME_TRUNC(bookings_source_src_28000.ds_partitioned, day) AS ds_partitioned__day + , DATETIME_TRUNC(bookings_source_src_28000.ds_partitioned, isoweek) AS ds_partitioned__week + , DATETIME_TRUNC(bookings_source_src_28000.ds_partitioned, month) AS ds_partitioned__month + , DATETIME_TRUNC(bookings_source_src_28000.ds_partitioned, quarter) AS ds_partitioned__quarter + , DATETIME_TRUNC(bookings_source_src_28000.ds_partitioned, year) AS ds_partitioned__year , EXTRACT(year FROM bookings_source_src_28000.ds_partitioned) AS ds_partitioned__extract_year , EXTRACT(quarter FROM bookings_source_src_28000.ds_partitioned) AS ds_partitioned__extract_quarter , EXTRACT(month FROM bookings_source_src_28000.ds_partitioned) AS ds_partitioned__extract_month , EXTRACT(day FROM bookings_source_src_28000.ds_partitioned) AS ds_partitioned__extract_day , IF(EXTRACT(dayofweek FROM bookings_source_src_28000.ds_partitioned) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_28000.ds_partitioned) - 1) AS ds_partitioned__extract_dow , EXTRACT(dayofyear FROM bookings_source_src_28000.ds_partitioned) AS ds_partitioned__extract_doy - , DATE_TRUNC(bookings_source_src_28000.paid_at, day) AS paid_at__day - , DATE_TRUNC(bookings_source_src_28000.paid_at, isoweek) AS paid_at__week - , DATE_TRUNC(bookings_source_src_28000.paid_at, month) AS paid_at__month - , DATE_TRUNC(bookings_source_src_28000.paid_at, quarter) AS paid_at__quarter - , DATE_TRUNC(bookings_source_src_28000.paid_at, year) AS paid_at__year + , DATETIME_TRUNC(bookings_source_src_28000.paid_at, day) AS paid_at__day + , DATETIME_TRUNC(bookings_source_src_28000.paid_at, isoweek) AS paid_at__week + , DATETIME_TRUNC(bookings_source_src_28000.paid_at, month) AS paid_at__month + , DATETIME_TRUNC(bookings_source_src_28000.paid_at, quarter) AS paid_at__quarter + , DATETIME_TRUNC(bookings_source_src_28000.paid_at, year) AS paid_at__year , EXTRACT(year FROM bookings_source_src_28000.paid_at) AS paid_at__extract_year , EXTRACT(quarter FROM bookings_source_src_28000.paid_at) AS paid_at__extract_quarter , EXTRACT(month FROM bookings_source_src_28000.paid_at) AS paid_at__extract_month @@ -277,33 +277,33 @@ FROM ( , IF(EXTRACT(dayofweek FROM bookings_source_src_28000.paid_at) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_28000.paid_at) - 1) AS paid_at__extract_dow , EXTRACT(dayofyear FROM bookings_source_src_28000.paid_at) AS paid_at__extract_doy , bookings_source_src_28000.is_instant AS booking__is_instant - , DATE_TRUNC(bookings_source_src_28000.ds, day) AS booking__ds__day - , DATE_TRUNC(bookings_source_src_28000.ds, isoweek) AS booking__ds__week - , DATE_TRUNC(bookings_source_src_28000.ds, month) AS booking__ds__month - , DATE_TRUNC(bookings_source_src_28000.ds, quarter) AS booking__ds__quarter - , DATE_TRUNC(bookings_source_src_28000.ds, year) AS booking__ds__year + , DATETIME_TRUNC(bookings_source_src_28000.ds, day) AS booking__ds__day + , DATETIME_TRUNC(bookings_source_src_28000.ds, isoweek) AS booking__ds__week + , DATETIME_TRUNC(bookings_source_src_28000.ds, month) AS booking__ds__month + , DATETIME_TRUNC(bookings_source_src_28000.ds, quarter) AS booking__ds__quarter + , DATETIME_TRUNC(bookings_source_src_28000.ds, year) AS booking__ds__year , EXTRACT(year FROM bookings_source_src_28000.ds) AS booking__ds__extract_year , EXTRACT(quarter FROM bookings_source_src_28000.ds) AS booking__ds__extract_quarter , EXTRACT(month FROM bookings_source_src_28000.ds) AS booking__ds__extract_month , EXTRACT(day FROM bookings_source_src_28000.ds) AS booking__ds__extract_day , IF(EXTRACT(dayofweek FROM bookings_source_src_28000.ds) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_28000.ds) - 1) AS booking__ds__extract_dow , EXTRACT(dayofyear FROM bookings_source_src_28000.ds) AS booking__ds__extract_doy - , DATE_TRUNC(bookings_source_src_28000.ds_partitioned, day) AS booking__ds_partitioned__day - , DATE_TRUNC(bookings_source_src_28000.ds_partitioned, isoweek) AS booking__ds_partitioned__week - , DATE_TRUNC(bookings_source_src_28000.ds_partitioned, month) AS booking__ds_partitioned__month - , DATE_TRUNC(bookings_source_src_28000.ds_partitioned, quarter) AS booking__ds_partitioned__quarter - , DATE_TRUNC(bookings_source_src_28000.ds_partitioned, year) AS booking__ds_partitioned__year + , DATETIME_TRUNC(bookings_source_src_28000.ds_partitioned, day) AS booking__ds_partitioned__day + , DATETIME_TRUNC(bookings_source_src_28000.ds_partitioned, isoweek) AS booking__ds_partitioned__week + , DATETIME_TRUNC(bookings_source_src_28000.ds_partitioned, month) AS booking__ds_partitioned__month + , DATETIME_TRUNC(bookings_source_src_28000.ds_partitioned, quarter) AS booking__ds_partitioned__quarter + , DATETIME_TRUNC(bookings_source_src_28000.ds_partitioned, year) AS booking__ds_partitioned__year , EXTRACT(year FROM bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__extract_year , EXTRACT(quarter FROM bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__extract_quarter , EXTRACT(month FROM bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__extract_month , EXTRACT(day FROM bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__extract_day , IF(EXTRACT(dayofweek FROM bookings_source_src_28000.ds_partitioned) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_28000.ds_partitioned) - 1) AS booking__ds_partitioned__extract_dow , EXTRACT(dayofyear FROM bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__extract_doy - , DATE_TRUNC(bookings_source_src_28000.paid_at, day) AS booking__paid_at__day - , DATE_TRUNC(bookings_source_src_28000.paid_at, isoweek) AS booking__paid_at__week - , DATE_TRUNC(bookings_source_src_28000.paid_at, month) AS booking__paid_at__month - , DATE_TRUNC(bookings_source_src_28000.paid_at, quarter) AS booking__paid_at__quarter - , DATE_TRUNC(bookings_source_src_28000.paid_at, year) AS booking__paid_at__year + , DATETIME_TRUNC(bookings_source_src_28000.paid_at, day) AS booking__paid_at__day + , DATETIME_TRUNC(bookings_source_src_28000.paid_at, isoweek) AS booking__paid_at__week + , DATETIME_TRUNC(bookings_source_src_28000.paid_at, month) AS booking__paid_at__month + , DATETIME_TRUNC(bookings_source_src_28000.paid_at, quarter) AS booking__paid_at__quarter + , DATETIME_TRUNC(bookings_source_src_28000.paid_at, year) AS booking__paid_at__year , EXTRACT(year FROM bookings_source_src_28000.paid_at) AS booking__paid_at__extract_year , EXTRACT(quarter FROM bookings_source_src_28000.paid_at) AS booking__paid_at__extract_quarter , EXTRACT(month FROM bookings_source_src_28000.paid_at) AS booking__paid_at__extract_month diff --git a/tests_metricflow/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/BigQuery/test_derived_offset_metric_with_one_input_metric__plan0_optimized.sql b/tests_metricflow/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/BigQuery/test_derived_offset_metric_with_one_input_metric__plan0_optimized.sql index 519967fd40..de4b0b1da5 100644 --- a/tests_metricflow/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/BigQuery/test_derived_offset_metric_with_one_input_metric__plan0_optimized.sql +++ b/tests_metricflow/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/BigQuery/test_derived_offset_metric_with_one_input_metric__plan0_optimized.sql @@ -15,7 +15,7 @@ FROM ( -- Read Elements From Semantic Model 'bookings_source' -- Metric Time Dimension 'ds' SELECT - DATE_TRUNC(ds, day) AS metric_time__day + DATETIME_TRUNC(ds, day) AS metric_time__day , 1 AS bookings FROM ***************************.fct_bookings bookings_source_src_28000 ) subq_9 diff --git a/tests_metricflow/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/BigQuery/test_multi_metric_fill_null__plan0.sql b/tests_metricflow/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/BigQuery/test_multi_metric_fill_null__plan0.sql index 5bcd33a992..480b98fa0c 100644 --- a/tests_metricflow/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/BigQuery/test_multi_metric_fill_null__plan0.sql +++ b/tests_metricflow/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/BigQuery/test_multi_metric_fill_null__plan0.sql @@ -142,33 +142,33 @@ FROM ( , bookings_source_src_28000.booking_value AS approximate_continuous_booking_value_p99 , bookings_source_src_28000.booking_value AS approximate_discrete_booking_value_p99 , bookings_source_src_28000.is_instant - , DATE_TRUNC(bookings_source_src_28000.ds, day) AS ds__day - , DATE_TRUNC(bookings_source_src_28000.ds, isoweek) AS ds__week - , DATE_TRUNC(bookings_source_src_28000.ds, month) AS ds__month - , DATE_TRUNC(bookings_source_src_28000.ds, quarter) AS ds__quarter - , DATE_TRUNC(bookings_source_src_28000.ds, year) AS ds__year + , DATETIME_TRUNC(bookings_source_src_28000.ds, day) AS ds__day + , DATETIME_TRUNC(bookings_source_src_28000.ds, isoweek) AS ds__week + , DATETIME_TRUNC(bookings_source_src_28000.ds, month) AS ds__month + , DATETIME_TRUNC(bookings_source_src_28000.ds, quarter) AS ds__quarter + , DATETIME_TRUNC(bookings_source_src_28000.ds, year) AS ds__year , EXTRACT(year FROM bookings_source_src_28000.ds) AS ds__extract_year , EXTRACT(quarter FROM bookings_source_src_28000.ds) AS ds__extract_quarter , EXTRACT(month FROM bookings_source_src_28000.ds) AS ds__extract_month , EXTRACT(day FROM bookings_source_src_28000.ds) AS ds__extract_day , IF(EXTRACT(dayofweek FROM bookings_source_src_28000.ds) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_28000.ds) - 1) AS ds__extract_dow , EXTRACT(dayofyear FROM bookings_source_src_28000.ds) AS ds__extract_doy - , DATE_TRUNC(bookings_source_src_28000.ds_partitioned, day) AS ds_partitioned__day - , DATE_TRUNC(bookings_source_src_28000.ds_partitioned, isoweek) AS ds_partitioned__week - , DATE_TRUNC(bookings_source_src_28000.ds_partitioned, month) AS ds_partitioned__month - , DATE_TRUNC(bookings_source_src_28000.ds_partitioned, quarter) AS ds_partitioned__quarter - , DATE_TRUNC(bookings_source_src_28000.ds_partitioned, year) AS ds_partitioned__year + , DATETIME_TRUNC(bookings_source_src_28000.ds_partitioned, day) AS ds_partitioned__day + , DATETIME_TRUNC(bookings_source_src_28000.ds_partitioned, isoweek) AS ds_partitioned__week + , DATETIME_TRUNC(bookings_source_src_28000.ds_partitioned, month) AS ds_partitioned__month + , DATETIME_TRUNC(bookings_source_src_28000.ds_partitioned, quarter) AS ds_partitioned__quarter + , DATETIME_TRUNC(bookings_source_src_28000.ds_partitioned, year) AS ds_partitioned__year , EXTRACT(year FROM bookings_source_src_28000.ds_partitioned) AS ds_partitioned__extract_year , EXTRACT(quarter FROM bookings_source_src_28000.ds_partitioned) AS ds_partitioned__extract_quarter , EXTRACT(month FROM bookings_source_src_28000.ds_partitioned) AS ds_partitioned__extract_month , EXTRACT(day FROM bookings_source_src_28000.ds_partitioned) AS ds_partitioned__extract_day , IF(EXTRACT(dayofweek FROM bookings_source_src_28000.ds_partitioned) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_28000.ds_partitioned) - 1) AS ds_partitioned__extract_dow , EXTRACT(dayofyear FROM bookings_source_src_28000.ds_partitioned) AS ds_partitioned__extract_doy - , DATE_TRUNC(bookings_source_src_28000.paid_at, day) AS paid_at__day - , DATE_TRUNC(bookings_source_src_28000.paid_at, isoweek) AS paid_at__week - , DATE_TRUNC(bookings_source_src_28000.paid_at, month) AS paid_at__month - , DATE_TRUNC(bookings_source_src_28000.paid_at, quarter) AS paid_at__quarter - , DATE_TRUNC(bookings_source_src_28000.paid_at, year) AS paid_at__year + , DATETIME_TRUNC(bookings_source_src_28000.paid_at, day) AS paid_at__day + , DATETIME_TRUNC(bookings_source_src_28000.paid_at, isoweek) AS paid_at__week + , DATETIME_TRUNC(bookings_source_src_28000.paid_at, month) AS paid_at__month + , DATETIME_TRUNC(bookings_source_src_28000.paid_at, quarter) AS paid_at__quarter + , DATETIME_TRUNC(bookings_source_src_28000.paid_at, year) AS paid_at__year , EXTRACT(year FROM bookings_source_src_28000.paid_at) AS paid_at__extract_year , EXTRACT(quarter FROM bookings_source_src_28000.paid_at) AS paid_at__extract_quarter , EXTRACT(month FROM bookings_source_src_28000.paid_at) AS paid_at__extract_month @@ -176,33 +176,33 @@ FROM ( , IF(EXTRACT(dayofweek FROM bookings_source_src_28000.paid_at) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_28000.paid_at) - 1) AS paid_at__extract_dow , EXTRACT(dayofyear FROM bookings_source_src_28000.paid_at) AS paid_at__extract_doy , bookings_source_src_28000.is_instant AS booking__is_instant - , DATE_TRUNC(bookings_source_src_28000.ds, day) AS booking__ds__day - , DATE_TRUNC(bookings_source_src_28000.ds, isoweek) AS booking__ds__week - , DATE_TRUNC(bookings_source_src_28000.ds, month) AS booking__ds__month - , DATE_TRUNC(bookings_source_src_28000.ds, quarter) AS booking__ds__quarter - , DATE_TRUNC(bookings_source_src_28000.ds, year) AS booking__ds__year + , DATETIME_TRUNC(bookings_source_src_28000.ds, day) AS booking__ds__day + , DATETIME_TRUNC(bookings_source_src_28000.ds, isoweek) AS booking__ds__week + , DATETIME_TRUNC(bookings_source_src_28000.ds, month) AS booking__ds__month + , DATETIME_TRUNC(bookings_source_src_28000.ds, quarter) AS booking__ds__quarter + , DATETIME_TRUNC(bookings_source_src_28000.ds, year) AS booking__ds__year , EXTRACT(year FROM bookings_source_src_28000.ds) AS booking__ds__extract_year , EXTRACT(quarter FROM bookings_source_src_28000.ds) AS booking__ds__extract_quarter , EXTRACT(month FROM bookings_source_src_28000.ds) AS booking__ds__extract_month , EXTRACT(day FROM bookings_source_src_28000.ds) AS booking__ds__extract_day , IF(EXTRACT(dayofweek FROM bookings_source_src_28000.ds) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_28000.ds) - 1) AS booking__ds__extract_dow , EXTRACT(dayofyear FROM bookings_source_src_28000.ds) AS booking__ds__extract_doy - , DATE_TRUNC(bookings_source_src_28000.ds_partitioned, day) AS booking__ds_partitioned__day - , DATE_TRUNC(bookings_source_src_28000.ds_partitioned, isoweek) AS booking__ds_partitioned__week - , DATE_TRUNC(bookings_source_src_28000.ds_partitioned, month) AS booking__ds_partitioned__month - , DATE_TRUNC(bookings_source_src_28000.ds_partitioned, quarter) AS booking__ds_partitioned__quarter - , DATE_TRUNC(bookings_source_src_28000.ds_partitioned, year) AS booking__ds_partitioned__year + , DATETIME_TRUNC(bookings_source_src_28000.ds_partitioned, day) AS booking__ds_partitioned__day + , DATETIME_TRUNC(bookings_source_src_28000.ds_partitioned, isoweek) AS booking__ds_partitioned__week + , DATETIME_TRUNC(bookings_source_src_28000.ds_partitioned, month) AS booking__ds_partitioned__month + , DATETIME_TRUNC(bookings_source_src_28000.ds_partitioned, quarter) AS booking__ds_partitioned__quarter + , DATETIME_TRUNC(bookings_source_src_28000.ds_partitioned, year) AS booking__ds_partitioned__year , EXTRACT(year FROM bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__extract_year , EXTRACT(quarter FROM bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__extract_quarter , EXTRACT(month FROM bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__extract_month , EXTRACT(day FROM bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__extract_day , IF(EXTRACT(dayofweek FROM bookings_source_src_28000.ds_partitioned) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_28000.ds_partitioned) - 1) AS booking__ds_partitioned__extract_dow , EXTRACT(dayofyear FROM bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__extract_doy - , DATE_TRUNC(bookings_source_src_28000.paid_at, day) AS booking__paid_at__day - , DATE_TRUNC(bookings_source_src_28000.paid_at, isoweek) AS booking__paid_at__week - , DATE_TRUNC(bookings_source_src_28000.paid_at, month) AS booking__paid_at__month - , DATE_TRUNC(bookings_source_src_28000.paid_at, quarter) AS booking__paid_at__quarter - , DATE_TRUNC(bookings_source_src_28000.paid_at, year) AS booking__paid_at__year + , DATETIME_TRUNC(bookings_source_src_28000.paid_at, day) AS booking__paid_at__day + , DATETIME_TRUNC(bookings_source_src_28000.paid_at, isoweek) AS booking__paid_at__week + , DATETIME_TRUNC(bookings_source_src_28000.paid_at, month) AS booking__paid_at__month + , DATETIME_TRUNC(bookings_source_src_28000.paid_at, quarter) AS booking__paid_at__quarter + , DATETIME_TRUNC(bookings_source_src_28000.paid_at, year) AS booking__paid_at__year , EXTRACT(year FROM bookings_source_src_28000.paid_at) AS booking__paid_at__extract_year , EXTRACT(quarter FROM bookings_source_src_28000.paid_at) AS booking__paid_at__extract_quarter , EXTRACT(month FROM bookings_source_src_28000.paid_at) AS booking__paid_at__extract_month @@ -315,22 +315,22 @@ FULL OUTER JOIN ( 1 AS listings , listings_latest_src_28000.capacity AS largest_listing , listings_latest_src_28000.capacity AS smallest_listing - , DATE_TRUNC(listings_latest_src_28000.created_at, day) AS ds__day - , DATE_TRUNC(listings_latest_src_28000.created_at, isoweek) AS ds__week - , DATE_TRUNC(listings_latest_src_28000.created_at, month) AS ds__month - , DATE_TRUNC(listings_latest_src_28000.created_at, quarter) AS ds__quarter - , DATE_TRUNC(listings_latest_src_28000.created_at, year) AS ds__year + , DATETIME_TRUNC(listings_latest_src_28000.created_at, day) AS ds__day + , DATETIME_TRUNC(listings_latest_src_28000.created_at, isoweek) AS ds__week + , DATETIME_TRUNC(listings_latest_src_28000.created_at, month) AS ds__month + , DATETIME_TRUNC(listings_latest_src_28000.created_at, quarter) AS ds__quarter + , DATETIME_TRUNC(listings_latest_src_28000.created_at, year) AS ds__year , EXTRACT(year FROM listings_latest_src_28000.created_at) AS ds__extract_year , EXTRACT(quarter FROM listings_latest_src_28000.created_at) AS ds__extract_quarter , EXTRACT(month FROM listings_latest_src_28000.created_at) AS ds__extract_month , EXTRACT(day FROM listings_latest_src_28000.created_at) AS ds__extract_day , IF(EXTRACT(dayofweek FROM listings_latest_src_28000.created_at) = 1, 7, EXTRACT(dayofweek FROM listings_latest_src_28000.created_at) - 1) AS ds__extract_dow , EXTRACT(dayofyear FROM listings_latest_src_28000.created_at) AS ds__extract_doy - , DATE_TRUNC(listings_latest_src_28000.created_at, day) AS created_at__day - , DATE_TRUNC(listings_latest_src_28000.created_at, isoweek) AS created_at__week - , DATE_TRUNC(listings_latest_src_28000.created_at, month) AS created_at__month - , DATE_TRUNC(listings_latest_src_28000.created_at, quarter) AS created_at__quarter - , DATE_TRUNC(listings_latest_src_28000.created_at, year) AS created_at__year + , DATETIME_TRUNC(listings_latest_src_28000.created_at, day) AS created_at__day + , DATETIME_TRUNC(listings_latest_src_28000.created_at, isoweek) AS created_at__week + , DATETIME_TRUNC(listings_latest_src_28000.created_at, month) AS created_at__month + , DATETIME_TRUNC(listings_latest_src_28000.created_at, quarter) AS created_at__quarter + , DATETIME_TRUNC(listings_latest_src_28000.created_at, year) AS created_at__year , EXTRACT(year FROM listings_latest_src_28000.created_at) AS created_at__extract_year , EXTRACT(quarter FROM listings_latest_src_28000.created_at) AS created_at__extract_quarter , EXTRACT(month FROM listings_latest_src_28000.created_at) AS created_at__extract_month @@ -340,22 +340,22 @@ FULL OUTER JOIN ( , listings_latest_src_28000.country AS country_latest , listings_latest_src_28000.is_lux AS is_lux_latest , listings_latest_src_28000.capacity AS capacity_latest - , DATE_TRUNC(listings_latest_src_28000.created_at, day) AS listing__ds__day - , DATE_TRUNC(listings_latest_src_28000.created_at, isoweek) AS listing__ds__week - , DATE_TRUNC(listings_latest_src_28000.created_at, month) AS listing__ds__month - , DATE_TRUNC(listings_latest_src_28000.created_at, quarter) AS listing__ds__quarter - , DATE_TRUNC(listings_latest_src_28000.created_at, year) AS listing__ds__year + , DATETIME_TRUNC(listings_latest_src_28000.created_at, day) AS listing__ds__day + , DATETIME_TRUNC(listings_latest_src_28000.created_at, isoweek) AS listing__ds__week + , DATETIME_TRUNC(listings_latest_src_28000.created_at, month) AS listing__ds__month + , DATETIME_TRUNC(listings_latest_src_28000.created_at, quarter) AS listing__ds__quarter + , DATETIME_TRUNC(listings_latest_src_28000.created_at, year) AS listing__ds__year , EXTRACT(year FROM listings_latest_src_28000.created_at) AS listing__ds__extract_year , EXTRACT(quarter FROM listings_latest_src_28000.created_at) AS listing__ds__extract_quarter , EXTRACT(month FROM listings_latest_src_28000.created_at) AS listing__ds__extract_month , EXTRACT(day FROM listings_latest_src_28000.created_at) AS listing__ds__extract_day , IF(EXTRACT(dayofweek FROM listings_latest_src_28000.created_at) = 1, 7, EXTRACT(dayofweek FROM listings_latest_src_28000.created_at) - 1) AS listing__ds__extract_dow , EXTRACT(dayofyear FROM listings_latest_src_28000.created_at) AS listing__ds__extract_doy - , DATE_TRUNC(listings_latest_src_28000.created_at, day) AS listing__created_at__day - , DATE_TRUNC(listings_latest_src_28000.created_at, isoweek) AS listing__created_at__week - , DATE_TRUNC(listings_latest_src_28000.created_at, month) AS listing__created_at__month - , DATE_TRUNC(listings_latest_src_28000.created_at, quarter) AS listing__created_at__quarter - , DATE_TRUNC(listings_latest_src_28000.created_at, year) AS listing__created_at__year + , DATETIME_TRUNC(listings_latest_src_28000.created_at, day) AS listing__created_at__day + , DATETIME_TRUNC(listings_latest_src_28000.created_at, isoweek) AS listing__created_at__week + , DATETIME_TRUNC(listings_latest_src_28000.created_at, month) AS listing__created_at__month + , DATETIME_TRUNC(listings_latest_src_28000.created_at, quarter) AS listing__created_at__quarter + , DATETIME_TRUNC(listings_latest_src_28000.created_at, year) AS listing__created_at__year , EXTRACT(year FROM listings_latest_src_28000.created_at) AS listing__created_at__extract_year , EXTRACT(quarter FROM listings_latest_src_28000.created_at) AS listing__created_at__extract_quarter , EXTRACT(month FROM listings_latest_src_28000.created_at) AS listing__created_at__extract_month diff --git a/tests_metricflow/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/BigQuery/test_multi_metric_fill_null__plan0_optimized.sql b/tests_metricflow/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/BigQuery/test_multi_metric_fill_null__plan0_optimized.sql index 6bfa758d97..9ab4221680 100644 --- a/tests_metricflow/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/BigQuery/test_multi_metric_fill_null__plan0_optimized.sql +++ b/tests_metricflow/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/BigQuery/test_multi_metric_fill_null__plan0_optimized.sql @@ -23,7 +23,7 @@ FROM ( -- Metric Time Dimension 'ds' -- Pass Only Elements: ['bookings', 'metric_time__day'] SELECT - DATE_TRUNC(ds, day) AS metric_time__day + DATETIME_TRUNC(ds, day) AS metric_time__day , 1 AS bookings FROM ***************************.fct_bookings bookings_source_src_28000 ) subq_13 @@ -43,7 +43,7 @@ FULL OUTER JOIN ( -- Metric Time Dimension 'ds' -- Pass Only Elements: ['listings', 'metric_time__day'] SELECT - DATE_TRUNC(created_at, day) AS metric_time__day + DATETIME_TRUNC(created_at, day) AS metric_time__day , 1 AS listings FROM ***************************.dim_listings_latest listings_latest_src_28000 ) subq_19 diff --git a/tests_metricflow/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/BigQuery/test_nested_derived_metric__plan0.sql b/tests_metricflow/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/BigQuery/test_nested_derived_metric__plan0.sql index 7ef66eff90..0122264b1a 100644 --- a/tests_metricflow/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/BigQuery/test_nested_derived_metric__plan0.sql +++ b/tests_metricflow/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/BigQuery/test_nested_derived_metric__plan0.sql @@ -154,33 +154,33 @@ FROM ( , bookings_source_src_28000.booking_value AS approximate_continuous_booking_value_p99 , bookings_source_src_28000.booking_value AS approximate_discrete_booking_value_p99 , bookings_source_src_28000.is_instant - , DATE_TRUNC(bookings_source_src_28000.ds, day) AS ds__day - , DATE_TRUNC(bookings_source_src_28000.ds, isoweek) AS ds__week - , DATE_TRUNC(bookings_source_src_28000.ds, month) AS ds__month - , DATE_TRUNC(bookings_source_src_28000.ds, quarter) AS ds__quarter - , DATE_TRUNC(bookings_source_src_28000.ds, year) AS ds__year + , DATETIME_TRUNC(bookings_source_src_28000.ds, day) AS ds__day + , DATETIME_TRUNC(bookings_source_src_28000.ds, isoweek) AS ds__week + , DATETIME_TRUNC(bookings_source_src_28000.ds, month) AS ds__month + , DATETIME_TRUNC(bookings_source_src_28000.ds, quarter) AS ds__quarter + , DATETIME_TRUNC(bookings_source_src_28000.ds, year) AS ds__year , EXTRACT(year FROM bookings_source_src_28000.ds) AS ds__extract_year , EXTRACT(quarter FROM bookings_source_src_28000.ds) AS ds__extract_quarter , EXTRACT(month FROM bookings_source_src_28000.ds) AS ds__extract_month , EXTRACT(day FROM bookings_source_src_28000.ds) AS ds__extract_day , IF(EXTRACT(dayofweek FROM bookings_source_src_28000.ds) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_28000.ds) - 1) AS ds__extract_dow , EXTRACT(dayofyear FROM bookings_source_src_28000.ds) AS ds__extract_doy - , DATE_TRUNC(bookings_source_src_28000.ds_partitioned, day) AS ds_partitioned__day - , DATE_TRUNC(bookings_source_src_28000.ds_partitioned, isoweek) AS ds_partitioned__week - , DATE_TRUNC(bookings_source_src_28000.ds_partitioned, month) AS ds_partitioned__month - , DATE_TRUNC(bookings_source_src_28000.ds_partitioned, quarter) AS ds_partitioned__quarter - , DATE_TRUNC(bookings_source_src_28000.ds_partitioned, year) AS ds_partitioned__year + , DATETIME_TRUNC(bookings_source_src_28000.ds_partitioned, day) AS ds_partitioned__day + , DATETIME_TRUNC(bookings_source_src_28000.ds_partitioned, isoweek) AS ds_partitioned__week + , DATETIME_TRUNC(bookings_source_src_28000.ds_partitioned, month) AS ds_partitioned__month + , DATETIME_TRUNC(bookings_source_src_28000.ds_partitioned, quarter) AS ds_partitioned__quarter + , DATETIME_TRUNC(bookings_source_src_28000.ds_partitioned, year) AS ds_partitioned__year , EXTRACT(year FROM bookings_source_src_28000.ds_partitioned) AS ds_partitioned__extract_year , EXTRACT(quarter FROM bookings_source_src_28000.ds_partitioned) AS ds_partitioned__extract_quarter , EXTRACT(month FROM bookings_source_src_28000.ds_partitioned) AS ds_partitioned__extract_month , EXTRACT(day FROM bookings_source_src_28000.ds_partitioned) AS ds_partitioned__extract_day , IF(EXTRACT(dayofweek FROM bookings_source_src_28000.ds_partitioned) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_28000.ds_partitioned) - 1) AS ds_partitioned__extract_dow , EXTRACT(dayofyear FROM bookings_source_src_28000.ds_partitioned) AS ds_partitioned__extract_doy - , DATE_TRUNC(bookings_source_src_28000.paid_at, day) AS paid_at__day - , DATE_TRUNC(bookings_source_src_28000.paid_at, isoweek) AS paid_at__week - , DATE_TRUNC(bookings_source_src_28000.paid_at, month) AS paid_at__month - , DATE_TRUNC(bookings_source_src_28000.paid_at, quarter) AS paid_at__quarter - , DATE_TRUNC(bookings_source_src_28000.paid_at, year) AS paid_at__year + , DATETIME_TRUNC(bookings_source_src_28000.paid_at, day) AS paid_at__day + , DATETIME_TRUNC(bookings_source_src_28000.paid_at, isoweek) AS paid_at__week + , DATETIME_TRUNC(bookings_source_src_28000.paid_at, month) AS paid_at__month + , DATETIME_TRUNC(bookings_source_src_28000.paid_at, quarter) AS paid_at__quarter + , DATETIME_TRUNC(bookings_source_src_28000.paid_at, year) AS paid_at__year , EXTRACT(year FROM bookings_source_src_28000.paid_at) AS paid_at__extract_year , EXTRACT(quarter FROM bookings_source_src_28000.paid_at) AS paid_at__extract_quarter , EXTRACT(month FROM bookings_source_src_28000.paid_at) AS paid_at__extract_month @@ -188,33 +188,33 @@ FROM ( , IF(EXTRACT(dayofweek FROM bookings_source_src_28000.paid_at) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_28000.paid_at) - 1) AS paid_at__extract_dow , EXTRACT(dayofyear FROM bookings_source_src_28000.paid_at) AS paid_at__extract_doy , bookings_source_src_28000.is_instant AS booking__is_instant - , DATE_TRUNC(bookings_source_src_28000.ds, day) AS booking__ds__day - , DATE_TRUNC(bookings_source_src_28000.ds, isoweek) AS booking__ds__week - , DATE_TRUNC(bookings_source_src_28000.ds, month) AS booking__ds__month - , DATE_TRUNC(bookings_source_src_28000.ds, quarter) AS booking__ds__quarter - , DATE_TRUNC(bookings_source_src_28000.ds, year) AS booking__ds__year + , DATETIME_TRUNC(bookings_source_src_28000.ds, day) AS booking__ds__day + , DATETIME_TRUNC(bookings_source_src_28000.ds, isoweek) AS booking__ds__week + , DATETIME_TRUNC(bookings_source_src_28000.ds, month) AS booking__ds__month + , DATETIME_TRUNC(bookings_source_src_28000.ds, quarter) AS booking__ds__quarter + , DATETIME_TRUNC(bookings_source_src_28000.ds, year) AS booking__ds__year , EXTRACT(year FROM bookings_source_src_28000.ds) AS booking__ds__extract_year , EXTRACT(quarter FROM bookings_source_src_28000.ds) AS booking__ds__extract_quarter , EXTRACT(month FROM bookings_source_src_28000.ds) AS booking__ds__extract_month , EXTRACT(day FROM bookings_source_src_28000.ds) AS booking__ds__extract_day , IF(EXTRACT(dayofweek FROM bookings_source_src_28000.ds) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_28000.ds) - 1) AS booking__ds__extract_dow , EXTRACT(dayofyear FROM bookings_source_src_28000.ds) AS booking__ds__extract_doy - , DATE_TRUNC(bookings_source_src_28000.ds_partitioned, day) AS booking__ds_partitioned__day - , DATE_TRUNC(bookings_source_src_28000.ds_partitioned, isoweek) AS booking__ds_partitioned__week - , DATE_TRUNC(bookings_source_src_28000.ds_partitioned, month) AS booking__ds_partitioned__month - , DATE_TRUNC(bookings_source_src_28000.ds_partitioned, quarter) AS booking__ds_partitioned__quarter - , DATE_TRUNC(bookings_source_src_28000.ds_partitioned, year) AS booking__ds_partitioned__year + , DATETIME_TRUNC(bookings_source_src_28000.ds_partitioned, day) AS booking__ds_partitioned__day + , DATETIME_TRUNC(bookings_source_src_28000.ds_partitioned, isoweek) AS booking__ds_partitioned__week + , DATETIME_TRUNC(bookings_source_src_28000.ds_partitioned, month) AS booking__ds_partitioned__month + , DATETIME_TRUNC(bookings_source_src_28000.ds_partitioned, quarter) AS booking__ds_partitioned__quarter + , DATETIME_TRUNC(bookings_source_src_28000.ds_partitioned, year) AS booking__ds_partitioned__year , EXTRACT(year FROM bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__extract_year , EXTRACT(quarter FROM bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__extract_quarter , EXTRACT(month FROM bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__extract_month , EXTRACT(day FROM bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__extract_day , IF(EXTRACT(dayofweek FROM bookings_source_src_28000.ds_partitioned) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_28000.ds_partitioned) - 1) AS booking__ds_partitioned__extract_dow , EXTRACT(dayofyear FROM bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__extract_doy - , DATE_TRUNC(bookings_source_src_28000.paid_at, day) AS booking__paid_at__day - , DATE_TRUNC(bookings_source_src_28000.paid_at, isoweek) AS booking__paid_at__week - , DATE_TRUNC(bookings_source_src_28000.paid_at, month) AS booking__paid_at__month - , DATE_TRUNC(bookings_source_src_28000.paid_at, quarter) AS booking__paid_at__quarter - , DATE_TRUNC(bookings_source_src_28000.paid_at, year) AS booking__paid_at__year + , DATETIME_TRUNC(bookings_source_src_28000.paid_at, day) AS booking__paid_at__day + , DATETIME_TRUNC(bookings_source_src_28000.paid_at, isoweek) AS booking__paid_at__week + , DATETIME_TRUNC(bookings_source_src_28000.paid_at, month) AS booking__paid_at__month + , DATETIME_TRUNC(bookings_source_src_28000.paid_at, quarter) AS booking__paid_at__quarter + , DATETIME_TRUNC(bookings_source_src_28000.paid_at, year) AS booking__paid_at__year , EXTRACT(year FROM bookings_source_src_28000.paid_at) AS booking__paid_at__extract_year , EXTRACT(quarter FROM bookings_source_src_28000.paid_at) AS booking__paid_at__extract_quarter , EXTRACT(month FROM bookings_source_src_28000.paid_at) AS booking__paid_at__extract_month @@ -369,33 +369,33 @@ FROM ( , bookings_source_src_28000.booking_value AS approximate_continuous_booking_value_p99 , bookings_source_src_28000.booking_value AS approximate_discrete_booking_value_p99 , bookings_source_src_28000.is_instant - , DATE_TRUNC(bookings_source_src_28000.ds, day) AS ds__day - , DATE_TRUNC(bookings_source_src_28000.ds, isoweek) AS ds__week - , DATE_TRUNC(bookings_source_src_28000.ds, month) AS ds__month - , DATE_TRUNC(bookings_source_src_28000.ds, quarter) AS ds__quarter - , DATE_TRUNC(bookings_source_src_28000.ds, year) AS ds__year + , DATETIME_TRUNC(bookings_source_src_28000.ds, day) AS ds__day + , DATETIME_TRUNC(bookings_source_src_28000.ds, isoweek) AS ds__week + , DATETIME_TRUNC(bookings_source_src_28000.ds, month) AS ds__month + , DATETIME_TRUNC(bookings_source_src_28000.ds, quarter) AS ds__quarter + , DATETIME_TRUNC(bookings_source_src_28000.ds, year) AS ds__year , EXTRACT(year FROM bookings_source_src_28000.ds) AS ds__extract_year , EXTRACT(quarter FROM bookings_source_src_28000.ds) AS ds__extract_quarter , EXTRACT(month FROM bookings_source_src_28000.ds) AS ds__extract_month , EXTRACT(day FROM bookings_source_src_28000.ds) AS ds__extract_day , IF(EXTRACT(dayofweek FROM bookings_source_src_28000.ds) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_28000.ds) - 1) AS ds__extract_dow , EXTRACT(dayofyear FROM bookings_source_src_28000.ds) AS ds__extract_doy - , DATE_TRUNC(bookings_source_src_28000.ds_partitioned, day) AS ds_partitioned__day - , DATE_TRUNC(bookings_source_src_28000.ds_partitioned, isoweek) AS ds_partitioned__week - , DATE_TRUNC(bookings_source_src_28000.ds_partitioned, month) AS ds_partitioned__month - , DATE_TRUNC(bookings_source_src_28000.ds_partitioned, quarter) AS ds_partitioned__quarter - , DATE_TRUNC(bookings_source_src_28000.ds_partitioned, year) AS ds_partitioned__year + , DATETIME_TRUNC(bookings_source_src_28000.ds_partitioned, day) AS ds_partitioned__day + , DATETIME_TRUNC(bookings_source_src_28000.ds_partitioned, isoweek) AS ds_partitioned__week + , DATETIME_TRUNC(bookings_source_src_28000.ds_partitioned, month) AS ds_partitioned__month + , DATETIME_TRUNC(bookings_source_src_28000.ds_partitioned, quarter) AS ds_partitioned__quarter + , DATETIME_TRUNC(bookings_source_src_28000.ds_partitioned, year) AS ds_partitioned__year , EXTRACT(year FROM bookings_source_src_28000.ds_partitioned) AS ds_partitioned__extract_year , EXTRACT(quarter FROM bookings_source_src_28000.ds_partitioned) AS ds_partitioned__extract_quarter , EXTRACT(month FROM bookings_source_src_28000.ds_partitioned) AS ds_partitioned__extract_month , EXTRACT(day FROM bookings_source_src_28000.ds_partitioned) AS ds_partitioned__extract_day , IF(EXTRACT(dayofweek FROM bookings_source_src_28000.ds_partitioned) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_28000.ds_partitioned) - 1) AS ds_partitioned__extract_dow , EXTRACT(dayofyear FROM bookings_source_src_28000.ds_partitioned) AS ds_partitioned__extract_doy - , DATE_TRUNC(bookings_source_src_28000.paid_at, day) AS paid_at__day - , DATE_TRUNC(bookings_source_src_28000.paid_at, isoweek) AS paid_at__week - , DATE_TRUNC(bookings_source_src_28000.paid_at, month) AS paid_at__month - , DATE_TRUNC(bookings_source_src_28000.paid_at, quarter) AS paid_at__quarter - , DATE_TRUNC(bookings_source_src_28000.paid_at, year) AS paid_at__year + , DATETIME_TRUNC(bookings_source_src_28000.paid_at, day) AS paid_at__day + , DATETIME_TRUNC(bookings_source_src_28000.paid_at, isoweek) AS paid_at__week + , DATETIME_TRUNC(bookings_source_src_28000.paid_at, month) AS paid_at__month + , DATETIME_TRUNC(bookings_source_src_28000.paid_at, quarter) AS paid_at__quarter + , DATETIME_TRUNC(bookings_source_src_28000.paid_at, year) AS paid_at__year , EXTRACT(year FROM bookings_source_src_28000.paid_at) AS paid_at__extract_year , EXTRACT(quarter FROM bookings_source_src_28000.paid_at) AS paid_at__extract_quarter , EXTRACT(month FROM bookings_source_src_28000.paid_at) AS paid_at__extract_month @@ -403,33 +403,33 @@ FROM ( , IF(EXTRACT(dayofweek FROM bookings_source_src_28000.paid_at) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_28000.paid_at) - 1) AS paid_at__extract_dow , EXTRACT(dayofyear FROM bookings_source_src_28000.paid_at) AS paid_at__extract_doy , bookings_source_src_28000.is_instant AS booking__is_instant - , DATE_TRUNC(bookings_source_src_28000.ds, day) AS booking__ds__day - , DATE_TRUNC(bookings_source_src_28000.ds, isoweek) AS booking__ds__week - , DATE_TRUNC(bookings_source_src_28000.ds, month) AS booking__ds__month - , DATE_TRUNC(bookings_source_src_28000.ds, quarter) AS booking__ds__quarter - , DATE_TRUNC(bookings_source_src_28000.ds, year) AS booking__ds__year + , DATETIME_TRUNC(bookings_source_src_28000.ds, day) AS booking__ds__day + , DATETIME_TRUNC(bookings_source_src_28000.ds, isoweek) AS booking__ds__week + , DATETIME_TRUNC(bookings_source_src_28000.ds, month) AS booking__ds__month + , DATETIME_TRUNC(bookings_source_src_28000.ds, quarter) AS booking__ds__quarter + , DATETIME_TRUNC(bookings_source_src_28000.ds, year) AS booking__ds__year , EXTRACT(year FROM bookings_source_src_28000.ds) AS booking__ds__extract_year , EXTRACT(quarter FROM bookings_source_src_28000.ds) AS booking__ds__extract_quarter , EXTRACT(month FROM bookings_source_src_28000.ds) AS booking__ds__extract_month , EXTRACT(day FROM bookings_source_src_28000.ds) AS booking__ds__extract_day , IF(EXTRACT(dayofweek FROM bookings_source_src_28000.ds) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_28000.ds) - 1) AS booking__ds__extract_dow , EXTRACT(dayofyear FROM bookings_source_src_28000.ds) AS booking__ds__extract_doy - , DATE_TRUNC(bookings_source_src_28000.ds_partitioned, day) AS booking__ds_partitioned__day - , DATE_TRUNC(bookings_source_src_28000.ds_partitioned, isoweek) AS booking__ds_partitioned__week - , DATE_TRUNC(bookings_source_src_28000.ds_partitioned, month) AS booking__ds_partitioned__month - , DATE_TRUNC(bookings_source_src_28000.ds_partitioned, quarter) AS booking__ds_partitioned__quarter - , DATE_TRUNC(bookings_source_src_28000.ds_partitioned, year) AS booking__ds_partitioned__year + , DATETIME_TRUNC(bookings_source_src_28000.ds_partitioned, day) AS booking__ds_partitioned__day + , DATETIME_TRUNC(bookings_source_src_28000.ds_partitioned, isoweek) AS booking__ds_partitioned__week + , DATETIME_TRUNC(bookings_source_src_28000.ds_partitioned, month) AS booking__ds_partitioned__month + , DATETIME_TRUNC(bookings_source_src_28000.ds_partitioned, quarter) AS booking__ds_partitioned__quarter + , DATETIME_TRUNC(bookings_source_src_28000.ds_partitioned, year) AS booking__ds_partitioned__year , EXTRACT(year FROM bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__extract_year , EXTRACT(quarter FROM bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__extract_quarter , EXTRACT(month FROM bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__extract_month , EXTRACT(day FROM bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__extract_day , IF(EXTRACT(dayofweek FROM bookings_source_src_28000.ds_partitioned) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_28000.ds_partitioned) - 1) AS booking__ds_partitioned__extract_dow , EXTRACT(dayofyear FROM bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__extract_doy - , DATE_TRUNC(bookings_source_src_28000.paid_at, day) AS booking__paid_at__day - , DATE_TRUNC(bookings_source_src_28000.paid_at, isoweek) AS booking__paid_at__week - , DATE_TRUNC(bookings_source_src_28000.paid_at, month) AS booking__paid_at__month - , DATE_TRUNC(bookings_source_src_28000.paid_at, quarter) AS booking__paid_at__quarter - , DATE_TRUNC(bookings_source_src_28000.paid_at, year) AS booking__paid_at__year + , DATETIME_TRUNC(bookings_source_src_28000.paid_at, day) AS booking__paid_at__day + , DATETIME_TRUNC(bookings_source_src_28000.paid_at, isoweek) AS booking__paid_at__week + , DATETIME_TRUNC(bookings_source_src_28000.paid_at, month) AS booking__paid_at__month + , DATETIME_TRUNC(bookings_source_src_28000.paid_at, quarter) AS booking__paid_at__quarter + , DATETIME_TRUNC(bookings_source_src_28000.paid_at, year) AS booking__paid_at__year , EXTRACT(year FROM bookings_source_src_28000.paid_at) AS booking__paid_at__extract_year , EXTRACT(quarter FROM bookings_source_src_28000.paid_at) AS booking__paid_at__extract_quarter , EXTRACT(month FROM bookings_source_src_28000.paid_at) AS booking__paid_at__extract_month @@ -590,33 +590,33 @@ FROM ( , bookings_source_src_28000.booking_value AS approximate_continuous_booking_value_p99 , bookings_source_src_28000.booking_value AS approximate_discrete_booking_value_p99 , bookings_source_src_28000.is_instant - , DATE_TRUNC(bookings_source_src_28000.ds, day) AS ds__day - , DATE_TRUNC(bookings_source_src_28000.ds, isoweek) AS ds__week - , DATE_TRUNC(bookings_source_src_28000.ds, month) AS ds__month - , DATE_TRUNC(bookings_source_src_28000.ds, quarter) AS ds__quarter - , DATE_TRUNC(bookings_source_src_28000.ds, year) AS ds__year + , DATETIME_TRUNC(bookings_source_src_28000.ds, day) AS ds__day + , DATETIME_TRUNC(bookings_source_src_28000.ds, isoweek) AS ds__week + , DATETIME_TRUNC(bookings_source_src_28000.ds, month) AS ds__month + , DATETIME_TRUNC(bookings_source_src_28000.ds, quarter) AS ds__quarter + , DATETIME_TRUNC(bookings_source_src_28000.ds, year) AS ds__year , EXTRACT(year FROM bookings_source_src_28000.ds) AS ds__extract_year , EXTRACT(quarter FROM bookings_source_src_28000.ds) AS ds__extract_quarter , EXTRACT(month FROM bookings_source_src_28000.ds) AS ds__extract_month , EXTRACT(day FROM bookings_source_src_28000.ds) AS ds__extract_day , IF(EXTRACT(dayofweek FROM bookings_source_src_28000.ds) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_28000.ds) - 1) AS ds__extract_dow , EXTRACT(dayofyear FROM bookings_source_src_28000.ds) AS ds__extract_doy - , DATE_TRUNC(bookings_source_src_28000.ds_partitioned, day) AS ds_partitioned__day - , DATE_TRUNC(bookings_source_src_28000.ds_partitioned, isoweek) AS ds_partitioned__week - , DATE_TRUNC(bookings_source_src_28000.ds_partitioned, month) AS ds_partitioned__month - , DATE_TRUNC(bookings_source_src_28000.ds_partitioned, quarter) AS ds_partitioned__quarter - , DATE_TRUNC(bookings_source_src_28000.ds_partitioned, year) AS ds_partitioned__year + , DATETIME_TRUNC(bookings_source_src_28000.ds_partitioned, day) AS ds_partitioned__day + , DATETIME_TRUNC(bookings_source_src_28000.ds_partitioned, isoweek) AS ds_partitioned__week + , DATETIME_TRUNC(bookings_source_src_28000.ds_partitioned, month) AS ds_partitioned__month + , DATETIME_TRUNC(bookings_source_src_28000.ds_partitioned, quarter) AS ds_partitioned__quarter + , DATETIME_TRUNC(bookings_source_src_28000.ds_partitioned, year) AS ds_partitioned__year , EXTRACT(year FROM bookings_source_src_28000.ds_partitioned) AS ds_partitioned__extract_year , EXTRACT(quarter FROM bookings_source_src_28000.ds_partitioned) AS ds_partitioned__extract_quarter , EXTRACT(month FROM bookings_source_src_28000.ds_partitioned) AS ds_partitioned__extract_month , EXTRACT(day FROM bookings_source_src_28000.ds_partitioned) AS ds_partitioned__extract_day , IF(EXTRACT(dayofweek FROM bookings_source_src_28000.ds_partitioned) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_28000.ds_partitioned) - 1) AS ds_partitioned__extract_dow , EXTRACT(dayofyear FROM bookings_source_src_28000.ds_partitioned) AS ds_partitioned__extract_doy - , DATE_TRUNC(bookings_source_src_28000.paid_at, day) AS paid_at__day - , DATE_TRUNC(bookings_source_src_28000.paid_at, isoweek) AS paid_at__week - , DATE_TRUNC(bookings_source_src_28000.paid_at, month) AS paid_at__month - , DATE_TRUNC(bookings_source_src_28000.paid_at, quarter) AS paid_at__quarter - , DATE_TRUNC(bookings_source_src_28000.paid_at, year) AS paid_at__year + , DATETIME_TRUNC(bookings_source_src_28000.paid_at, day) AS paid_at__day + , DATETIME_TRUNC(bookings_source_src_28000.paid_at, isoweek) AS paid_at__week + , DATETIME_TRUNC(bookings_source_src_28000.paid_at, month) AS paid_at__month + , DATETIME_TRUNC(bookings_source_src_28000.paid_at, quarter) AS paid_at__quarter + , DATETIME_TRUNC(bookings_source_src_28000.paid_at, year) AS paid_at__year , EXTRACT(year FROM bookings_source_src_28000.paid_at) AS paid_at__extract_year , EXTRACT(quarter FROM bookings_source_src_28000.paid_at) AS paid_at__extract_quarter , EXTRACT(month FROM bookings_source_src_28000.paid_at) AS paid_at__extract_month @@ -624,33 +624,33 @@ FROM ( , IF(EXTRACT(dayofweek FROM bookings_source_src_28000.paid_at) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_28000.paid_at) - 1) AS paid_at__extract_dow , EXTRACT(dayofyear FROM bookings_source_src_28000.paid_at) AS paid_at__extract_doy , bookings_source_src_28000.is_instant AS booking__is_instant - , DATE_TRUNC(bookings_source_src_28000.ds, day) AS booking__ds__day - , DATE_TRUNC(bookings_source_src_28000.ds, isoweek) AS booking__ds__week - , DATE_TRUNC(bookings_source_src_28000.ds, month) AS booking__ds__month - , DATE_TRUNC(bookings_source_src_28000.ds, quarter) AS booking__ds__quarter - , DATE_TRUNC(bookings_source_src_28000.ds, year) AS booking__ds__year + , DATETIME_TRUNC(bookings_source_src_28000.ds, day) AS booking__ds__day + , DATETIME_TRUNC(bookings_source_src_28000.ds, isoweek) AS booking__ds__week + , DATETIME_TRUNC(bookings_source_src_28000.ds, month) AS booking__ds__month + , DATETIME_TRUNC(bookings_source_src_28000.ds, quarter) AS booking__ds__quarter + , DATETIME_TRUNC(bookings_source_src_28000.ds, year) AS booking__ds__year , EXTRACT(year FROM bookings_source_src_28000.ds) AS booking__ds__extract_year , EXTRACT(quarter FROM bookings_source_src_28000.ds) AS booking__ds__extract_quarter , EXTRACT(month FROM bookings_source_src_28000.ds) AS booking__ds__extract_month , EXTRACT(day FROM bookings_source_src_28000.ds) AS booking__ds__extract_day , IF(EXTRACT(dayofweek FROM bookings_source_src_28000.ds) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_28000.ds) - 1) AS booking__ds__extract_dow , EXTRACT(dayofyear FROM bookings_source_src_28000.ds) AS booking__ds__extract_doy - , DATE_TRUNC(bookings_source_src_28000.ds_partitioned, day) AS booking__ds_partitioned__day - , DATE_TRUNC(bookings_source_src_28000.ds_partitioned, isoweek) AS booking__ds_partitioned__week - , DATE_TRUNC(bookings_source_src_28000.ds_partitioned, month) AS booking__ds_partitioned__month - , DATE_TRUNC(bookings_source_src_28000.ds_partitioned, quarter) AS booking__ds_partitioned__quarter - , DATE_TRUNC(bookings_source_src_28000.ds_partitioned, year) AS booking__ds_partitioned__year + , DATETIME_TRUNC(bookings_source_src_28000.ds_partitioned, day) AS booking__ds_partitioned__day + , DATETIME_TRUNC(bookings_source_src_28000.ds_partitioned, isoweek) AS booking__ds_partitioned__week + , DATETIME_TRUNC(bookings_source_src_28000.ds_partitioned, month) AS booking__ds_partitioned__month + , DATETIME_TRUNC(bookings_source_src_28000.ds_partitioned, quarter) AS booking__ds_partitioned__quarter + , DATETIME_TRUNC(bookings_source_src_28000.ds_partitioned, year) AS booking__ds_partitioned__year , EXTRACT(year FROM bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__extract_year , EXTRACT(quarter FROM bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__extract_quarter , EXTRACT(month FROM bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__extract_month , EXTRACT(day FROM bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__extract_day , IF(EXTRACT(dayofweek FROM bookings_source_src_28000.ds_partitioned) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_28000.ds_partitioned) - 1) AS booking__ds_partitioned__extract_dow , EXTRACT(dayofyear FROM bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__extract_doy - , DATE_TRUNC(bookings_source_src_28000.paid_at, day) AS booking__paid_at__day - , DATE_TRUNC(bookings_source_src_28000.paid_at, isoweek) AS booking__paid_at__week - , DATE_TRUNC(bookings_source_src_28000.paid_at, month) AS booking__paid_at__month - , DATE_TRUNC(bookings_source_src_28000.paid_at, quarter) AS booking__paid_at__quarter - , DATE_TRUNC(bookings_source_src_28000.paid_at, year) AS booking__paid_at__year + , DATETIME_TRUNC(bookings_source_src_28000.paid_at, day) AS booking__paid_at__day + , DATETIME_TRUNC(bookings_source_src_28000.paid_at, isoweek) AS booking__paid_at__week + , DATETIME_TRUNC(bookings_source_src_28000.paid_at, month) AS booking__paid_at__month + , DATETIME_TRUNC(bookings_source_src_28000.paid_at, quarter) AS booking__paid_at__quarter + , DATETIME_TRUNC(bookings_source_src_28000.paid_at, year) AS booking__paid_at__year , EXTRACT(year FROM bookings_source_src_28000.paid_at) AS booking__paid_at__extract_year , EXTRACT(quarter FROM bookings_source_src_28000.paid_at) AS booking__paid_at__extract_quarter , EXTRACT(month FROM bookings_source_src_28000.paid_at) AS booking__paid_at__extract_month @@ -807,33 +807,33 @@ FROM ( , bookings_source_src_28000.booking_value AS approximate_continuous_booking_value_p99 , bookings_source_src_28000.booking_value AS approximate_discrete_booking_value_p99 , bookings_source_src_28000.is_instant - , DATE_TRUNC(bookings_source_src_28000.ds, day) AS ds__day - , DATE_TRUNC(bookings_source_src_28000.ds, isoweek) AS ds__week - , DATE_TRUNC(bookings_source_src_28000.ds, month) AS ds__month - , DATE_TRUNC(bookings_source_src_28000.ds, quarter) AS ds__quarter - , DATE_TRUNC(bookings_source_src_28000.ds, year) AS ds__year + , DATETIME_TRUNC(bookings_source_src_28000.ds, day) AS ds__day + , DATETIME_TRUNC(bookings_source_src_28000.ds, isoweek) AS ds__week + , DATETIME_TRUNC(bookings_source_src_28000.ds, month) AS ds__month + , DATETIME_TRUNC(bookings_source_src_28000.ds, quarter) AS ds__quarter + , DATETIME_TRUNC(bookings_source_src_28000.ds, year) AS ds__year , EXTRACT(year FROM bookings_source_src_28000.ds) AS ds__extract_year , EXTRACT(quarter FROM bookings_source_src_28000.ds) AS ds__extract_quarter , EXTRACT(month FROM bookings_source_src_28000.ds) AS ds__extract_month , EXTRACT(day FROM bookings_source_src_28000.ds) AS ds__extract_day , IF(EXTRACT(dayofweek FROM bookings_source_src_28000.ds) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_28000.ds) - 1) AS ds__extract_dow , EXTRACT(dayofyear FROM bookings_source_src_28000.ds) AS ds__extract_doy - , DATE_TRUNC(bookings_source_src_28000.ds_partitioned, day) AS ds_partitioned__day - , DATE_TRUNC(bookings_source_src_28000.ds_partitioned, isoweek) AS ds_partitioned__week - , DATE_TRUNC(bookings_source_src_28000.ds_partitioned, month) AS ds_partitioned__month - , DATE_TRUNC(bookings_source_src_28000.ds_partitioned, quarter) AS ds_partitioned__quarter - , DATE_TRUNC(bookings_source_src_28000.ds_partitioned, year) AS ds_partitioned__year + , DATETIME_TRUNC(bookings_source_src_28000.ds_partitioned, day) AS ds_partitioned__day + , DATETIME_TRUNC(bookings_source_src_28000.ds_partitioned, isoweek) AS ds_partitioned__week + , DATETIME_TRUNC(bookings_source_src_28000.ds_partitioned, month) AS ds_partitioned__month + , DATETIME_TRUNC(bookings_source_src_28000.ds_partitioned, quarter) AS ds_partitioned__quarter + , DATETIME_TRUNC(bookings_source_src_28000.ds_partitioned, year) AS ds_partitioned__year , EXTRACT(year FROM bookings_source_src_28000.ds_partitioned) AS ds_partitioned__extract_year , EXTRACT(quarter FROM bookings_source_src_28000.ds_partitioned) AS ds_partitioned__extract_quarter , EXTRACT(month FROM bookings_source_src_28000.ds_partitioned) AS ds_partitioned__extract_month , EXTRACT(day FROM bookings_source_src_28000.ds_partitioned) AS ds_partitioned__extract_day , IF(EXTRACT(dayofweek FROM bookings_source_src_28000.ds_partitioned) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_28000.ds_partitioned) - 1) AS ds_partitioned__extract_dow , EXTRACT(dayofyear FROM bookings_source_src_28000.ds_partitioned) AS ds_partitioned__extract_doy - , DATE_TRUNC(bookings_source_src_28000.paid_at, day) AS paid_at__day - , DATE_TRUNC(bookings_source_src_28000.paid_at, isoweek) AS paid_at__week - , DATE_TRUNC(bookings_source_src_28000.paid_at, month) AS paid_at__month - , DATE_TRUNC(bookings_source_src_28000.paid_at, quarter) AS paid_at__quarter - , DATE_TRUNC(bookings_source_src_28000.paid_at, year) AS paid_at__year + , DATETIME_TRUNC(bookings_source_src_28000.paid_at, day) AS paid_at__day + , DATETIME_TRUNC(bookings_source_src_28000.paid_at, isoweek) AS paid_at__week + , DATETIME_TRUNC(bookings_source_src_28000.paid_at, month) AS paid_at__month + , DATETIME_TRUNC(bookings_source_src_28000.paid_at, quarter) AS paid_at__quarter + , DATETIME_TRUNC(bookings_source_src_28000.paid_at, year) AS paid_at__year , EXTRACT(year FROM bookings_source_src_28000.paid_at) AS paid_at__extract_year , EXTRACT(quarter FROM bookings_source_src_28000.paid_at) AS paid_at__extract_quarter , EXTRACT(month FROM bookings_source_src_28000.paid_at) AS paid_at__extract_month @@ -841,33 +841,33 @@ FROM ( , IF(EXTRACT(dayofweek FROM bookings_source_src_28000.paid_at) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_28000.paid_at) - 1) AS paid_at__extract_dow , EXTRACT(dayofyear FROM bookings_source_src_28000.paid_at) AS paid_at__extract_doy , bookings_source_src_28000.is_instant AS booking__is_instant - , DATE_TRUNC(bookings_source_src_28000.ds, day) AS booking__ds__day - , DATE_TRUNC(bookings_source_src_28000.ds, isoweek) AS booking__ds__week - , DATE_TRUNC(bookings_source_src_28000.ds, month) AS booking__ds__month - , DATE_TRUNC(bookings_source_src_28000.ds, quarter) AS booking__ds__quarter - , DATE_TRUNC(bookings_source_src_28000.ds, year) AS booking__ds__year + , DATETIME_TRUNC(bookings_source_src_28000.ds, day) AS booking__ds__day + , DATETIME_TRUNC(bookings_source_src_28000.ds, isoweek) AS booking__ds__week + , DATETIME_TRUNC(bookings_source_src_28000.ds, month) AS booking__ds__month + , DATETIME_TRUNC(bookings_source_src_28000.ds, quarter) AS booking__ds__quarter + , DATETIME_TRUNC(bookings_source_src_28000.ds, year) AS booking__ds__year , EXTRACT(year FROM bookings_source_src_28000.ds) AS booking__ds__extract_year , EXTRACT(quarter FROM bookings_source_src_28000.ds) AS booking__ds__extract_quarter , EXTRACT(month FROM bookings_source_src_28000.ds) AS booking__ds__extract_month , EXTRACT(day FROM bookings_source_src_28000.ds) AS booking__ds__extract_day , IF(EXTRACT(dayofweek FROM bookings_source_src_28000.ds) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_28000.ds) - 1) AS booking__ds__extract_dow , EXTRACT(dayofyear FROM bookings_source_src_28000.ds) AS booking__ds__extract_doy - , DATE_TRUNC(bookings_source_src_28000.ds_partitioned, day) AS booking__ds_partitioned__day - , DATE_TRUNC(bookings_source_src_28000.ds_partitioned, isoweek) AS booking__ds_partitioned__week - , DATE_TRUNC(bookings_source_src_28000.ds_partitioned, month) AS booking__ds_partitioned__month - , DATE_TRUNC(bookings_source_src_28000.ds_partitioned, quarter) AS booking__ds_partitioned__quarter - , DATE_TRUNC(bookings_source_src_28000.ds_partitioned, year) AS booking__ds_partitioned__year + , DATETIME_TRUNC(bookings_source_src_28000.ds_partitioned, day) AS booking__ds_partitioned__day + , DATETIME_TRUNC(bookings_source_src_28000.ds_partitioned, isoweek) AS booking__ds_partitioned__week + , DATETIME_TRUNC(bookings_source_src_28000.ds_partitioned, month) AS booking__ds_partitioned__month + , DATETIME_TRUNC(bookings_source_src_28000.ds_partitioned, quarter) AS booking__ds_partitioned__quarter + , DATETIME_TRUNC(bookings_source_src_28000.ds_partitioned, year) AS booking__ds_partitioned__year , EXTRACT(year FROM bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__extract_year , EXTRACT(quarter FROM bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__extract_quarter , EXTRACT(month FROM bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__extract_month , EXTRACT(day FROM bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__extract_day , IF(EXTRACT(dayofweek FROM bookings_source_src_28000.ds_partitioned) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_28000.ds_partitioned) - 1) AS booking__ds_partitioned__extract_dow , EXTRACT(dayofyear FROM bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__extract_doy - , DATE_TRUNC(bookings_source_src_28000.paid_at, day) AS booking__paid_at__day - , DATE_TRUNC(bookings_source_src_28000.paid_at, isoweek) AS booking__paid_at__week - , DATE_TRUNC(bookings_source_src_28000.paid_at, month) AS booking__paid_at__month - , DATE_TRUNC(bookings_source_src_28000.paid_at, quarter) AS booking__paid_at__quarter - , DATE_TRUNC(bookings_source_src_28000.paid_at, year) AS booking__paid_at__year + , DATETIME_TRUNC(bookings_source_src_28000.paid_at, day) AS booking__paid_at__day + , DATETIME_TRUNC(bookings_source_src_28000.paid_at, isoweek) AS booking__paid_at__week + , DATETIME_TRUNC(bookings_source_src_28000.paid_at, month) AS booking__paid_at__month + , DATETIME_TRUNC(bookings_source_src_28000.paid_at, quarter) AS booking__paid_at__quarter + , DATETIME_TRUNC(bookings_source_src_28000.paid_at, year) AS booking__paid_at__year , EXTRACT(year FROM bookings_source_src_28000.paid_at) AS booking__paid_at__extract_year , EXTRACT(quarter FROM bookings_source_src_28000.paid_at) AS booking__paid_at__extract_quarter , EXTRACT(month FROM bookings_source_src_28000.paid_at) AS booking__paid_at__extract_month diff --git a/tests_metricflow/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/BigQuery/test_nested_derived_metric__plan0_optimized.sql b/tests_metricflow/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/BigQuery/test_nested_derived_metric__plan0_optimized.sql index 909c544ca1..8d4aa24f29 100644 --- a/tests_metricflow/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/BigQuery/test_nested_derived_metric__plan0_optimized.sql +++ b/tests_metricflow/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/BigQuery/test_nested_derived_metric__plan0_optimized.sql @@ -31,7 +31,7 @@ FROM ( -- Metric Time Dimension 'ds' -- Pass Only Elements: ['referred_bookings', 'metric_time__day'] SELECT - DATE_TRUNC(ds, day) AS metric_time__day + DATETIME_TRUNC(ds, day) AS metric_time__day , CASE WHEN referrer_id IS NOT NULL THEN 1 ELSE 0 END AS referred_bookings FROM ***************************.fct_bookings bookings_source_src_28000 ) subq_25 @@ -49,7 +49,7 @@ FROM ( -- Metric Time Dimension 'ds' -- Pass Only Elements: ['bookings', 'metric_time__day'] SELECT - DATE_TRUNC(ds, day) AS metric_time__day + DATETIME_TRUNC(ds, day) AS metric_time__day , 1 AS bookings FROM ***************************.fct_bookings bookings_source_src_28000 ) subq_30 @@ -73,7 +73,7 @@ FROM ( -- Metric Time Dimension 'ds' -- Pass Only Elements: ['instant_bookings', 'metric_time__day'] SELECT - DATE_TRUNC(ds, day) AS metric_time__day + DATETIME_TRUNC(ds, day) AS metric_time__day , CASE WHEN is_instant THEN 1 ELSE 0 END AS instant_bookings FROM ***************************.fct_bookings bookings_source_src_28000 ) subq_37 @@ -93,7 +93,7 @@ FROM ( -- Metric Time Dimension 'ds' -- Pass Only Elements: ['bookings', 'metric_time__day'] SELECT - DATE_TRUNC(ds, day) AS metric_time__day + DATETIME_TRUNC(ds, day) AS metric_time__day , 1 AS bookings FROM ***************************.fct_bookings bookings_source_src_28000 ) subq_42 diff --git a/tests_metricflow/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/BigQuery/test_nested_derived_metric_offset_with_joined_where_constraint_not_selected__plan0.sql b/tests_metricflow/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/BigQuery/test_nested_derived_metric_offset_with_joined_where_constraint_not_selected__plan0.sql index f021d4e62f..38abfd9503 100644 --- a/tests_metricflow/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/BigQuery/test_nested_derived_metric_offset_with_joined_where_constraint_not_selected__plan0.sql +++ b/tests_metricflow/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/BigQuery/test_nested_derived_metric_offset_with_joined_where_constraint_not_selected__plan0.sql @@ -53,10 +53,10 @@ FROM ( -- Join to Time Spine Dataset SELECT subq_2.metric_time__day AS metric_time__day - , DATE_TRUNC(subq_2.metric_time__day, isoweek) AS metric_time__week - , DATE_TRUNC(subq_2.metric_time__day, month) AS metric_time__month - , DATE_TRUNC(subq_2.metric_time__day, quarter) AS metric_time__quarter - , DATE_TRUNC(subq_2.metric_time__day, year) AS metric_time__year + , DATETIME_TRUNC(subq_2.metric_time__day, isoweek) AS metric_time__week + , DATETIME_TRUNC(subq_2.metric_time__day, month) AS metric_time__month + , DATETIME_TRUNC(subq_2.metric_time__day, quarter) AS metric_time__quarter + , DATETIME_TRUNC(subq_2.metric_time__day, year) AS metric_time__year , EXTRACT(year FROM subq_2.metric_time__day) AS metric_time__extract_year , EXTRACT(quarter FROM subq_2.metric_time__day) AS metric_time__extract_quarter , EXTRACT(month FROM subq_2.metric_time__day) AS metric_time__extract_month @@ -275,33 +275,33 @@ FROM ( , bookings_source_src_28000.booking_value AS approximate_continuous_booking_value_p99 , bookings_source_src_28000.booking_value AS approximate_discrete_booking_value_p99 , bookings_source_src_28000.is_instant - , DATE_TRUNC(bookings_source_src_28000.ds, day) AS ds__day - , DATE_TRUNC(bookings_source_src_28000.ds, isoweek) AS ds__week - , DATE_TRUNC(bookings_source_src_28000.ds, month) AS ds__month - , DATE_TRUNC(bookings_source_src_28000.ds, quarter) AS ds__quarter - , DATE_TRUNC(bookings_source_src_28000.ds, year) AS ds__year + , DATETIME_TRUNC(bookings_source_src_28000.ds, day) AS ds__day + , DATETIME_TRUNC(bookings_source_src_28000.ds, isoweek) AS ds__week + , DATETIME_TRUNC(bookings_source_src_28000.ds, month) AS ds__month + , DATETIME_TRUNC(bookings_source_src_28000.ds, quarter) AS ds__quarter + , DATETIME_TRUNC(bookings_source_src_28000.ds, year) AS ds__year , EXTRACT(year FROM bookings_source_src_28000.ds) AS ds__extract_year , EXTRACT(quarter FROM bookings_source_src_28000.ds) AS ds__extract_quarter , EXTRACT(month FROM bookings_source_src_28000.ds) AS ds__extract_month , EXTRACT(day FROM bookings_source_src_28000.ds) AS ds__extract_day , IF(EXTRACT(dayofweek FROM bookings_source_src_28000.ds) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_28000.ds) - 1) AS ds__extract_dow , EXTRACT(dayofyear FROM bookings_source_src_28000.ds) AS ds__extract_doy - , DATE_TRUNC(bookings_source_src_28000.ds_partitioned, day) AS ds_partitioned__day - , DATE_TRUNC(bookings_source_src_28000.ds_partitioned, isoweek) AS ds_partitioned__week - , DATE_TRUNC(bookings_source_src_28000.ds_partitioned, month) AS ds_partitioned__month - , DATE_TRUNC(bookings_source_src_28000.ds_partitioned, quarter) AS ds_partitioned__quarter - , DATE_TRUNC(bookings_source_src_28000.ds_partitioned, year) AS ds_partitioned__year + , DATETIME_TRUNC(bookings_source_src_28000.ds_partitioned, day) AS ds_partitioned__day + , DATETIME_TRUNC(bookings_source_src_28000.ds_partitioned, isoweek) AS ds_partitioned__week + , DATETIME_TRUNC(bookings_source_src_28000.ds_partitioned, month) AS ds_partitioned__month + , DATETIME_TRUNC(bookings_source_src_28000.ds_partitioned, quarter) AS ds_partitioned__quarter + , DATETIME_TRUNC(bookings_source_src_28000.ds_partitioned, year) AS ds_partitioned__year , EXTRACT(year FROM bookings_source_src_28000.ds_partitioned) AS ds_partitioned__extract_year , EXTRACT(quarter FROM bookings_source_src_28000.ds_partitioned) AS ds_partitioned__extract_quarter , EXTRACT(month FROM bookings_source_src_28000.ds_partitioned) AS ds_partitioned__extract_month , EXTRACT(day FROM bookings_source_src_28000.ds_partitioned) AS ds_partitioned__extract_day , IF(EXTRACT(dayofweek FROM bookings_source_src_28000.ds_partitioned) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_28000.ds_partitioned) - 1) AS ds_partitioned__extract_dow , EXTRACT(dayofyear FROM bookings_source_src_28000.ds_partitioned) AS ds_partitioned__extract_doy - , DATE_TRUNC(bookings_source_src_28000.paid_at, day) AS paid_at__day - , DATE_TRUNC(bookings_source_src_28000.paid_at, isoweek) AS paid_at__week - , DATE_TRUNC(bookings_source_src_28000.paid_at, month) AS paid_at__month - , DATE_TRUNC(bookings_source_src_28000.paid_at, quarter) AS paid_at__quarter - , DATE_TRUNC(bookings_source_src_28000.paid_at, year) AS paid_at__year + , DATETIME_TRUNC(bookings_source_src_28000.paid_at, day) AS paid_at__day + , DATETIME_TRUNC(bookings_source_src_28000.paid_at, isoweek) AS paid_at__week + , DATETIME_TRUNC(bookings_source_src_28000.paid_at, month) AS paid_at__month + , DATETIME_TRUNC(bookings_source_src_28000.paid_at, quarter) AS paid_at__quarter + , DATETIME_TRUNC(bookings_source_src_28000.paid_at, year) AS paid_at__year , EXTRACT(year FROM bookings_source_src_28000.paid_at) AS paid_at__extract_year , EXTRACT(quarter FROM bookings_source_src_28000.paid_at) AS paid_at__extract_quarter , EXTRACT(month FROM bookings_source_src_28000.paid_at) AS paid_at__extract_month @@ -309,33 +309,33 @@ FROM ( , IF(EXTRACT(dayofweek FROM bookings_source_src_28000.paid_at) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_28000.paid_at) - 1) AS paid_at__extract_dow , EXTRACT(dayofyear FROM bookings_source_src_28000.paid_at) AS paid_at__extract_doy , bookings_source_src_28000.is_instant AS booking__is_instant - , DATE_TRUNC(bookings_source_src_28000.ds, day) AS booking__ds__day - , DATE_TRUNC(bookings_source_src_28000.ds, isoweek) AS booking__ds__week - , DATE_TRUNC(bookings_source_src_28000.ds, month) AS booking__ds__month - , DATE_TRUNC(bookings_source_src_28000.ds, quarter) AS booking__ds__quarter - , DATE_TRUNC(bookings_source_src_28000.ds, year) AS booking__ds__year + , DATETIME_TRUNC(bookings_source_src_28000.ds, day) AS booking__ds__day + , DATETIME_TRUNC(bookings_source_src_28000.ds, isoweek) AS booking__ds__week + , DATETIME_TRUNC(bookings_source_src_28000.ds, month) AS booking__ds__month + , DATETIME_TRUNC(bookings_source_src_28000.ds, quarter) AS booking__ds__quarter + , DATETIME_TRUNC(bookings_source_src_28000.ds, year) AS booking__ds__year , EXTRACT(year FROM bookings_source_src_28000.ds) AS booking__ds__extract_year , EXTRACT(quarter FROM bookings_source_src_28000.ds) AS booking__ds__extract_quarter , EXTRACT(month FROM bookings_source_src_28000.ds) AS booking__ds__extract_month , EXTRACT(day FROM bookings_source_src_28000.ds) AS booking__ds__extract_day , IF(EXTRACT(dayofweek FROM bookings_source_src_28000.ds) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_28000.ds) - 1) AS booking__ds__extract_dow , EXTRACT(dayofyear FROM bookings_source_src_28000.ds) AS booking__ds__extract_doy - , DATE_TRUNC(bookings_source_src_28000.ds_partitioned, day) AS booking__ds_partitioned__day - , DATE_TRUNC(bookings_source_src_28000.ds_partitioned, isoweek) AS booking__ds_partitioned__week - , DATE_TRUNC(bookings_source_src_28000.ds_partitioned, month) AS booking__ds_partitioned__month - , DATE_TRUNC(bookings_source_src_28000.ds_partitioned, quarter) AS booking__ds_partitioned__quarter - , DATE_TRUNC(bookings_source_src_28000.ds_partitioned, year) AS booking__ds_partitioned__year + , DATETIME_TRUNC(bookings_source_src_28000.ds_partitioned, day) AS booking__ds_partitioned__day + , DATETIME_TRUNC(bookings_source_src_28000.ds_partitioned, isoweek) AS booking__ds_partitioned__week + , DATETIME_TRUNC(bookings_source_src_28000.ds_partitioned, month) AS booking__ds_partitioned__month + , DATETIME_TRUNC(bookings_source_src_28000.ds_partitioned, quarter) AS booking__ds_partitioned__quarter + , DATETIME_TRUNC(bookings_source_src_28000.ds_partitioned, year) AS booking__ds_partitioned__year , EXTRACT(year FROM bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__extract_year , EXTRACT(quarter FROM bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__extract_quarter , EXTRACT(month FROM bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__extract_month , EXTRACT(day FROM bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__extract_day , IF(EXTRACT(dayofweek FROM bookings_source_src_28000.ds_partitioned) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_28000.ds_partitioned) - 1) AS booking__ds_partitioned__extract_dow , EXTRACT(dayofyear FROM bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__extract_doy - , DATE_TRUNC(bookings_source_src_28000.paid_at, day) AS booking__paid_at__day - , DATE_TRUNC(bookings_source_src_28000.paid_at, isoweek) AS booking__paid_at__week - , DATE_TRUNC(bookings_source_src_28000.paid_at, month) AS booking__paid_at__month - , DATE_TRUNC(bookings_source_src_28000.paid_at, quarter) AS booking__paid_at__quarter - , DATE_TRUNC(bookings_source_src_28000.paid_at, year) AS booking__paid_at__year + , DATETIME_TRUNC(bookings_source_src_28000.paid_at, day) AS booking__paid_at__day + , DATETIME_TRUNC(bookings_source_src_28000.paid_at, isoweek) AS booking__paid_at__week + , DATETIME_TRUNC(bookings_source_src_28000.paid_at, month) AS booking__paid_at__month + , DATETIME_TRUNC(bookings_source_src_28000.paid_at, quarter) AS booking__paid_at__quarter + , DATETIME_TRUNC(bookings_source_src_28000.paid_at, year) AS booking__paid_at__year , EXTRACT(year FROM bookings_source_src_28000.paid_at) AS booking__paid_at__extract_year , EXTRACT(quarter FROM bookings_source_src_28000.paid_at) AS booking__paid_at__extract_quarter , EXTRACT(month FROM bookings_source_src_28000.paid_at) AS booking__paid_at__extract_month diff --git a/tests_metricflow/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/BigQuery/test_nested_derived_metric_offset_with_joined_where_constraint_not_selected__plan0_optimized.sql b/tests_metricflow/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/BigQuery/test_nested_derived_metric_offset_with_joined_where_constraint_not_selected__plan0_optimized.sql index b8927fe733..0fab73319b 100644 --- a/tests_metricflow/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/BigQuery/test_nested_derived_metric_offset_with_joined_where_constraint_not_selected__plan0_optimized.sql +++ b/tests_metricflow/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/BigQuery/test_nested_derived_metric_offset_with_joined_where_constraint_not_selected__plan0_optimized.sql @@ -35,7 +35,7 @@ FROM ( -- Read Elements From Semantic Model 'bookings_source' -- Metric Time Dimension 'ds' SELECT - DATE_TRUNC(ds, day) AS metric_time__day + DATETIME_TRUNC(ds, day) AS metric_time__day , is_instant AS booking__is_instant , 1 AS bookings FROM ***************************.fct_bookings bookings_source_src_28000 diff --git a/tests_metricflow/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/BigQuery/test_nested_derived_metric_with_offset_multiple_input_metrics__plan0.sql b/tests_metricflow/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/BigQuery/test_nested_derived_metric_with_offset_multiple_input_metrics__plan0.sql index 8ee964c7d7..f96b3ee476 100644 --- a/tests_metricflow/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/BigQuery/test_nested_derived_metric_with_offset_multiple_input_metrics__plan0.sql +++ b/tests_metricflow/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/BigQuery/test_nested_derived_metric_with_offset_multiple_input_metrics__plan0.sql @@ -158,33 +158,33 @@ FROM ( , bookings_source_src_28000.booking_value AS approximate_continuous_booking_value_p99 , bookings_source_src_28000.booking_value AS approximate_discrete_booking_value_p99 , bookings_source_src_28000.is_instant - , DATE_TRUNC(bookings_source_src_28000.ds, day) AS ds__day - , DATE_TRUNC(bookings_source_src_28000.ds, isoweek) AS ds__week - , DATE_TRUNC(bookings_source_src_28000.ds, month) AS ds__month - , DATE_TRUNC(bookings_source_src_28000.ds, quarter) AS ds__quarter - , DATE_TRUNC(bookings_source_src_28000.ds, year) AS ds__year + , DATETIME_TRUNC(bookings_source_src_28000.ds, day) AS ds__day + , DATETIME_TRUNC(bookings_source_src_28000.ds, isoweek) AS ds__week + , DATETIME_TRUNC(bookings_source_src_28000.ds, month) AS ds__month + , DATETIME_TRUNC(bookings_source_src_28000.ds, quarter) AS ds__quarter + , DATETIME_TRUNC(bookings_source_src_28000.ds, year) AS ds__year , EXTRACT(year FROM bookings_source_src_28000.ds) AS ds__extract_year , EXTRACT(quarter FROM bookings_source_src_28000.ds) AS ds__extract_quarter , EXTRACT(month FROM bookings_source_src_28000.ds) AS ds__extract_month , EXTRACT(day FROM bookings_source_src_28000.ds) AS ds__extract_day , IF(EXTRACT(dayofweek FROM bookings_source_src_28000.ds) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_28000.ds) - 1) AS ds__extract_dow , EXTRACT(dayofyear FROM bookings_source_src_28000.ds) AS ds__extract_doy - , DATE_TRUNC(bookings_source_src_28000.ds_partitioned, day) AS ds_partitioned__day - , DATE_TRUNC(bookings_source_src_28000.ds_partitioned, isoweek) AS ds_partitioned__week - , DATE_TRUNC(bookings_source_src_28000.ds_partitioned, month) AS ds_partitioned__month - , DATE_TRUNC(bookings_source_src_28000.ds_partitioned, quarter) AS ds_partitioned__quarter - , DATE_TRUNC(bookings_source_src_28000.ds_partitioned, year) AS ds_partitioned__year + , DATETIME_TRUNC(bookings_source_src_28000.ds_partitioned, day) AS ds_partitioned__day + , DATETIME_TRUNC(bookings_source_src_28000.ds_partitioned, isoweek) AS ds_partitioned__week + , DATETIME_TRUNC(bookings_source_src_28000.ds_partitioned, month) AS ds_partitioned__month + , DATETIME_TRUNC(bookings_source_src_28000.ds_partitioned, quarter) AS ds_partitioned__quarter + , DATETIME_TRUNC(bookings_source_src_28000.ds_partitioned, year) AS ds_partitioned__year , EXTRACT(year FROM bookings_source_src_28000.ds_partitioned) AS ds_partitioned__extract_year , EXTRACT(quarter FROM bookings_source_src_28000.ds_partitioned) AS ds_partitioned__extract_quarter , EXTRACT(month FROM bookings_source_src_28000.ds_partitioned) AS ds_partitioned__extract_month , EXTRACT(day FROM bookings_source_src_28000.ds_partitioned) AS ds_partitioned__extract_day , IF(EXTRACT(dayofweek FROM bookings_source_src_28000.ds_partitioned) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_28000.ds_partitioned) - 1) AS ds_partitioned__extract_dow , EXTRACT(dayofyear FROM bookings_source_src_28000.ds_partitioned) AS ds_partitioned__extract_doy - , DATE_TRUNC(bookings_source_src_28000.paid_at, day) AS paid_at__day - , DATE_TRUNC(bookings_source_src_28000.paid_at, isoweek) AS paid_at__week - , DATE_TRUNC(bookings_source_src_28000.paid_at, month) AS paid_at__month - , DATE_TRUNC(bookings_source_src_28000.paid_at, quarter) AS paid_at__quarter - , DATE_TRUNC(bookings_source_src_28000.paid_at, year) AS paid_at__year + , DATETIME_TRUNC(bookings_source_src_28000.paid_at, day) AS paid_at__day + , DATETIME_TRUNC(bookings_source_src_28000.paid_at, isoweek) AS paid_at__week + , DATETIME_TRUNC(bookings_source_src_28000.paid_at, month) AS paid_at__month + , DATETIME_TRUNC(bookings_source_src_28000.paid_at, quarter) AS paid_at__quarter + , DATETIME_TRUNC(bookings_source_src_28000.paid_at, year) AS paid_at__year , EXTRACT(year FROM bookings_source_src_28000.paid_at) AS paid_at__extract_year , EXTRACT(quarter FROM bookings_source_src_28000.paid_at) AS paid_at__extract_quarter , EXTRACT(month FROM bookings_source_src_28000.paid_at) AS paid_at__extract_month @@ -192,33 +192,33 @@ FROM ( , IF(EXTRACT(dayofweek FROM bookings_source_src_28000.paid_at) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_28000.paid_at) - 1) AS paid_at__extract_dow , EXTRACT(dayofyear FROM bookings_source_src_28000.paid_at) AS paid_at__extract_doy , bookings_source_src_28000.is_instant AS booking__is_instant - , DATE_TRUNC(bookings_source_src_28000.ds, day) AS booking__ds__day - , DATE_TRUNC(bookings_source_src_28000.ds, isoweek) AS booking__ds__week - , DATE_TRUNC(bookings_source_src_28000.ds, month) AS booking__ds__month - , DATE_TRUNC(bookings_source_src_28000.ds, quarter) AS booking__ds__quarter - , DATE_TRUNC(bookings_source_src_28000.ds, year) AS booking__ds__year + , DATETIME_TRUNC(bookings_source_src_28000.ds, day) AS booking__ds__day + , DATETIME_TRUNC(bookings_source_src_28000.ds, isoweek) AS booking__ds__week + , DATETIME_TRUNC(bookings_source_src_28000.ds, month) AS booking__ds__month + , DATETIME_TRUNC(bookings_source_src_28000.ds, quarter) AS booking__ds__quarter + , DATETIME_TRUNC(bookings_source_src_28000.ds, year) AS booking__ds__year , EXTRACT(year FROM bookings_source_src_28000.ds) AS booking__ds__extract_year , EXTRACT(quarter FROM bookings_source_src_28000.ds) AS booking__ds__extract_quarter , EXTRACT(month FROM bookings_source_src_28000.ds) AS booking__ds__extract_month , EXTRACT(day FROM bookings_source_src_28000.ds) AS booking__ds__extract_day , IF(EXTRACT(dayofweek FROM bookings_source_src_28000.ds) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_28000.ds) - 1) AS booking__ds__extract_dow , EXTRACT(dayofyear FROM bookings_source_src_28000.ds) AS booking__ds__extract_doy - , DATE_TRUNC(bookings_source_src_28000.ds_partitioned, day) AS booking__ds_partitioned__day - , DATE_TRUNC(bookings_source_src_28000.ds_partitioned, isoweek) AS booking__ds_partitioned__week - , DATE_TRUNC(bookings_source_src_28000.ds_partitioned, month) AS booking__ds_partitioned__month - , DATE_TRUNC(bookings_source_src_28000.ds_partitioned, quarter) AS booking__ds_partitioned__quarter - , DATE_TRUNC(bookings_source_src_28000.ds_partitioned, year) AS booking__ds_partitioned__year + , DATETIME_TRUNC(bookings_source_src_28000.ds_partitioned, day) AS booking__ds_partitioned__day + , DATETIME_TRUNC(bookings_source_src_28000.ds_partitioned, isoweek) AS booking__ds_partitioned__week + , DATETIME_TRUNC(bookings_source_src_28000.ds_partitioned, month) AS booking__ds_partitioned__month + , DATETIME_TRUNC(bookings_source_src_28000.ds_partitioned, quarter) AS booking__ds_partitioned__quarter + , DATETIME_TRUNC(bookings_source_src_28000.ds_partitioned, year) AS booking__ds_partitioned__year , EXTRACT(year FROM bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__extract_year , EXTRACT(quarter FROM bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__extract_quarter , EXTRACT(month FROM bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__extract_month , EXTRACT(day FROM bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__extract_day , IF(EXTRACT(dayofweek FROM bookings_source_src_28000.ds_partitioned) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_28000.ds_partitioned) - 1) AS booking__ds_partitioned__extract_dow , EXTRACT(dayofyear FROM bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__extract_doy - , DATE_TRUNC(bookings_source_src_28000.paid_at, day) AS booking__paid_at__day - , DATE_TRUNC(bookings_source_src_28000.paid_at, isoweek) AS booking__paid_at__week - , DATE_TRUNC(bookings_source_src_28000.paid_at, month) AS booking__paid_at__month - , DATE_TRUNC(bookings_source_src_28000.paid_at, quarter) AS booking__paid_at__quarter - , DATE_TRUNC(bookings_source_src_28000.paid_at, year) AS booking__paid_at__year + , DATETIME_TRUNC(bookings_source_src_28000.paid_at, day) AS booking__paid_at__day + , DATETIME_TRUNC(bookings_source_src_28000.paid_at, isoweek) AS booking__paid_at__week + , DATETIME_TRUNC(bookings_source_src_28000.paid_at, month) AS booking__paid_at__month + , DATETIME_TRUNC(bookings_source_src_28000.paid_at, quarter) AS booking__paid_at__quarter + , DATETIME_TRUNC(bookings_source_src_28000.paid_at, year) AS booking__paid_at__year , EXTRACT(year FROM bookings_source_src_28000.paid_at) AS booking__paid_at__extract_year , EXTRACT(quarter FROM bookings_source_src_28000.paid_at) AS booking__paid_at__extract_quarter , EXTRACT(month FROM bookings_source_src_28000.paid_at) AS booking__paid_at__extract_month @@ -241,7 +241,7 @@ FROM ( ) subq_4 ) subq_5 ON - DATE_TRUNC(subq_6.metric_time__day, month) = subq_5.metric_time__day + DATETIME_TRUNC(subq_6.metric_time__day, month) = subq_5.metric_time__day ) subq_8 FULL OUTER JOIN ( -- Compute Metrics via Expressions @@ -382,33 +382,33 @@ FROM ( , bookings_source_src_28000.booking_value AS approximate_continuous_booking_value_p99 , bookings_source_src_28000.booking_value AS approximate_discrete_booking_value_p99 , bookings_source_src_28000.is_instant - , DATE_TRUNC(bookings_source_src_28000.ds, day) AS ds__day - , DATE_TRUNC(bookings_source_src_28000.ds, isoweek) AS ds__week - , DATE_TRUNC(bookings_source_src_28000.ds, month) AS ds__month - , DATE_TRUNC(bookings_source_src_28000.ds, quarter) AS ds__quarter - , DATE_TRUNC(bookings_source_src_28000.ds, year) AS ds__year + , DATETIME_TRUNC(bookings_source_src_28000.ds, day) AS ds__day + , DATETIME_TRUNC(bookings_source_src_28000.ds, isoweek) AS ds__week + , DATETIME_TRUNC(bookings_source_src_28000.ds, month) AS ds__month + , DATETIME_TRUNC(bookings_source_src_28000.ds, quarter) AS ds__quarter + , DATETIME_TRUNC(bookings_source_src_28000.ds, year) AS ds__year , EXTRACT(year FROM bookings_source_src_28000.ds) AS ds__extract_year , EXTRACT(quarter FROM bookings_source_src_28000.ds) AS ds__extract_quarter , EXTRACT(month FROM bookings_source_src_28000.ds) AS ds__extract_month , EXTRACT(day FROM bookings_source_src_28000.ds) AS ds__extract_day , IF(EXTRACT(dayofweek FROM bookings_source_src_28000.ds) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_28000.ds) - 1) AS ds__extract_dow , EXTRACT(dayofyear FROM bookings_source_src_28000.ds) AS ds__extract_doy - , DATE_TRUNC(bookings_source_src_28000.ds_partitioned, day) AS ds_partitioned__day - , DATE_TRUNC(bookings_source_src_28000.ds_partitioned, isoweek) AS ds_partitioned__week - , DATE_TRUNC(bookings_source_src_28000.ds_partitioned, month) AS ds_partitioned__month - , DATE_TRUNC(bookings_source_src_28000.ds_partitioned, quarter) AS ds_partitioned__quarter - , DATE_TRUNC(bookings_source_src_28000.ds_partitioned, year) AS ds_partitioned__year + , DATETIME_TRUNC(bookings_source_src_28000.ds_partitioned, day) AS ds_partitioned__day + , DATETIME_TRUNC(bookings_source_src_28000.ds_partitioned, isoweek) AS ds_partitioned__week + , DATETIME_TRUNC(bookings_source_src_28000.ds_partitioned, month) AS ds_partitioned__month + , DATETIME_TRUNC(bookings_source_src_28000.ds_partitioned, quarter) AS ds_partitioned__quarter + , DATETIME_TRUNC(bookings_source_src_28000.ds_partitioned, year) AS ds_partitioned__year , EXTRACT(year FROM bookings_source_src_28000.ds_partitioned) AS ds_partitioned__extract_year , EXTRACT(quarter FROM bookings_source_src_28000.ds_partitioned) AS ds_partitioned__extract_quarter , EXTRACT(month FROM bookings_source_src_28000.ds_partitioned) AS ds_partitioned__extract_month , EXTRACT(day FROM bookings_source_src_28000.ds_partitioned) AS ds_partitioned__extract_day , IF(EXTRACT(dayofweek FROM bookings_source_src_28000.ds_partitioned) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_28000.ds_partitioned) - 1) AS ds_partitioned__extract_dow , EXTRACT(dayofyear FROM bookings_source_src_28000.ds_partitioned) AS ds_partitioned__extract_doy - , DATE_TRUNC(bookings_source_src_28000.paid_at, day) AS paid_at__day - , DATE_TRUNC(bookings_source_src_28000.paid_at, isoweek) AS paid_at__week - , DATE_TRUNC(bookings_source_src_28000.paid_at, month) AS paid_at__month - , DATE_TRUNC(bookings_source_src_28000.paid_at, quarter) AS paid_at__quarter - , DATE_TRUNC(bookings_source_src_28000.paid_at, year) AS paid_at__year + , DATETIME_TRUNC(bookings_source_src_28000.paid_at, day) AS paid_at__day + , DATETIME_TRUNC(bookings_source_src_28000.paid_at, isoweek) AS paid_at__week + , DATETIME_TRUNC(bookings_source_src_28000.paid_at, month) AS paid_at__month + , DATETIME_TRUNC(bookings_source_src_28000.paid_at, quarter) AS paid_at__quarter + , DATETIME_TRUNC(bookings_source_src_28000.paid_at, year) AS paid_at__year , EXTRACT(year FROM bookings_source_src_28000.paid_at) AS paid_at__extract_year , EXTRACT(quarter FROM bookings_source_src_28000.paid_at) AS paid_at__extract_quarter , EXTRACT(month FROM bookings_source_src_28000.paid_at) AS paid_at__extract_month @@ -416,33 +416,33 @@ FROM ( , IF(EXTRACT(dayofweek FROM bookings_source_src_28000.paid_at) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_28000.paid_at) - 1) AS paid_at__extract_dow , EXTRACT(dayofyear FROM bookings_source_src_28000.paid_at) AS paid_at__extract_doy , bookings_source_src_28000.is_instant AS booking__is_instant - , DATE_TRUNC(bookings_source_src_28000.ds, day) AS booking__ds__day - , DATE_TRUNC(bookings_source_src_28000.ds, isoweek) AS booking__ds__week - , DATE_TRUNC(bookings_source_src_28000.ds, month) AS booking__ds__month - , DATE_TRUNC(bookings_source_src_28000.ds, quarter) AS booking__ds__quarter - , DATE_TRUNC(bookings_source_src_28000.ds, year) AS booking__ds__year + , DATETIME_TRUNC(bookings_source_src_28000.ds, day) AS booking__ds__day + , DATETIME_TRUNC(bookings_source_src_28000.ds, isoweek) AS booking__ds__week + , DATETIME_TRUNC(bookings_source_src_28000.ds, month) AS booking__ds__month + , DATETIME_TRUNC(bookings_source_src_28000.ds, quarter) AS booking__ds__quarter + , DATETIME_TRUNC(bookings_source_src_28000.ds, year) AS booking__ds__year , EXTRACT(year FROM bookings_source_src_28000.ds) AS booking__ds__extract_year , EXTRACT(quarter FROM bookings_source_src_28000.ds) AS booking__ds__extract_quarter , EXTRACT(month FROM bookings_source_src_28000.ds) AS booking__ds__extract_month , EXTRACT(day FROM bookings_source_src_28000.ds) AS booking__ds__extract_day , IF(EXTRACT(dayofweek FROM bookings_source_src_28000.ds) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_28000.ds) - 1) AS booking__ds__extract_dow , EXTRACT(dayofyear FROM bookings_source_src_28000.ds) AS booking__ds__extract_doy - , DATE_TRUNC(bookings_source_src_28000.ds_partitioned, day) AS booking__ds_partitioned__day - , DATE_TRUNC(bookings_source_src_28000.ds_partitioned, isoweek) AS booking__ds_partitioned__week - , DATE_TRUNC(bookings_source_src_28000.ds_partitioned, month) AS booking__ds_partitioned__month - , DATE_TRUNC(bookings_source_src_28000.ds_partitioned, quarter) AS booking__ds_partitioned__quarter - , DATE_TRUNC(bookings_source_src_28000.ds_partitioned, year) AS booking__ds_partitioned__year + , DATETIME_TRUNC(bookings_source_src_28000.ds_partitioned, day) AS booking__ds_partitioned__day + , DATETIME_TRUNC(bookings_source_src_28000.ds_partitioned, isoweek) AS booking__ds_partitioned__week + , DATETIME_TRUNC(bookings_source_src_28000.ds_partitioned, month) AS booking__ds_partitioned__month + , DATETIME_TRUNC(bookings_source_src_28000.ds_partitioned, quarter) AS booking__ds_partitioned__quarter + , DATETIME_TRUNC(bookings_source_src_28000.ds_partitioned, year) AS booking__ds_partitioned__year , EXTRACT(year FROM bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__extract_year , EXTRACT(quarter FROM bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__extract_quarter , EXTRACT(month FROM bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__extract_month , EXTRACT(day FROM bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__extract_day , IF(EXTRACT(dayofweek FROM bookings_source_src_28000.ds_partitioned) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_28000.ds_partitioned) - 1) AS booking__ds_partitioned__extract_dow , EXTRACT(dayofyear FROM bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__extract_doy - , DATE_TRUNC(bookings_source_src_28000.paid_at, day) AS booking__paid_at__day - , DATE_TRUNC(bookings_source_src_28000.paid_at, isoweek) AS booking__paid_at__week - , DATE_TRUNC(bookings_source_src_28000.paid_at, month) AS booking__paid_at__month - , DATE_TRUNC(bookings_source_src_28000.paid_at, quarter) AS booking__paid_at__quarter - , DATE_TRUNC(bookings_source_src_28000.paid_at, year) AS booking__paid_at__year + , DATETIME_TRUNC(bookings_source_src_28000.paid_at, day) AS booking__paid_at__day + , DATETIME_TRUNC(bookings_source_src_28000.paid_at, isoweek) AS booking__paid_at__week + , DATETIME_TRUNC(bookings_source_src_28000.paid_at, month) AS booking__paid_at__month + , DATETIME_TRUNC(bookings_source_src_28000.paid_at, quarter) AS booking__paid_at__quarter + , DATETIME_TRUNC(bookings_source_src_28000.paid_at, year) AS booking__paid_at__year , EXTRACT(year FROM bookings_source_src_28000.paid_at) AS booking__paid_at__extract_year , EXTRACT(quarter FROM bookings_source_src_28000.paid_at) AS booking__paid_at__extract_quarter , EXTRACT(month FROM bookings_source_src_28000.paid_at) AS booking__paid_at__extract_month diff --git a/tests_metricflow/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/BigQuery/test_nested_derived_metric_with_offset_multiple_input_metrics__plan0_optimized.sql b/tests_metricflow/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/BigQuery/test_nested_derived_metric_with_offset_multiple_input_metrics__plan0_optimized.sql index fb9b70befa..d7d67e9177 100644 --- a/tests_metricflow/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/BigQuery/test_nested_derived_metric_with_offset_multiple_input_metrics__plan0_optimized.sql +++ b/tests_metricflow/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/BigQuery/test_nested_derived_metric_with_offset_multiple_input_metrics__plan0_optimized.sql @@ -26,7 +26,7 @@ FROM ( -- Aggregate Measures -- Compute Metrics via Expressions SELECT - DATE_TRUNC(ds, day) AS metric_time__day + DATETIME_TRUNC(ds, day) AS metric_time__day , SUM(booking_value) AS booking_value FROM ***************************.fct_bookings bookings_source_src_28000 GROUP BY @@ -34,7 +34,7 @@ FROM ( ) subq_20 ) subq_21 ON - DATE_TRUNC(subq_23.ds, month) = subq_21.metric_time__day + DATETIME_TRUNC(subq_23.ds, month) = subq_21.metric_time__day ) subq_24 FULL OUTER JOIN ( -- Compute Metrics via Expressions @@ -48,7 +48,7 @@ FROM ( -- Aggregate Measures -- Compute Metrics via Expressions SELECT - DATE_TRUNC(ds, day) AS metric_time__day + DATETIME_TRUNC(ds, day) AS metric_time__day , SUM(booking_value) AS booking_value FROM ***************************.fct_bookings bookings_source_src_28000 GROUP BY diff --git a/tests_metricflow/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/BigQuery/test_nested_fill_nulls_without_time_spine__plan0.sql b/tests_metricflow/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/BigQuery/test_nested_fill_nulls_without_time_spine__plan0.sql index 5922cf241e..a6d5e3d063 100644 --- a/tests_metricflow/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/BigQuery/test_nested_fill_nulls_without_time_spine__plan0.sql +++ b/tests_metricflow/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/BigQuery/test_nested_fill_nulls_without_time_spine__plan0.sql @@ -141,33 +141,33 @@ FROM ( , bookings_source_src_28000.booking_value AS approximate_continuous_booking_value_p99 , bookings_source_src_28000.booking_value AS approximate_discrete_booking_value_p99 , bookings_source_src_28000.is_instant - , DATE_TRUNC(bookings_source_src_28000.ds, day) AS ds__day - , DATE_TRUNC(bookings_source_src_28000.ds, isoweek) AS ds__week - , DATE_TRUNC(bookings_source_src_28000.ds, month) AS ds__month - , DATE_TRUNC(bookings_source_src_28000.ds, quarter) AS ds__quarter - , DATE_TRUNC(bookings_source_src_28000.ds, year) AS ds__year + , DATETIME_TRUNC(bookings_source_src_28000.ds, day) AS ds__day + , DATETIME_TRUNC(bookings_source_src_28000.ds, isoweek) AS ds__week + , DATETIME_TRUNC(bookings_source_src_28000.ds, month) AS ds__month + , DATETIME_TRUNC(bookings_source_src_28000.ds, quarter) AS ds__quarter + , DATETIME_TRUNC(bookings_source_src_28000.ds, year) AS ds__year , EXTRACT(year FROM bookings_source_src_28000.ds) AS ds__extract_year , EXTRACT(quarter FROM bookings_source_src_28000.ds) AS ds__extract_quarter , EXTRACT(month FROM bookings_source_src_28000.ds) AS ds__extract_month , EXTRACT(day FROM bookings_source_src_28000.ds) AS ds__extract_day , IF(EXTRACT(dayofweek FROM bookings_source_src_28000.ds) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_28000.ds) - 1) AS ds__extract_dow , EXTRACT(dayofyear FROM bookings_source_src_28000.ds) AS ds__extract_doy - , DATE_TRUNC(bookings_source_src_28000.ds_partitioned, day) AS ds_partitioned__day - , DATE_TRUNC(bookings_source_src_28000.ds_partitioned, isoweek) AS ds_partitioned__week - , DATE_TRUNC(bookings_source_src_28000.ds_partitioned, month) AS ds_partitioned__month - , DATE_TRUNC(bookings_source_src_28000.ds_partitioned, quarter) AS ds_partitioned__quarter - , DATE_TRUNC(bookings_source_src_28000.ds_partitioned, year) AS ds_partitioned__year + , DATETIME_TRUNC(bookings_source_src_28000.ds_partitioned, day) AS ds_partitioned__day + , DATETIME_TRUNC(bookings_source_src_28000.ds_partitioned, isoweek) AS ds_partitioned__week + , DATETIME_TRUNC(bookings_source_src_28000.ds_partitioned, month) AS ds_partitioned__month + , DATETIME_TRUNC(bookings_source_src_28000.ds_partitioned, quarter) AS ds_partitioned__quarter + , DATETIME_TRUNC(bookings_source_src_28000.ds_partitioned, year) AS ds_partitioned__year , EXTRACT(year FROM bookings_source_src_28000.ds_partitioned) AS ds_partitioned__extract_year , EXTRACT(quarter FROM bookings_source_src_28000.ds_partitioned) AS ds_partitioned__extract_quarter , EXTRACT(month FROM bookings_source_src_28000.ds_partitioned) AS ds_partitioned__extract_month , EXTRACT(day FROM bookings_source_src_28000.ds_partitioned) AS ds_partitioned__extract_day , IF(EXTRACT(dayofweek FROM bookings_source_src_28000.ds_partitioned) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_28000.ds_partitioned) - 1) AS ds_partitioned__extract_dow , EXTRACT(dayofyear FROM bookings_source_src_28000.ds_partitioned) AS ds_partitioned__extract_doy - , DATE_TRUNC(bookings_source_src_28000.paid_at, day) AS paid_at__day - , DATE_TRUNC(bookings_source_src_28000.paid_at, isoweek) AS paid_at__week - , DATE_TRUNC(bookings_source_src_28000.paid_at, month) AS paid_at__month - , DATE_TRUNC(bookings_source_src_28000.paid_at, quarter) AS paid_at__quarter - , DATE_TRUNC(bookings_source_src_28000.paid_at, year) AS paid_at__year + , DATETIME_TRUNC(bookings_source_src_28000.paid_at, day) AS paid_at__day + , DATETIME_TRUNC(bookings_source_src_28000.paid_at, isoweek) AS paid_at__week + , DATETIME_TRUNC(bookings_source_src_28000.paid_at, month) AS paid_at__month + , DATETIME_TRUNC(bookings_source_src_28000.paid_at, quarter) AS paid_at__quarter + , DATETIME_TRUNC(bookings_source_src_28000.paid_at, year) AS paid_at__year , EXTRACT(year FROM bookings_source_src_28000.paid_at) AS paid_at__extract_year , EXTRACT(quarter FROM bookings_source_src_28000.paid_at) AS paid_at__extract_quarter , EXTRACT(month FROM bookings_source_src_28000.paid_at) AS paid_at__extract_month @@ -175,33 +175,33 @@ FROM ( , IF(EXTRACT(dayofweek FROM bookings_source_src_28000.paid_at) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_28000.paid_at) - 1) AS paid_at__extract_dow , EXTRACT(dayofyear FROM bookings_source_src_28000.paid_at) AS paid_at__extract_doy , bookings_source_src_28000.is_instant AS booking__is_instant - , DATE_TRUNC(bookings_source_src_28000.ds, day) AS booking__ds__day - , DATE_TRUNC(bookings_source_src_28000.ds, isoweek) AS booking__ds__week - , DATE_TRUNC(bookings_source_src_28000.ds, month) AS booking__ds__month - , DATE_TRUNC(bookings_source_src_28000.ds, quarter) AS booking__ds__quarter - , DATE_TRUNC(bookings_source_src_28000.ds, year) AS booking__ds__year + , DATETIME_TRUNC(bookings_source_src_28000.ds, day) AS booking__ds__day + , DATETIME_TRUNC(bookings_source_src_28000.ds, isoweek) AS booking__ds__week + , DATETIME_TRUNC(bookings_source_src_28000.ds, month) AS booking__ds__month + , DATETIME_TRUNC(bookings_source_src_28000.ds, quarter) AS booking__ds__quarter + , DATETIME_TRUNC(bookings_source_src_28000.ds, year) AS booking__ds__year , EXTRACT(year FROM bookings_source_src_28000.ds) AS booking__ds__extract_year , EXTRACT(quarter FROM bookings_source_src_28000.ds) AS booking__ds__extract_quarter , EXTRACT(month FROM bookings_source_src_28000.ds) AS booking__ds__extract_month , EXTRACT(day FROM bookings_source_src_28000.ds) AS booking__ds__extract_day , IF(EXTRACT(dayofweek FROM bookings_source_src_28000.ds) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_28000.ds) - 1) AS booking__ds__extract_dow , EXTRACT(dayofyear FROM bookings_source_src_28000.ds) AS booking__ds__extract_doy - , DATE_TRUNC(bookings_source_src_28000.ds_partitioned, day) AS booking__ds_partitioned__day - , DATE_TRUNC(bookings_source_src_28000.ds_partitioned, isoweek) AS booking__ds_partitioned__week - , DATE_TRUNC(bookings_source_src_28000.ds_partitioned, month) AS booking__ds_partitioned__month - , DATE_TRUNC(bookings_source_src_28000.ds_partitioned, quarter) AS booking__ds_partitioned__quarter - , DATE_TRUNC(bookings_source_src_28000.ds_partitioned, year) AS booking__ds_partitioned__year + , DATETIME_TRUNC(bookings_source_src_28000.ds_partitioned, day) AS booking__ds_partitioned__day + , DATETIME_TRUNC(bookings_source_src_28000.ds_partitioned, isoweek) AS booking__ds_partitioned__week + , DATETIME_TRUNC(bookings_source_src_28000.ds_partitioned, month) AS booking__ds_partitioned__month + , DATETIME_TRUNC(bookings_source_src_28000.ds_partitioned, quarter) AS booking__ds_partitioned__quarter + , DATETIME_TRUNC(bookings_source_src_28000.ds_partitioned, year) AS booking__ds_partitioned__year , EXTRACT(year FROM bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__extract_year , EXTRACT(quarter FROM bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__extract_quarter , EXTRACT(month FROM bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__extract_month , EXTRACT(day FROM bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__extract_day , IF(EXTRACT(dayofweek FROM bookings_source_src_28000.ds_partitioned) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_28000.ds_partitioned) - 1) AS booking__ds_partitioned__extract_dow , EXTRACT(dayofyear FROM bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__extract_doy - , DATE_TRUNC(bookings_source_src_28000.paid_at, day) AS booking__paid_at__day - , DATE_TRUNC(bookings_source_src_28000.paid_at, isoweek) AS booking__paid_at__week - , DATE_TRUNC(bookings_source_src_28000.paid_at, month) AS booking__paid_at__month - , DATE_TRUNC(bookings_source_src_28000.paid_at, quarter) AS booking__paid_at__quarter - , DATE_TRUNC(bookings_source_src_28000.paid_at, year) AS booking__paid_at__year + , DATETIME_TRUNC(bookings_source_src_28000.paid_at, day) AS booking__paid_at__day + , DATETIME_TRUNC(bookings_source_src_28000.paid_at, isoweek) AS booking__paid_at__week + , DATETIME_TRUNC(bookings_source_src_28000.paid_at, month) AS booking__paid_at__month + , DATETIME_TRUNC(bookings_source_src_28000.paid_at, quarter) AS booking__paid_at__quarter + , DATETIME_TRUNC(bookings_source_src_28000.paid_at, year) AS booking__paid_at__year , EXTRACT(year FROM bookings_source_src_28000.paid_at) AS booking__paid_at__extract_year , EXTRACT(quarter FROM bookings_source_src_28000.paid_at) AS booking__paid_at__extract_quarter , EXTRACT(month FROM bookings_source_src_28000.paid_at) AS booking__paid_at__extract_month diff --git a/tests_metricflow/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/BigQuery/test_nested_fill_nulls_without_time_spine__plan0_optimized.sql b/tests_metricflow/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/BigQuery/test_nested_fill_nulls_without_time_spine__plan0_optimized.sql index bd10c58399..66bbcd2a36 100644 --- a/tests_metricflow/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/BigQuery/test_nested_fill_nulls_without_time_spine__plan0_optimized.sql +++ b/tests_metricflow/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/BigQuery/test_nested_fill_nulls_without_time_spine__plan0_optimized.sql @@ -22,7 +22,7 @@ FROM ( -- Metric Time Dimension 'ds' -- Pass Only Elements: ['bookings', 'metric_time__day'] SELECT - DATE_TRUNC(ds, day) AS metric_time__day + DATETIME_TRUNC(ds, day) AS metric_time__day , 1 AS bookings FROM ***************************.fct_bookings bookings_source_src_28000 ) subq_8 diff --git a/tests_metricflow/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/BigQuery/test_nested_fill_nulls_without_time_spine_multi_metric__plan0.sql b/tests_metricflow/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/BigQuery/test_nested_fill_nulls_without_time_spine_multi_metric__plan0.sql index 6507a9d15b..c652dd8054 100644 --- a/tests_metricflow/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/BigQuery/test_nested_fill_nulls_without_time_spine_multi_metric__plan0.sql +++ b/tests_metricflow/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/BigQuery/test_nested_fill_nulls_without_time_spine_multi_metric__plan0.sql @@ -147,33 +147,33 @@ FROM ( , bookings_source_src_28000.booking_value AS approximate_continuous_booking_value_p99 , bookings_source_src_28000.booking_value AS approximate_discrete_booking_value_p99 , bookings_source_src_28000.is_instant - , DATE_TRUNC(bookings_source_src_28000.ds, day) AS ds__day - , DATE_TRUNC(bookings_source_src_28000.ds, isoweek) AS ds__week - , DATE_TRUNC(bookings_source_src_28000.ds, month) AS ds__month - , DATE_TRUNC(bookings_source_src_28000.ds, quarter) AS ds__quarter - , DATE_TRUNC(bookings_source_src_28000.ds, year) AS ds__year + , DATETIME_TRUNC(bookings_source_src_28000.ds, day) AS ds__day + , DATETIME_TRUNC(bookings_source_src_28000.ds, isoweek) AS ds__week + , DATETIME_TRUNC(bookings_source_src_28000.ds, month) AS ds__month + , DATETIME_TRUNC(bookings_source_src_28000.ds, quarter) AS ds__quarter + , DATETIME_TRUNC(bookings_source_src_28000.ds, year) AS ds__year , EXTRACT(year FROM bookings_source_src_28000.ds) AS ds__extract_year , EXTRACT(quarter FROM bookings_source_src_28000.ds) AS ds__extract_quarter , EXTRACT(month FROM bookings_source_src_28000.ds) AS ds__extract_month , EXTRACT(day FROM bookings_source_src_28000.ds) AS ds__extract_day , IF(EXTRACT(dayofweek FROM bookings_source_src_28000.ds) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_28000.ds) - 1) AS ds__extract_dow , EXTRACT(dayofyear FROM bookings_source_src_28000.ds) AS ds__extract_doy - , DATE_TRUNC(bookings_source_src_28000.ds_partitioned, day) AS ds_partitioned__day - , DATE_TRUNC(bookings_source_src_28000.ds_partitioned, isoweek) AS ds_partitioned__week - , DATE_TRUNC(bookings_source_src_28000.ds_partitioned, month) AS ds_partitioned__month - , DATE_TRUNC(bookings_source_src_28000.ds_partitioned, quarter) AS ds_partitioned__quarter - , DATE_TRUNC(bookings_source_src_28000.ds_partitioned, year) AS ds_partitioned__year + , DATETIME_TRUNC(bookings_source_src_28000.ds_partitioned, day) AS ds_partitioned__day + , DATETIME_TRUNC(bookings_source_src_28000.ds_partitioned, isoweek) AS ds_partitioned__week + , DATETIME_TRUNC(bookings_source_src_28000.ds_partitioned, month) AS ds_partitioned__month + , DATETIME_TRUNC(bookings_source_src_28000.ds_partitioned, quarter) AS ds_partitioned__quarter + , DATETIME_TRUNC(bookings_source_src_28000.ds_partitioned, year) AS ds_partitioned__year , EXTRACT(year FROM bookings_source_src_28000.ds_partitioned) AS ds_partitioned__extract_year , EXTRACT(quarter FROM bookings_source_src_28000.ds_partitioned) AS ds_partitioned__extract_quarter , EXTRACT(month FROM bookings_source_src_28000.ds_partitioned) AS ds_partitioned__extract_month , EXTRACT(day FROM bookings_source_src_28000.ds_partitioned) AS ds_partitioned__extract_day , IF(EXTRACT(dayofweek FROM bookings_source_src_28000.ds_partitioned) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_28000.ds_partitioned) - 1) AS ds_partitioned__extract_dow , EXTRACT(dayofyear FROM bookings_source_src_28000.ds_partitioned) AS ds_partitioned__extract_doy - , DATE_TRUNC(bookings_source_src_28000.paid_at, day) AS paid_at__day - , DATE_TRUNC(bookings_source_src_28000.paid_at, isoweek) AS paid_at__week - , DATE_TRUNC(bookings_source_src_28000.paid_at, month) AS paid_at__month - , DATE_TRUNC(bookings_source_src_28000.paid_at, quarter) AS paid_at__quarter - , DATE_TRUNC(bookings_source_src_28000.paid_at, year) AS paid_at__year + , DATETIME_TRUNC(bookings_source_src_28000.paid_at, day) AS paid_at__day + , DATETIME_TRUNC(bookings_source_src_28000.paid_at, isoweek) AS paid_at__week + , DATETIME_TRUNC(bookings_source_src_28000.paid_at, month) AS paid_at__month + , DATETIME_TRUNC(bookings_source_src_28000.paid_at, quarter) AS paid_at__quarter + , DATETIME_TRUNC(bookings_source_src_28000.paid_at, year) AS paid_at__year , EXTRACT(year FROM bookings_source_src_28000.paid_at) AS paid_at__extract_year , EXTRACT(quarter FROM bookings_source_src_28000.paid_at) AS paid_at__extract_quarter , EXTRACT(month FROM bookings_source_src_28000.paid_at) AS paid_at__extract_month @@ -181,33 +181,33 @@ FROM ( , IF(EXTRACT(dayofweek FROM bookings_source_src_28000.paid_at) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_28000.paid_at) - 1) AS paid_at__extract_dow , EXTRACT(dayofyear FROM bookings_source_src_28000.paid_at) AS paid_at__extract_doy , bookings_source_src_28000.is_instant AS booking__is_instant - , DATE_TRUNC(bookings_source_src_28000.ds, day) AS booking__ds__day - , DATE_TRUNC(bookings_source_src_28000.ds, isoweek) AS booking__ds__week - , DATE_TRUNC(bookings_source_src_28000.ds, month) AS booking__ds__month - , DATE_TRUNC(bookings_source_src_28000.ds, quarter) AS booking__ds__quarter - , DATE_TRUNC(bookings_source_src_28000.ds, year) AS booking__ds__year + , DATETIME_TRUNC(bookings_source_src_28000.ds, day) AS booking__ds__day + , DATETIME_TRUNC(bookings_source_src_28000.ds, isoweek) AS booking__ds__week + , DATETIME_TRUNC(bookings_source_src_28000.ds, month) AS booking__ds__month + , DATETIME_TRUNC(bookings_source_src_28000.ds, quarter) AS booking__ds__quarter + , DATETIME_TRUNC(bookings_source_src_28000.ds, year) AS booking__ds__year , EXTRACT(year FROM bookings_source_src_28000.ds) AS booking__ds__extract_year , EXTRACT(quarter FROM bookings_source_src_28000.ds) AS booking__ds__extract_quarter , EXTRACT(month FROM bookings_source_src_28000.ds) AS booking__ds__extract_month , EXTRACT(day FROM bookings_source_src_28000.ds) AS booking__ds__extract_day , IF(EXTRACT(dayofweek FROM bookings_source_src_28000.ds) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_28000.ds) - 1) AS booking__ds__extract_dow , EXTRACT(dayofyear FROM bookings_source_src_28000.ds) AS booking__ds__extract_doy - , DATE_TRUNC(bookings_source_src_28000.ds_partitioned, day) AS booking__ds_partitioned__day - , DATE_TRUNC(bookings_source_src_28000.ds_partitioned, isoweek) AS booking__ds_partitioned__week - , DATE_TRUNC(bookings_source_src_28000.ds_partitioned, month) AS booking__ds_partitioned__month - , DATE_TRUNC(bookings_source_src_28000.ds_partitioned, quarter) AS booking__ds_partitioned__quarter - , DATE_TRUNC(bookings_source_src_28000.ds_partitioned, year) AS booking__ds_partitioned__year + , DATETIME_TRUNC(bookings_source_src_28000.ds_partitioned, day) AS booking__ds_partitioned__day + , DATETIME_TRUNC(bookings_source_src_28000.ds_partitioned, isoweek) AS booking__ds_partitioned__week + , DATETIME_TRUNC(bookings_source_src_28000.ds_partitioned, month) AS booking__ds_partitioned__month + , DATETIME_TRUNC(bookings_source_src_28000.ds_partitioned, quarter) AS booking__ds_partitioned__quarter + , DATETIME_TRUNC(bookings_source_src_28000.ds_partitioned, year) AS booking__ds_partitioned__year , EXTRACT(year FROM bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__extract_year , EXTRACT(quarter FROM bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__extract_quarter , EXTRACT(month FROM bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__extract_month , EXTRACT(day FROM bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__extract_day , IF(EXTRACT(dayofweek FROM bookings_source_src_28000.ds_partitioned) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_28000.ds_partitioned) - 1) AS booking__ds_partitioned__extract_dow , EXTRACT(dayofyear FROM bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__extract_doy - , DATE_TRUNC(bookings_source_src_28000.paid_at, day) AS booking__paid_at__day - , DATE_TRUNC(bookings_source_src_28000.paid_at, isoweek) AS booking__paid_at__week - , DATE_TRUNC(bookings_source_src_28000.paid_at, month) AS booking__paid_at__month - , DATE_TRUNC(bookings_source_src_28000.paid_at, quarter) AS booking__paid_at__quarter - , DATE_TRUNC(bookings_source_src_28000.paid_at, year) AS booking__paid_at__year + , DATETIME_TRUNC(bookings_source_src_28000.paid_at, day) AS booking__paid_at__day + , DATETIME_TRUNC(bookings_source_src_28000.paid_at, isoweek) AS booking__paid_at__week + , DATETIME_TRUNC(bookings_source_src_28000.paid_at, month) AS booking__paid_at__month + , DATETIME_TRUNC(bookings_source_src_28000.paid_at, quarter) AS booking__paid_at__quarter + , DATETIME_TRUNC(bookings_source_src_28000.paid_at, year) AS booking__paid_at__year , EXTRACT(year FROM bookings_source_src_28000.paid_at) AS booking__paid_at__extract_year , EXTRACT(quarter FROM bookings_source_src_28000.paid_at) AS booking__paid_at__extract_quarter , EXTRACT(month FROM bookings_source_src_28000.paid_at) AS booking__paid_at__extract_month @@ -321,22 +321,22 @@ FULL OUTER JOIN ( 1 AS listings , listings_latest_src_28000.capacity AS largest_listing , listings_latest_src_28000.capacity AS smallest_listing - , DATE_TRUNC(listings_latest_src_28000.created_at, day) AS ds__day - , DATE_TRUNC(listings_latest_src_28000.created_at, isoweek) AS ds__week - , DATE_TRUNC(listings_latest_src_28000.created_at, month) AS ds__month - , DATE_TRUNC(listings_latest_src_28000.created_at, quarter) AS ds__quarter - , DATE_TRUNC(listings_latest_src_28000.created_at, year) AS ds__year + , DATETIME_TRUNC(listings_latest_src_28000.created_at, day) AS ds__day + , DATETIME_TRUNC(listings_latest_src_28000.created_at, isoweek) AS ds__week + , DATETIME_TRUNC(listings_latest_src_28000.created_at, month) AS ds__month + , DATETIME_TRUNC(listings_latest_src_28000.created_at, quarter) AS ds__quarter + , DATETIME_TRUNC(listings_latest_src_28000.created_at, year) AS ds__year , EXTRACT(year FROM listings_latest_src_28000.created_at) AS ds__extract_year , EXTRACT(quarter FROM listings_latest_src_28000.created_at) AS ds__extract_quarter , EXTRACT(month FROM listings_latest_src_28000.created_at) AS ds__extract_month , EXTRACT(day FROM listings_latest_src_28000.created_at) AS ds__extract_day , IF(EXTRACT(dayofweek FROM listings_latest_src_28000.created_at) = 1, 7, EXTRACT(dayofweek FROM listings_latest_src_28000.created_at) - 1) AS ds__extract_dow , EXTRACT(dayofyear FROM listings_latest_src_28000.created_at) AS ds__extract_doy - , DATE_TRUNC(listings_latest_src_28000.created_at, day) AS created_at__day - , DATE_TRUNC(listings_latest_src_28000.created_at, isoweek) AS created_at__week - , DATE_TRUNC(listings_latest_src_28000.created_at, month) AS created_at__month - , DATE_TRUNC(listings_latest_src_28000.created_at, quarter) AS created_at__quarter - , DATE_TRUNC(listings_latest_src_28000.created_at, year) AS created_at__year + , DATETIME_TRUNC(listings_latest_src_28000.created_at, day) AS created_at__day + , DATETIME_TRUNC(listings_latest_src_28000.created_at, isoweek) AS created_at__week + , DATETIME_TRUNC(listings_latest_src_28000.created_at, month) AS created_at__month + , DATETIME_TRUNC(listings_latest_src_28000.created_at, quarter) AS created_at__quarter + , DATETIME_TRUNC(listings_latest_src_28000.created_at, year) AS created_at__year , EXTRACT(year FROM listings_latest_src_28000.created_at) AS created_at__extract_year , EXTRACT(quarter FROM listings_latest_src_28000.created_at) AS created_at__extract_quarter , EXTRACT(month FROM listings_latest_src_28000.created_at) AS created_at__extract_month @@ -346,22 +346,22 @@ FULL OUTER JOIN ( , listings_latest_src_28000.country AS country_latest , listings_latest_src_28000.is_lux AS is_lux_latest , listings_latest_src_28000.capacity AS capacity_latest - , DATE_TRUNC(listings_latest_src_28000.created_at, day) AS listing__ds__day - , DATE_TRUNC(listings_latest_src_28000.created_at, isoweek) AS listing__ds__week - , DATE_TRUNC(listings_latest_src_28000.created_at, month) AS listing__ds__month - , DATE_TRUNC(listings_latest_src_28000.created_at, quarter) AS listing__ds__quarter - , DATE_TRUNC(listings_latest_src_28000.created_at, year) AS listing__ds__year + , DATETIME_TRUNC(listings_latest_src_28000.created_at, day) AS listing__ds__day + , DATETIME_TRUNC(listings_latest_src_28000.created_at, isoweek) AS listing__ds__week + , DATETIME_TRUNC(listings_latest_src_28000.created_at, month) AS listing__ds__month + , DATETIME_TRUNC(listings_latest_src_28000.created_at, quarter) AS listing__ds__quarter + , DATETIME_TRUNC(listings_latest_src_28000.created_at, year) AS listing__ds__year , EXTRACT(year FROM listings_latest_src_28000.created_at) AS listing__ds__extract_year , EXTRACT(quarter FROM listings_latest_src_28000.created_at) AS listing__ds__extract_quarter , EXTRACT(month FROM listings_latest_src_28000.created_at) AS listing__ds__extract_month , EXTRACT(day FROM listings_latest_src_28000.created_at) AS listing__ds__extract_day , IF(EXTRACT(dayofweek FROM listings_latest_src_28000.created_at) = 1, 7, EXTRACT(dayofweek FROM listings_latest_src_28000.created_at) - 1) AS listing__ds__extract_dow , EXTRACT(dayofyear FROM listings_latest_src_28000.created_at) AS listing__ds__extract_doy - , DATE_TRUNC(listings_latest_src_28000.created_at, day) AS listing__created_at__day - , DATE_TRUNC(listings_latest_src_28000.created_at, isoweek) AS listing__created_at__week - , DATE_TRUNC(listings_latest_src_28000.created_at, month) AS listing__created_at__month - , DATE_TRUNC(listings_latest_src_28000.created_at, quarter) AS listing__created_at__quarter - , DATE_TRUNC(listings_latest_src_28000.created_at, year) AS listing__created_at__year + , DATETIME_TRUNC(listings_latest_src_28000.created_at, day) AS listing__created_at__day + , DATETIME_TRUNC(listings_latest_src_28000.created_at, isoweek) AS listing__created_at__week + , DATETIME_TRUNC(listings_latest_src_28000.created_at, month) AS listing__created_at__month + , DATETIME_TRUNC(listings_latest_src_28000.created_at, quarter) AS listing__created_at__quarter + , DATETIME_TRUNC(listings_latest_src_28000.created_at, year) AS listing__created_at__year , EXTRACT(year FROM listings_latest_src_28000.created_at) AS listing__created_at__extract_year , EXTRACT(quarter FROM listings_latest_src_28000.created_at) AS listing__created_at__extract_quarter , EXTRACT(month FROM listings_latest_src_28000.created_at) AS listing__created_at__extract_month diff --git a/tests_metricflow/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/BigQuery/test_nested_fill_nulls_without_time_spine_multi_metric__plan0_optimized.sql b/tests_metricflow/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/BigQuery/test_nested_fill_nulls_without_time_spine_multi_metric__plan0_optimized.sql index 74b4752459..29c9e8f1a6 100644 --- a/tests_metricflow/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/BigQuery/test_nested_fill_nulls_without_time_spine_multi_metric__plan0_optimized.sql +++ b/tests_metricflow/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/BigQuery/test_nested_fill_nulls_without_time_spine_multi_metric__plan0_optimized.sql @@ -28,7 +28,7 @@ FROM ( -- Metric Time Dimension 'ds' -- Pass Only Elements: ['bookings', 'metric_time__day'] SELECT - DATE_TRUNC(ds, day) AS metric_time__day + DATETIME_TRUNC(ds, day) AS metric_time__day , 1 AS bookings FROM ***************************.fct_bookings bookings_source_src_28000 ) subq_14 @@ -49,7 +49,7 @@ FULL OUTER JOIN ( -- Metric Time Dimension 'ds' -- Pass Only Elements: ['listings', 'metric_time__day'] SELECT - DATE_TRUNC(created_at, day) AS metric_time__day + DATETIME_TRUNC(created_at, day) AS metric_time__day , 1 AS listings FROM ***************************.dim_listings_latest listings_latest_src_28000 ) subq_21 diff --git a/tests_metricflow/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/BigQuery/test_nested_filters__plan0.sql b/tests_metricflow/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/BigQuery/test_nested_filters__plan0.sql index 7645de589c..510d1145cd 100644 --- a/tests_metricflow/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/BigQuery/test_nested_filters__plan0.sql +++ b/tests_metricflow/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/BigQuery/test_nested_filters__plan0.sql @@ -167,33 +167,33 @@ FROM ( , bookings_source_src_28000.booking_value AS approximate_continuous_booking_value_p99 , bookings_source_src_28000.booking_value AS approximate_discrete_booking_value_p99 , bookings_source_src_28000.is_instant - , DATE_TRUNC(bookings_source_src_28000.ds, day) AS ds__day - , DATE_TRUNC(bookings_source_src_28000.ds, isoweek) AS ds__week - , DATE_TRUNC(bookings_source_src_28000.ds, month) AS ds__month - , DATE_TRUNC(bookings_source_src_28000.ds, quarter) AS ds__quarter - , DATE_TRUNC(bookings_source_src_28000.ds, year) AS ds__year + , DATETIME_TRUNC(bookings_source_src_28000.ds, day) AS ds__day + , DATETIME_TRUNC(bookings_source_src_28000.ds, isoweek) AS ds__week + , DATETIME_TRUNC(bookings_source_src_28000.ds, month) AS ds__month + , DATETIME_TRUNC(bookings_source_src_28000.ds, quarter) AS ds__quarter + , DATETIME_TRUNC(bookings_source_src_28000.ds, year) AS ds__year , EXTRACT(year FROM bookings_source_src_28000.ds) AS ds__extract_year , EXTRACT(quarter FROM bookings_source_src_28000.ds) AS ds__extract_quarter , EXTRACT(month FROM bookings_source_src_28000.ds) AS ds__extract_month , EXTRACT(day FROM bookings_source_src_28000.ds) AS ds__extract_day , IF(EXTRACT(dayofweek FROM bookings_source_src_28000.ds) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_28000.ds) - 1) AS ds__extract_dow , EXTRACT(dayofyear FROM bookings_source_src_28000.ds) AS ds__extract_doy - , DATE_TRUNC(bookings_source_src_28000.ds_partitioned, day) AS ds_partitioned__day - , DATE_TRUNC(bookings_source_src_28000.ds_partitioned, isoweek) AS ds_partitioned__week - , DATE_TRUNC(bookings_source_src_28000.ds_partitioned, month) AS ds_partitioned__month - , DATE_TRUNC(bookings_source_src_28000.ds_partitioned, quarter) AS ds_partitioned__quarter - , DATE_TRUNC(bookings_source_src_28000.ds_partitioned, year) AS ds_partitioned__year + , DATETIME_TRUNC(bookings_source_src_28000.ds_partitioned, day) AS ds_partitioned__day + , DATETIME_TRUNC(bookings_source_src_28000.ds_partitioned, isoweek) AS ds_partitioned__week + , DATETIME_TRUNC(bookings_source_src_28000.ds_partitioned, month) AS ds_partitioned__month + , DATETIME_TRUNC(bookings_source_src_28000.ds_partitioned, quarter) AS ds_partitioned__quarter + , DATETIME_TRUNC(bookings_source_src_28000.ds_partitioned, year) AS ds_partitioned__year , EXTRACT(year FROM bookings_source_src_28000.ds_partitioned) AS ds_partitioned__extract_year , EXTRACT(quarter FROM bookings_source_src_28000.ds_partitioned) AS ds_partitioned__extract_quarter , EXTRACT(month FROM bookings_source_src_28000.ds_partitioned) AS ds_partitioned__extract_month , EXTRACT(day FROM bookings_source_src_28000.ds_partitioned) AS ds_partitioned__extract_day , IF(EXTRACT(dayofweek FROM bookings_source_src_28000.ds_partitioned) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_28000.ds_partitioned) - 1) AS ds_partitioned__extract_dow , EXTRACT(dayofyear FROM bookings_source_src_28000.ds_partitioned) AS ds_partitioned__extract_doy - , DATE_TRUNC(bookings_source_src_28000.paid_at, day) AS paid_at__day - , DATE_TRUNC(bookings_source_src_28000.paid_at, isoweek) AS paid_at__week - , DATE_TRUNC(bookings_source_src_28000.paid_at, month) AS paid_at__month - , DATE_TRUNC(bookings_source_src_28000.paid_at, quarter) AS paid_at__quarter - , DATE_TRUNC(bookings_source_src_28000.paid_at, year) AS paid_at__year + , DATETIME_TRUNC(bookings_source_src_28000.paid_at, day) AS paid_at__day + , DATETIME_TRUNC(bookings_source_src_28000.paid_at, isoweek) AS paid_at__week + , DATETIME_TRUNC(bookings_source_src_28000.paid_at, month) AS paid_at__month + , DATETIME_TRUNC(bookings_source_src_28000.paid_at, quarter) AS paid_at__quarter + , DATETIME_TRUNC(bookings_source_src_28000.paid_at, year) AS paid_at__year , EXTRACT(year FROM bookings_source_src_28000.paid_at) AS paid_at__extract_year , EXTRACT(quarter FROM bookings_source_src_28000.paid_at) AS paid_at__extract_quarter , EXTRACT(month FROM bookings_source_src_28000.paid_at) AS paid_at__extract_month @@ -201,33 +201,33 @@ FROM ( , IF(EXTRACT(dayofweek FROM bookings_source_src_28000.paid_at) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_28000.paid_at) - 1) AS paid_at__extract_dow , EXTRACT(dayofyear FROM bookings_source_src_28000.paid_at) AS paid_at__extract_doy , bookings_source_src_28000.is_instant AS booking__is_instant - , DATE_TRUNC(bookings_source_src_28000.ds, day) AS booking__ds__day - , DATE_TRUNC(bookings_source_src_28000.ds, isoweek) AS booking__ds__week - , DATE_TRUNC(bookings_source_src_28000.ds, month) AS booking__ds__month - , DATE_TRUNC(bookings_source_src_28000.ds, quarter) AS booking__ds__quarter - , DATE_TRUNC(bookings_source_src_28000.ds, year) AS booking__ds__year + , DATETIME_TRUNC(bookings_source_src_28000.ds, day) AS booking__ds__day + , DATETIME_TRUNC(bookings_source_src_28000.ds, isoweek) AS booking__ds__week + , DATETIME_TRUNC(bookings_source_src_28000.ds, month) AS booking__ds__month + , DATETIME_TRUNC(bookings_source_src_28000.ds, quarter) AS booking__ds__quarter + , DATETIME_TRUNC(bookings_source_src_28000.ds, year) AS booking__ds__year , EXTRACT(year FROM bookings_source_src_28000.ds) AS booking__ds__extract_year , EXTRACT(quarter FROM bookings_source_src_28000.ds) AS booking__ds__extract_quarter , EXTRACT(month FROM bookings_source_src_28000.ds) AS booking__ds__extract_month , EXTRACT(day FROM bookings_source_src_28000.ds) AS booking__ds__extract_day , IF(EXTRACT(dayofweek FROM bookings_source_src_28000.ds) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_28000.ds) - 1) AS booking__ds__extract_dow , EXTRACT(dayofyear FROM bookings_source_src_28000.ds) AS booking__ds__extract_doy - , DATE_TRUNC(bookings_source_src_28000.ds_partitioned, day) AS booking__ds_partitioned__day - , DATE_TRUNC(bookings_source_src_28000.ds_partitioned, isoweek) AS booking__ds_partitioned__week - , DATE_TRUNC(bookings_source_src_28000.ds_partitioned, month) AS booking__ds_partitioned__month - , DATE_TRUNC(bookings_source_src_28000.ds_partitioned, quarter) AS booking__ds_partitioned__quarter - , DATE_TRUNC(bookings_source_src_28000.ds_partitioned, year) AS booking__ds_partitioned__year + , DATETIME_TRUNC(bookings_source_src_28000.ds_partitioned, day) AS booking__ds_partitioned__day + , DATETIME_TRUNC(bookings_source_src_28000.ds_partitioned, isoweek) AS booking__ds_partitioned__week + , DATETIME_TRUNC(bookings_source_src_28000.ds_partitioned, month) AS booking__ds_partitioned__month + , DATETIME_TRUNC(bookings_source_src_28000.ds_partitioned, quarter) AS booking__ds_partitioned__quarter + , DATETIME_TRUNC(bookings_source_src_28000.ds_partitioned, year) AS booking__ds_partitioned__year , EXTRACT(year FROM bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__extract_year , EXTRACT(quarter FROM bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__extract_quarter , EXTRACT(month FROM bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__extract_month , EXTRACT(day FROM bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__extract_day , IF(EXTRACT(dayofweek FROM bookings_source_src_28000.ds_partitioned) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_28000.ds_partitioned) - 1) AS booking__ds_partitioned__extract_dow , EXTRACT(dayofyear FROM bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__extract_doy - , DATE_TRUNC(bookings_source_src_28000.paid_at, day) AS booking__paid_at__day - , DATE_TRUNC(bookings_source_src_28000.paid_at, isoweek) AS booking__paid_at__week - , DATE_TRUNC(bookings_source_src_28000.paid_at, month) AS booking__paid_at__month - , DATE_TRUNC(bookings_source_src_28000.paid_at, quarter) AS booking__paid_at__quarter - , DATE_TRUNC(bookings_source_src_28000.paid_at, year) AS booking__paid_at__year + , DATETIME_TRUNC(bookings_source_src_28000.paid_at, day) AS booking__paid_at__day + , DATETIME_TRUNC(bookings_source_src_28000.paid_at, isoweek) AS booking__paid_at__week + , DATETIME_TRUNC(bookings_source_src_28000.paid_at, month) AS booking__paid_at__month + , DATETIME_TRUNC(bookings_source_src_28000.paid_at, quarter) AS booking__paid_at__quarter + , DATETIME_TRUNC(bookings_source_src_28000.paid_at, year) AS booking__paid_at__year , EXTRACT(year FROM bookings_source_src_28000.paid_at) AS booking__paid_at__extract_year , EXTRACT(quarter FROM bookings_source_src_28000.paid_at) AS booking__paid_at__extract_quarter , EXTRACT(month FROM bookings_source_src_28000.paid_at) AS booking__paid_at__extract_month @@ -325,22 +325,22 @@ FROM ( 1 AS listings , listings_latest_src_28000.capacity AS largest_listing , listings_latest_src_28000.capacity AS smallest_listing - , DATE_TRUNC(listings_latest_src_28000.created_at, day) AS ds__day - , DATE_TRUNC(listings_latest_src_28000.created_at, isoweek) AS ds__week - , DATE_TRUNC(listings_latest_src_28000.created_at, month) AS ds__month - , DATE_TRUNC(listings_latest_src_28000.created_at, quarter) AS ds__quarter - , DATE_TRUNC(listings_latest_src_28000.created_at, year) AS ds__year + , DATETIME_TRUNC(listings_latest_src_28000.created_at, day) AS ds__day + , DATETIME_TRUNC(listings_latest_src_28000.created_at, isoweek) AS ds__week + , DATETIME_TRUNC(listings_latest_src_28000.created_at, month) AS ds__month + , DATETIME_TRUNC(listings_latest_src_28000.created_at, quarter) AS ds__quarter + , DATETIME_TRUNC(listings_latest_src_28000.created_at, year) AS ds__year , EXTRACT(year FROM listings_latest_src_28000.created_at) AS ds__extract_year , EXTRACT(quarter FROM listings_latest_src_28000.created_at) AS ds__extract_quarter , EXTRACT(month FROM listings_latest_src_28000.created_at) AS ds__extract_month , EXTRACT(day FROM listings_latest_src_28000.created_at) AS ds__extract_day , IF(EXTRACT(dayofweek FROM listings_latest_src_28000.created_at) = 1, 7, EXTRACT(dayofweek FROM listings_latest_src_28000.created_at) - 1) AS ds__extract_dow , EXTRACT(dayofyear FROM listings_latest_src_28000.created_at) AS ds__extract_doy - , DATE_TRUNC(listings_latest_src_28000.created_at, day) AS created_at__day - , DATE_TRUNC(listings_latest_src_28000.created_at, isoweek) AS created_at__week - , DATE_TRUNC(listings_latest_src_28000.created_at, month) AS created_at__month - , DATE_TRUNC(listings_latest_src_28000.created_at, quarter) AS created_at__quarter - , DATE_TRUNC(listings_latest_src_28000.created_at, year) AS created_at__year + , DATETIME_TRUNC(listings_latest_src_28000.created_at, day) AS created_at__day + , DATETIME_TRUNC(listings_latest_src_28000.created_at, isoweek) AS created_at__week + , DATETIME_TRUNC(listings_latest_src_28000.created_at, month) AS created_at__month + , DATETIME_TRUNC(listings_latest_src_28000.created_at, quarter) AS created_at__quarter + , DATETIME_TRUNC(listings_latest_src_28000.created_at, year) AS created_at__year , EXTRACT(year FROM listings_latest_src_28000.created_at) AS created_at__extract_year , EXTRACT(quarter FROM listings_latest_src_28000.created_at) AS created_at__extract_quarter , EXTRACT(month FROM listings_latest_src_28000.created_at) AS created_at__extract_month @@ -350,22 +350,22 @@ FROM ( , listings_latest_src_28000.country AS country_latest , listings_latest_src_28000.is_lux AS is_lux_latest , listings_latest_src_28000.capacity AS capacity_latest - , DATE_TRUNC(listings_latest_src_28000.created_at, day) AS listing__ds__day - , DATE_TRUNC(listings_latest_src_28000.created_at, isoweek) AS listing__ds__week - , DATE_TRUNC(listings_latest_src_28000.created_at, month) AS listing__ds__month - , DATE_TRUNC(listings_latest_src_28000.created_at, quarter) AS listing__ds__quarter - , DATE_TRUNC(listings_latest_src_28000.created_at, year) AS listing__ds__year + , DATETIME_TRUNC(listings_latest_src_28000.created_at, day) AS listing__ds__day + , DATETIME_TRUNC(listings_latest_src_28000.created_at, isoweek) AS listing__ds__week + , DATETIME_TRUNC(listings_latest_src_28000.created_at, month) AS listing__ds__month + , DATETIME_TRUNC(listings_latest_src_28000.created_at, quarter) AS listing__ds__quarter + , DATETIME_TRUNC(listings_latest_src_28000.created_at, year) AS listing__ds__year , EXTRACT(year FROM listings_latest_src_28000.created_at) AS listing__ds__extract_year , EXTRACT(quarter FROM listings_latest_src_28000.created_at) AS listing__ds__extract_quarter , EXTRACT(month FROM listings_latest_src_28000.created_at) AS listing__ds__extract_month , EXTRACT(day FROM listings_latest_src_28000.created_at) AS listing__ds__extract_day , IF(EXTRACT(dayofweek FROM listings_latest_src_28000.created_at) = 1, 7, EXTRACT(dayofweek FROM listings_latest_src_28000.created_at) - 1) AS listing__ds__extract_dow , EXTRACT(dayofyear FROM listings_latest_src_28000.created_at) AS listing__ds__extract_doy - , DATE_TRUNC(listings_latest_src_28000.created_at, day) AS listing__created_at__day - , DATE_TRUNC(listings_latest_src_28000.created_at, isoweek) AS listing__created_at__week - , DATE_TRUNC(listings_latest_src_28000.created_at, month) AS listing__created_at__month - , DATE_TRUNC(listings_latest_src_28000.created_at, quarter) AS listing__created_at__quarter - , DATE_TRUNC(listings_latest_src_28000.created_at, year) AS listing__created_at__year + , DATETIME_TRUNC(listings_latest_src_28000.created_at, day) AS listing__created_at__day + , DATETIME_TRUNC(listings_latest_src_28000.created_at, isoweek) AS listing__created_at__week + , DATETIME_TRUNC(listings_latest_src_28000.created_at, month) AS listing__created_at__month + , DATETIME_TRUNC(listings_latest_src_28000.created_at, quarter) AS listing__created_at__quarter + , DATETIME_TRUNC(listings_latest_src_28000.created_at, year) AS listing__created_at__year , EXTRACT(year FROM listings_latest_src_28000.created_at) AS listing__created_at__extract_year , EXTRACT(quarter FROM listings_latest_src_28000.created_at) AS listing__created_at__extract_quarter , EXTRACT(month FROM listings_latest_src_28000.created_at) AS listing__created_at__extract_month @@ -547,33 +547,33 @@ FROM ( , bookings_source_src_28000.booking_value AS approximate_continuous_booking_value_p99 , bookings_source_src_28000.booking_value AS approximate_discrete_booking_value_p99 , bookings_source_src_28000.is_instant - , DATE_TRUNC(bookings_source_src_28000.ds, day) AS ds__day - , DATE_TRUNC(bookings_source_src_28000.ds, isoweek) AS ds__week - , DATE_TRUNC(bookings_source_src_28000.ds, month) AS ds__month - , DATE_TRUNC(bookings_source_src_28000.ds, quarter) AS ds__quarter - , DATE_TRUNC(bookings_source_src_28000.ds, year) AS ds__year + , DATETIME_TRUNC(bookings_source_src_28000.ds, day) AS ds__day + , DATETIME_TRUNC(bookings_source_src_28000.ds, isoweek) AS ds__week + , DATETIME_TRUNC(bookings_source_src_28000.ds, month) AS ds__month + , DATETIME_TRUNC(bookings_source_src_28000.ds, quarter) AS ds__quarter + , DATETIME_TRUNC(bookings_source_src_28000.ds, year) AS ds__year , EXTRACT(year FROM bookings_source_src_28000.ds) AS ds__extract_year , EXTRACT(quarter FROM bookings_source_src_28000.ds) AS ds__extract_quarter , EXTRACT(month FROM bookings_source_src_28000.ds) AS ds__extract_month , EXTRACT(day FROM bookings_source_src_28000.ds) AS ds__extract_day , IF(EXTRACT(dayofweek FROM bookings_source_src_28000.ds) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_28000.ds) - 1) AS ds__extract_dow , EXTRACT(dayofyear FROM bookings_source_src_28000.ds) AS ds__extract_doy - , DATE_TRUNC(bookings_source_src_28000.ds_partitioned, day) AS ds_partitioned__day - , DATE_TRUNC(bookings_source_src_28000.ds_partitioned, isoweek) AS ds_partitioned__week - , DATE_TRUNC(bookings_source_src_28000.ds_partitioned, month) AS ds_partitioned__month - , DATE_TRUNC(bookings_source_src_28000.ds_partitioned, quarter) AS ds_partitioned__quarter - , DATE_TRUNC(bookings_source_src_28000.ds_partitioned, year) AS ds_partitioned__year + , DATETIME_TRUNC(bookings_source_src_28000.ds_partitioned, day) AS ds_partitioned__day + , DATETIME_TRUNC(bookings_source_src_28000.ds_partitioned, isoweek) AS ds_partitioned__week + , DATETIME_TRUNC(bookings_source_src_28000.ds_partitioned, month) AS ds_partitioned__month + , DATETIME_TRUNC(bookings_source_src_28000.ds_partitioned, quarter) AS ds_partitioned__quarter + , DATETIME_TRUNC(bookings_source_src_28000.ds_partitioned, year) AS ds_partitioned__year , EXTRACT(year FROM bookings_source_src_28000.ds_partitioned) AS ds_partitioned__extract_year , EXTRACT(quarter FROM bookings_source_src_28000.ds_partitioned) AS ds_partitioned__extract_quarter , EXTRACT(month FROM bookings_source_src_28000.ds_partitioned) AS ds_partitioned__extract_month , EXTRACT(day FROM bookings_source_src_28000.ds_partitioned) AS ds_partitioned__extract_day , IF(EXTRACT(dayofweek FROM bookings_source_src_28000.ds_partitioned) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_28000.ds_partitioned) - 1) AS ds_partitioned__extract_dow , EXTRACT(dayofyear FROM bookings_source_src_28000.ds_partitioned) AS ds_partitioned__extract_doy - , DATE_TRUNC(bookings_source_src_28000.paid_at, day) AS paid_at__day - , DATE_TRUNC(bookings_source_src_28000.paid_at, isoweek) AS paid_at__week - , DATE_TRUNC(bookings_source_src_28000.paid_at, month) AS paid_at__month - , DATE_TRUNC(bookings_source_src_28000.paid_at, quarter) AS paid_at__quarter - , DATE_TRUNC(bookings_source_src_28000.paid_at, year) AS paid_at__year + , DATETIME_TRUNC(bookings_source_src_28000.paid_at, day) AS paid_at__day + , DATETIME_TRUNC(bookings_source_src_28000.paid_at, isoweek) AS paid_at__week + , DATETIME_TRUNC(bookings_source_src_28000.paid_at, month) AS paid_at__month + , DATETIME_TRUNC(bookings_source_src_28000.paid_at, quarter) AS paid_at__quarter + , DATETIME_TRUNC(bookings_source_src_28000.paid_at, year) AS paid_at__year , EXTRACT(year FROM bookings_source_src_28000.paid_at) AS paid_at__extract_year , EXTRACT(quarter FROM bookings_source_src_28000.paid_at) AS paid_at__extract_quarter , EXTRACT(month FROM bookings_source_src_28000.paid_at) AS paid_at__extract_month @@ -581,33 +581,33 @@ FROM ( , IF(EXTRACT(dayofweek FROM bookings_source_src_28000.paid_at) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_28000.paid_at) - 1) AS paid_at__extract_dow , EXTRACT(dayofyear FROM bookings_source_src_28000.paid_at) AS paid_at__extract_doy , bookings_source_src_28000.is_instant AS booking__is_instant - , DATE_TRUNC(bookings_source_src_28000.ds, day) AS booking__ds__day - , DATE_TRUNC(bookings_source_src_28000.ds, isoweek) AS booking__ds__week - , DATE_TRUNC(bookings_source_src_28000.ds, month) AS booking__ds__month - , DATE_TRUNC(bookings_source_src_28000.ds, quarter) AS booking__ds__quarter - , DATE_TRUNC(bookings_source_src_28000.ds, year) AS booking__ds__year + , DATETIME_TRUNC(bookings_source_src_28000.ds, day) AS booking__ds__day + , DATETIME_TRUNC(bookings_source_src_28000.ds, isoweek) AS booking__ds__week + , DATETIME_TRUNC(bookings_source_src_28000.ds, month) AS booking__ds__month + , DATETIME_TRUNC(bookings_source_src_28000.ds, quarter) AS booking__ds__quarter + , DATETIME_TRUNC(bookings_source_src_28000.ds, year) AS booking__ds__year , EXTRACT(year FROM bookings_source_src_28000.ds) AS booking__ds__extract_year , EXTRACT(quarter FROM bookings_source_src_28000.ds) AS booking__ds__extract_quarter , EXTRACT(month FROM bookings_source_src_28000.ds) AS booking__ds__extract_month , EXTRACT(day FROM bookings_source_src_28000.ds) AS booking__ds__extract_day , IF(EXTRACT(dayofweek FROM bookings_source_src_28000.ds) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_28000.ds) - 1) AS booking__ds__extract_dow , EXTRACT(dayofyear FROM bookings_source_src_28000.ds) AS booking__ds__extract_doy - , DATE_TRUNC(bookings_source_src_28000.ds_partitioned, day) AS booking__ds_partitioned__day - , DATE_TRUNC(bookings_source_src_28000.ds_partitioned, isoweek) AS booking__ds_partitioned__week - , DATE_TRUNC(bookings_source_src_28000.ds_partitioned, month) AS booking__ds_partitioned__month - , DATE_TRUNC(bookings_source_src_28000.ds_partitioned, quarter) AS booking__ds_partitioned__quarter - , DATE_TRUNC(bookings_source_src_28000.ds_partitioned, year) AS booking__ds_partitioned__year + , DATETIME_TRUNC(bookings_source_src_28000.ds_partitioned, day) AS booking__ds_partitioned__day + , DATETIME_TRUNC(bookings_source_src_28000.ds_partitioned, isoweek) AS booking__ds_partitioned__week + , DATETIME_TRUNC(bookings_source_src_28000.ds_partitioned, month) AS booking__ds_partitioned__month + , DATETIME_TRUNC(bookings_source_src_28000.ds_partitioned, quarter) AS booking__ds_partitioned__quarter + , DATETIME_TRUNC(bookings_source_src_28000.ds_partitioned, year) AS booking__ds_partitioned__year , EXTRACT(year FROM bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__extract_year , EXTRACT(quarter FROM bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__extract_quarter , EXTRACT(month FROM bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__extract_month , EXTRACT(day FROM bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__extract_day , IF(EXTRACT(dayofweek FROM bookings_source_src_28000.ds_partitioned) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_28000.ds_partitioned) - 1) AS booking__ds_partitioned__extract_dow , EXTRACT(dayofyear FROM bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__extract_doy - , DATE_TRUNC(bookings_source_src_28000.paid_at, day) AS booking__paid_at__day - , DATE_TRUNC(bookings_source_src_28000.paid_at, isoweek) AS booking__paid_at__week - , DATE_TRUNC(bookings_source_src_28000.paid_at, month) AS booking__paid_at__month - , DATE_TRUNC(bookings_source_src_28000.paid_at, quarter) AS booking__paid_at__quarter - , DATE_TRUNC(bookings_source_src_28000.paid_at, year) AS booking__paid_at__year + , DATETIME_TRUNC(bookings_source_src_28000.paid_at, day) AS booking__paid_at__day + , DATETIME_TRUNC(bookings_source_src_28000.paid_at, isoweek) AS booking__paid_at__week + , DATETIME_TRUNC(bookings_source_src_28000.paid_at, month) AS booking__paid_at__month + , DATETIME_TRUNC(bookings_source_src_28000.paid_at, quarter) AS booking__paid_at__quarter + , DATETIME_TRUNC(bookings_source_src_28000.paid_at, year) AS booking__paid_at__year , EXTRACT(year FROM bookings_source_src_28000.paid_at) AS booking__paid_at__extract_year , EXTRACT(quarter FROM bookings_source_src_28000.paid_at) AS booking__paid_at__extract_quarter , EXTRACT(month FROM bookings_source_src_28000.paid_at) AS booking__paid_at__extract_month @@ -705,22 +705,22 @@ FROM ( 1 AS listings , listings_latest_src_28000.capacity AS largest_listing , listings_latest_src_28000.capacity AS smallest_listing - , DATE_TRUNC(listings_latest_src_28000.created_at, day) AS ds__day - , DATE_TRUNC(listings_latest_src_28000.created_at, isoweek) AS ds__week - , DATE_TRUNC(listings_latest_src_28000.created_at, month) AS ds__month - , DATE_TRUNC(listings_latest_src_28000.created_at, quarter) AS ds__quarter - , DATE_TRUNC(listings_latest_src_28000.created_at, year) AS ds__year + , DATETIME_TRUNC(listings_latest_src_28000.created_at, day) AS ds__day + , DATETIME_TRUNC(listings_latest_src_28000.created_at, isoweek) AS ds__week + , DATETIME_TRUNC(listings_latest_src_28000.created_at, month) AS ds__month + , DATETIME_TRUNC(listings_latest_src_28000.created_at, quarter) AS ds__quarter + , DATETIME_TRUNC(listings_latest_src_28000.created_at, year) AS ds__year , EXTRACT(year FROM listings_latest_src_28000.created_at) AS ds__extract_year , EXTRACT(quarter FROM listings_latest_src_28000.created_at) AS ds__extract_quarter , EXTRACT(month FROM listings_latest_src_28000.created_at) AS ds__extract_month , EXTRACT(day FROM listings_latest_src_28000.created_at) AS ds__extract_day , IF(EXTRACT(dayofweek FROM listings_latest_src_28000.created_at) = 1, 7, EXTRACT(dayofweek FROM listings_latest_src_28000.created_at) - 1) AS ds__extract_dow , EXTRACT(dayofyear FROM listings_latest_src_28000.created_at) AS ds__extract_doy - , DATE_TRUNC(listings_latest_src_28000.created_at, day) AS created_at__day - , DATE_TRUNC(listings_latest_src_28000.created_at, isoweek) AS created_at__week - , DATE_TRUNC(listings_latest_src_28000.created_at, month) AS created_at__month - , DATE_TRUNC(listings_latest_src_28000.created_at, quarter) AS created_at__quarter - , DATE_TRUNC(listings_latest_src_28000.created_at, year) AS created_at__year + , DATETIME_TRUNC(listings_latest_src_28000.created_at, day) AS created_at__day + , DATETIME_TRUNC(listings_latest_src_28000.created_at, isoweek) AS created_at__week + , DATETIME_TRUNC(listings_latest_src_28000.created_at, month) AS created_at__month + , DATETIME_TRUNC(listings_latest_src_28000.created_at, quarter) AS created_at__quarter + , DATETIME_TRUNC(listings_latest_src_28000.created_at, year) AS created_at__year , EXTRACT(year FROM listings_latest_src_28000.created_at) AS created_at__extract_year , EXTRACT(quarter FROM listings_latest_src_28000.created_at) AS created_at__extract_quarter , EXTRACT(month FROM listings_latest_src_28000.created_at) AS created_at__extract_month @@ -730,22 +730,22 @@ FROM ( , listings_latest_src_28000.country AS country_latest , listings_latest_src_28000.is_lux AS is_lux_latest , listings_latest_src_28000.capacity AS capacity_latest - , DATE_TRUNC(listings_latest_src_28000.created_at, day) AS listing__ds__day - , DATE_TRUNC(listings_latest_src_28000.created_at, isoweek) AS listing__ds__week - , DATE_TRUNC(listings_latest_src_28000.created_at, month) AS listing__ds__month - , DATE_TRUNC(listings_latest_src_28000.created_at, quarter) AS listing__ds__quarter - , DATE_TRUNC(listings_latest_src_28000.created_at, year) AS listing__ds__year + , DATETIME_TRUNC(listings_latest_src_28000.created_at, day) AS listing__ds__day + , DATETIME_TRUNC(listings_latest_src_28000.created_at, isoweek) AS listing__ds__week + , DATETIME_TRUNC(listings_latest_src_28000.created_at, month) AS listing__ds__month + , DATETIME_TRUNC(listings_latest_src_28000.created_at, quarter) AS listing__ds__quarter + , DATETIME_TRUNC(listings_latest_src_28000.created_at, year) AS listing__ds__year , EXTRACT(year FROM listings_latest_src_28000.created_at) AS listing__ds__extract_year , EXTRACT(quarter FROM listings_latest_src_28000.created_at) AS listing__ds__extract_quarter , EXTRACT(month FROM listings_latest_src_28000.created_at) AS listing__ds__extract_month , EXTRACT(day FROM listings_latest_src_28000.created_at) AS listing__ds__extract_day , IF(EXTRACT(dayofweek FROM listings_latest_src_28000.created_at) = 1, 7, EXTRACT(dayofweek FROM listings_latest_src_28000.created_at) - 1) AS listing__ds__extract_dow , EXTRACT(dayofyear FROM listings_latest_src_28000.created_at) AS listing__ds__extract_doy - , DATE_TRUNC(listings_latest_src_28000.created_at, day) AS listing__created_at__day - , DATE_TRUNC(listings_latest_src_28000.created_at, isoweek) AS listing__created_at__week - , DATE_TRUNC(listings_latest_src_28000.created_at, month) AS listing__created_at__month - , DATE_TRUNC(listings_latest_src_28000.created_at, quarter) AS listing__created_at__quarter - , DATE_TRUNC(listings_latest_src_28000.created_at, year) AS listing__created_at__year + , DATETIME_TRUNC(listings_latest_src_28000.created_at, day) AS listing__created_at__day + , DATETIME_TRUNC(listings_latest_src_28000.created_at, isoweek) AS listing__created_at__week + , DATETIME_TRUNC(listings_latest_src_28000.created_at, month) AS listing__created_at__month + , DATETIME_TRUNC(listings_latest_src_28000.created_at, quarter) AS listing__created_at__quarter + , DATETIME_TRUNC(listings_latest_src_28000.created_at, year) AS listing__created_at__year , EXTRACT(year FROM listings_latest_src_28000.created_at) AS listing__created_at__extract_year , EXTRACT(quarter FROM listings_latest_src_28000.created_at) AS listing__created_at__extract_quarter , EXTRACT(month FROM listings_latest_src_28000.created_at) AS listing__created_at__extract_month @@ -912,33 +912,33 @@ FROM ( , bookings_source_src_28000.booking_value AS approximate_continuous_booking_value_p99 , bookings_source_src_28000.booking_value AS approximate_discrete_booking_value_p99 , bookings_source_src_28000.is_instant - , DATE_TRUNC(bookings_source_src_28000.ds, day) AS ds__day - , DATE_TRUNC(bookings_source_src_28000.ds, isoweek) AS ds__week - , DATE_TRUNC(bookings_source_src_28000.ds, month) AS ds__month - , DATE_TRUNC(bookings_source_src_28000.ds, quarter) AS ds__quarter - , DATE_TRUNC(bookings_source_src_28000.ds, year) AS ds__year + , DATETIME_TRUNC(bookings_source_src_28000.ds, day) AS ds__day + , DATETIME_TRUNC(bookings_source_src_28000.ds, isoweek) AS ds__week + , DATETIME_TRUNC(bookings_source_src_28000.ds, month) AS ds__month + , DATETIME_TRUNC(bookings_source_src_28000.ds, quarter) AS ds__quarter + , DATETIME_TRUNC(bookings_source_src_28000.ds, year) AS ds__year , EXTRACT(year FROM bookings_source_src_28000.ds) AS ds__extract_year , EXTRACT(quarter FROM bookings_source_src_28000.ds) AS ds__extract_quarter , EXTRACT(month FROM bookings_source_src_28000.ds) AS ds__extract_month , EXTRACT(day FROM bookings_source_src_28000.ds) AS ds__extract_day , IF(EXTRACT(dayofweek FROM bookings_source_src_28000.ds) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_28000.ds) - 1) AS ds__extract_dow , EXTRACT(dayofyear FROM bookings_source_src_28000.ds) AS ds__extract_doy - , DATE_TRUNC(bookings_source_src_28000.ds_partitioned, day) AS ds_partitioned__day - , DATE_TRUNC(bookings_source_src_28000.ds_partitioned, isoweek) AS ds_partitioned__week - , DATE_TRUNC(bookings_source_src_28000.ds_partitioned, month) AS ds_partitioned__month - , DATE_TRUNC(bookings_source_src_28000.ds_partitioned, quarter) AS ds_partitioned__quarter - , DATE_TRUNC(bookings_source_src_28000.ds_partitioned, year) AS ds_partitioned__year + , DATETIME_TRUNC(bookings_source_src_28000.ds_partitioned, day) AS ds_partitioned__day + , DATETIME_TRUNC(bookings_source_src_28000.ds_partitioned, isoweek) AS ds_partitioned__week + , DATETIME_TRUNC(bookings_source_src_28000.ds_partitioned, month) AS ds_partitioned__month + , DATETIME_TRUNC(bookings_source_src_28000.ds_partitioned, quarter) AS ds_partitioned__quarter + , DATETIME_TRUNC(bookings_source_src_28000.ds_partitioned, year) AS ds_partitioned__year , EXTRACT(year FROM bookings_source_src_28000.ds_partitioned) AS ds_partitioned__extract_year , EXTRACT(quarter FROM bookings_source_src_28000.ds_partitioned) AS ds_partitioned__extract_quarter , EXTRACT(month FROM bookings_source_src_28000.ds_partitioned) AS ds_partitioned__extract_month , EXTRACT(day FROM bookings_source_src_28000.ds_partitioned) AS ds_partitioned__extract_day , IF(EXTRACT(dayofweek FROM bookings_source_src_28000.ds_partitioned) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_28000.ds_partitioned) - 1) AS ds_partitioned__extract_dow , EXTRACT(dayofyear FROM bookings_source_src_28000.ds_partitioned) AS ds_partitioned__extract_doy - , DATE_TRUNC(bookings_source_src_28000.paid_at, day) AS paid_at__day - , DATE_TRUNC(bookings_source_src_28000.paid_at, isoweek) AS paid_at__week - , DATE_TRUNC(bookings_source_src_28000.paid_at, month) AS paid_at__month - , DATE_TRUNC(bookings_source_src_28000.paid_at, quarter) AS paid_at__quarter - , DATE_TRUNC(bookings_source_src_28000.paid_at, year) AS paid_at__year + , DATETIME_TRUNC(bookings_source_src_28000.paid_at, day) AS paid_at__day + , DATETIME_TRUNC(bookings_source_src_28000.paid_at, isoweek) AS paid_at__week + , DATETIME_TRUNC(bookings_source_src_28000.paid_at, month) AS paid_at__month + , DATETIME_TRUNC(bookings_source_src_28000.paid_at, quarter) AS paid_at__quarter + , DATETIME_TRUNC(bookings_source_src_28000.paid_at, year) AS paid_at__year , EXTRACT(year FROM bookings_source_src_28000.paid_at) AS paid_at__extract_year , EXTRACT(quarter FROM bookings_source_src_28000.paid_at) AS paid_at__extract_quarter , EXTRACT(month FROM bookings_source_src_28000.paid_at) AS paid_at__extract_month @@ -946,33 +946,33 @@ FROM ( , IF(EXTRACT(dayofweek FROM bookings_source_src_28000.paid_at) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_28000.paid_at) - 1) AS paid_at__extract_dow , EXTRACT(dayofyear FROM bookings_source_src_28000.paid_at) AS paid_at__extract_doy , bookings_source_src_28000.is_instant AS booking__is_instant - , DATE_TRUNC(bookings_source_src_28000.ds, day) AS booking__ds__day - , DATE_TRUNC(bookings_source_src_28000.ds, isoweek) AS booking__ds__week - , DATE_TRUNC(bookings_source_src_28000.ds, month) AS booking__ds__month - , DATE_TRUNC(bookings_source_src_28000.ds, quarter) AS booking__ds__quarter - , DATE_TRUNC(bookings_source_src_28000.ds, year) AS booking__ds__year + , DATETIME_TRUNC(bookings_source_src_28000.ds, day) AS booking__ds__day + , DATETIME_TRUNC(bookings_source_src_28000.ds, isoweek) AS booking__ds__week + , DATETIME_TRUNC(bookings_source_src_28000.ds, month) AS booking__ds__month + , DATETIME_TRUNC(bookings_source_src_28000.ds, quarter) AS booking__ds__quarter + , DATETIME_TRUNC(bookings_source_src_28000.ds, year) AS booking__ds__year , EXTRACT(year FROM bookings_source_src_28000.ds) AS booking__ds__extract_year , EXTRACT(quarter FROM bookings_source_src_28000.ds) AS booking__ds__extract_quarter , EXTRACT(month FROM bookings_source_src_28000.ds) AS booking__ds__extract_month , EXTRACT(day FROM bookings_source_src_28000.ds) AS booking__ds__extract_day , IF(EXTRACT(dayofweek FROM bookings_source_src_28000.ds) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_28000.ds) - 1) AS booking__ds__extract_dow , EXTRACT(dayofyear FROM bookings_source_src_28000.ds) AS booking__ds__extract_doy - , DATE_TRUNC(bookings_source_src_28000.ds_partitioned, day) AS booking__ds_partitioned__day - , DATE_TRUNC(bookings_source_src_28000.ds_partitioned, isoweek) AS booking__ds_partitioned__week - , DATE_TRUNC(bookings_source_src_28000.ds_partitioned, month) AS booking__ds_partitioned__month - , DATE_TRUNC(bookings_source_src_28000.ds_partitioned, quarter) AS booking__ds_partitioned__quarter - , DATE_TRUNC(bookings_source_src_28000.ds_partitioned, year) AS booking__ds_partitioned__year + , DATETIME_TRUNC(bookings_source_src_28000.ds_partitioned, day) AS booking__ds_partitioned__day + , DATETIME_TRUNC(bookings_source_src_28000.ds_partitioned, isoweek) AS booking__ds_partitioned__week + , DATETIME_TRUNC(bookings_source_src_28000.ds_partitioned, month) AS booking__ds_partitioned__month + , DATETIME_TRUNC(bookings_source_src_28000.ds_partitioned, quarter) AS booking__ds_partitioned__quarter + , DATETIME_TRUNC(bookings_source_src_28000.ds_partitioned, year) AS booking__ds_partitioned__year , EXTRACT(year FROM bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__extract_year , EXTRACT(quarter FROM bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__extract_quarter , EXTRACT(month FROM bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__extract_month , EXTRACT(day FROM bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__extract_day , IF(EXTRACT(dayofweek FROM bookings_source_src_28000.ds_partitioned) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_28000.ds_partitioned) - 1) AS booking__ds_partitioned__extract_dow , EXTRACT(dayofyear FROM bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__extract_doy - , DATE_TRUNC(bookings_source_src_28000.paid_at, day) AS booking__paid_at__day - , DATE_TRUNC(bookings_source_src_28000.paid_at, isoweek) AS booking__paid_at__week - , DATE_TRUNC(bookings_source_src_28000.paid_at, month) AS booking__paid_at__month - , DATE_TRUNC(bookings_source_src_28000.paid_at, quarter) AS booking__paid_at__quarter - , DATE_TRUNC(bookings_source_src_28000.paid_at, year) AS booking__paid_at__year + , DATETIME_TRUNC(bookings_source_src_28000.paid_at, day) AS booking__paid_at__day + , DATETIME_TRUNC(bookings_source_src_28000.paid_at, isoweek) AS booking__paid_at__week + , DATETIME_TRUNC(bookings_source_src_28000.paid_at, month) AS booking__paid_at__month + , DATETIME_TRUNC(bookings_source_src_28000.paid_at, quarter) AS booking__paid_at__quarter + , DATETIME_TRUNC(bookings_source_src_28000.paid_at, year) AS booking__paid_at__year , EXTRACT(year FROM bookings_source_src_28000.paid_at) AS booking__paid_at__extract_year , EXTRACT(quarter FROM bookings_source_src_28000.paid_at) AS booking__paid_at__extract_quarter , EXTRACT(month FROM bookings_source_src_28000.paid_at) AS booking__paid_at__extract_month diff --git a/tests_metricflow/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/BigQuery/test_nested_offsets__plan0.sql b/tests_metricflow/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/BigQuery/test_nested_offsets__plan0.sql index 5358d7845f..ce02d3f754 100644 --- a/tests_metricflow/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/BigQuery/test_nested_offsets__plan0.sql +++ b/tests_metricflow/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/BigQuery/test_nested_offsets__plan0.sql @@ -37,10 +37,10 @@ FROM ( -- Join to Time Spine Dataset SELECT subq_2.metric_time__day AS metric_time__day - , DATE_TRUNC(subq_2.metric_time__day, isoweek) AS metric_time__week - , DATE_TRUNC(subq_2.metric_time__day, month) AS metric_time__month - , DATE_TRUNC(subq_2.metric_time__day, quarter) AS metric_time__quarter - , DATE_TRUNC(subq_2.metric_time__day, year) AS metric_time__year + , DATETIME_TRUNC(subq_2.metric_time__day, isoweek) AS metric_time__week + , DATETIME_TRUNC(subq_2.metric_time__day, month) AS metric_time__month + , DATETIME_TRUNC(subq_2.metric_time__day, quarter) AS metric_time__quarter + , DATETIME_TRUNC(subq_2.metric_time__day, year) AS metric_time__year , EXTRACT(year FROM subq_2.metric_time__day) AS metric_time__extract_year , EXTRACT(quarter FROM subq_2.metric_time__day) AS metric_time__extract_quarter , EXTRACT(month FROM subq_2.metric_time__day) AS metric_time__extract_month @@ -259,33 +259,33 @@ FROM ( , bookings_source_src_28000.booking_value AS approximate_continuous_booking_value_p99 , bookings_source_src_28000.booking_value AS approximate_discrete_booking_value_p99 , bookings_source_src_28000.is_instant - , DATE_TRUNC(bookings_source_src_28000.ds, day) AS ds__day - , DATE_TRUNC(bookings_source_src_28000.ds, isoweek) AS ds__week - , DATE_TRUNC(bookings_source_src_28000.ds, month) AS ds__month - , DATE_TRUNC(bookings_source_src_28000.ds, quarter) AS ds__quarter - , DATE_TRUNC(bookings_source_src_28000.ds, year) AS ds__year + , DATETIME_TRUNC(bookings_source_src_28000.ds, day) AS ds__day + , DATETIME_TRUNC(bookings_source_src_28000.ds, isoweek) AS ds__week + , DATETIME_TRUNC(bookings_source_src_28000.ds, month) AS ds__month + , DATETIME_TRUNC(bookings_source_src_28000.ds, quarter) AS ds__quarter + , DATETIME_TRUNC(bookings_source_src_28000.ds, year) AS ds__year , EXTRACT(year FROM bookings_source_src_28000.ds) AS ds__extract_year , EXTRACT(quarter FROM bookings_source_src_28000.ds) AS ds__extract_quarter , EXTRACT(month FROM bookings_source_src_28000.ds) AS ds__extract_month , EXTRACT(day FROM bookings_source_src_28000.ds) AS ds__extract_day , IF(EXTRACT(dayofweek FROM bookings_source_src_28000.ds) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_28000.ds) - 1) AS ds__extract_dow , EXTRACT(dayofyear FROM bookings_source_src_28000.ds) AS ds__extract_doy - , DATE_TRUNC(bookings_source_src_28000.ds_partitioned, day) AS ds_partitioned__day - , DATE_TRUNC(bookings_source_src_28000.ds_partitioned, isoweek) AS ds_partitioned__week - , DATE_TRUNC(bookings_source_src_28000.ds_partitioned, month) AS ds_partitioned__month - , DATE_TRUNC(bookings_source_src_28000.ds_partitioned, quarter) AS ds_partitioned__quarter - , DATE_TRUNC(bookings_source_src_28000.ds_partitioned, year) AS ds_partitioned__year + , DATETIME_TRUNC(bookings_source_src_28000.ds_partitioned, day) AS ds_partitioned__day + , DATETIME_TRUNC(bookings_source_src_28000.ds_partitioned, isoweek) AS ds_partitioned__week + , DATETIME_TRUNC(bookings_source_src_28000.ds_partitioned, month) AS ds_partitioned__month + , DATETIME_TRUNC(bookings_source_src_28000.ds_partitioned, quarter) AS ds_partitioned__quarter + , DATETIME_TRUNC(bookings_source_src_28000.ds_partitioned, year) AS ds_partitioned__year , EXTRACT(year FROM bookings_source_src_28000.ds_partitioned) AS ds_partitioned__extract_year , EXTRACT(quarter FROM bookings_source_src_28000.ds_partitioned) AS ds_partitioned__extract_quarter , EXTRACT(month FROM bookings_source_src_28000.ds_partitioned) AS ds_partitioned__extract_month , EXTRACT(day FROM bookings_source_src_28000.ds_partitioned) AS ds_partitioned__extract_day , IF(EXTRACT(dayofweek FROM bookings_source_src_28000.ds_partitioned) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_28000.ds_partitioned) - 1) AS ds_partitioned__extract_dow , EXTRACT(dayofyear FROM bookings_source_src_28000.ds_partitioned) AS ds_partitioned__extract_doy - , DATE_TRUNC(bookings_source_src_28000.paid_at, day) AS paid_at__day - , DATE_TRUNC(bookings_source_src_28000.paid_at, isoweek) AS paid_at__week - , DATE_TRUNC(bookings_source_src_28000.paid_at, month) AS paid_at__month - , DATE_TRUNC(bookings_source_src_28000.paid_at, quarter) AS paid_at__quarter - , DATE_TRUNC(bookings_source_src_28000.paid_at, year) AS paid_at__year + , DATETIME_TRUNC(bookings_source_src_28000.paid_at, day) AS paid_at__day + , DATETIME_TRUNC(bookings_source_src_28000.paid_at, isoweek) AS paid_at__week + , DATETIME_TRUNC(bookings_source_src_28000.paid_at, month) AS paid_at__month + , DATETIME_TRUNC(bookings_source_src_28000.paid_at, quarter) AS paid_at__quarter + , DATETIME_TRUNC(bookings_source_src_28000.paid_at, year) AS paid_at__year , EXTRACT(year FROM bookings_source_src_28000.paid_at) AS paid_at__extract_year , EXTRACT(quarter FROM bookings_source_src_28000.paid_at) AS paid_at__extract_quarter , EXTRACT(month FROM bookings_source_src_28000.paid_at) AS paid_at__extract_month @@ -293,33 +293,33 @@ FROM ( , IF(EXTRACT(dayofweek FROM bookings_source_src_28000.paid_at) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_28000.paid_at) - 1) AS paid_at__extract_dow , EXTRACT(dayofyear FROM bookings_source_src_28000.paid_at) AS paid_at__extract_doy , bookings_source_src_28000.is_instant AS booking__is_instant - , DATE_TRUNC(bookings_source_src_28000.ds, day) AS booking__ds__day - , DATE_TRUNC(bookings_source_src_28000.ds, isoweek) AS booking__ds__week - , DATE_TRUNC(bookings_source_src_28000.ds, month) AS booking__ds__month - , DATE_TRUNC(bookings_source_src_28000.ds, quarter) AS booking__ds__quarter - , DATE_TRUNC(bookings_source_src_28000.ds, year) AS booking__ds__year + , DATETIME_TRUNC(bookings_source_src_28000.ds, day) AS booking__ds__day + , DATETIME_TRUNC(bookings_source_src_28000.ds, isoweek) AS booking__ds__week + , DATETIME_TRUNC(bookings_source_src_28000.ds, month) AS booking__ds__month + , DATETIME_TRUNC(bookings_source_src_28000.ds, quarter) AS booking__ds__quarter + , DATETIME_TRUNC(bookings_source_src_28000.ds, year) AS booking__ds__year , EXTRACT(year FROM bookings_source_src_28000.ds) AS booking__ds__extract_year , EXTRACT(quarter FROM bookings_source_src_28000.ds) AS booking__ds__extract_quarter , EXTRACT(month FROM bookings_source_src_28000.ds) AS booking__ds__extract_month , EXTRACT(day FROM bookings_source_src_28000.ds) AS booking__ds__extract_day , IF(EXTRACT(dayofweek FROM bookings_source_src_28000.ds) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_28000.ds) - 1) AS booking__ds__extract_dow , EXTRACT(dayofyear FROM bookings_source_src_28000.ds) AS booking__ds__extract_doy - , DATE_TRUNC(bookings_source_src_28000.ds_partitioned, day) AS booking__ds_partitioned__day - , DATE_TRUNC(bookings_source_src_28000.ds_partitioned, isoweek) AS booking__ds_partitioned__week - , DATE_TRUNC(bookings_source_src_28000.ds_partitioned, month) AS booking__ds_partitioned__month - , DATE_TRUNC(bookings_source_src_28000.ds_partitioned, quarter) AS booking__ds_partitioned__quarter - , DATE_TRUNC(bookings_source_src_28000.ds_partitioned, year) AS booking__ds_partitioned__year + , DATETIME_TRUNC(bookings_source_src_28000.ds_partitioned, day) AS booking__ds_partitioned__day + , DATETIME_TRUNC(bookings_source_src_28000.ds_partitioned, isoweek) AS booking__ds_partitioned__week + , DATETIME_TRUNC(bookings_source_src_28000.ds_partitioned, month) AS booking__ds_partitioned__month + , DATETIME_TRUNC(bookings_source_src_28000.ds_partitioned, quarter) AS booking__ds_partitioned__quarter + , DATETIME_TRUNC(bookings_source_src_28000.ds_partitioned, year) AS booking__ds_partitioned__year , EXTRACT(year FROM bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__extract_year , EXTRACT(quarter FROM bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__extract_quarter , EXTRACT(month FROM bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__extract_month , EXTRACT(day FROM bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__extract_day , IF(EXTRACT(dayofweek FROM bookings_source_src_28000.ds_partitioned) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_28000.ds_partitioned) - 1) AS booking__ds_partitioned__extract_dow , EXTRACT(dayofyear FROM bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__extract_doy - , DATE_TRUNC(bookings_source_src_28000.paid_at, day) AS booking__paid_at__day - , DATE_TRUNC(bookings_source_src_28000.paid_at, isoweek) AS booking__paid_at__week - , DATE_TRUNC(bookings_source_src_28000.paid_at, month) AS booking__paid_at__month - , DATE_TRUNC(bookings_source_src_28000.paid_at, quarter) AS booking__paid_at__quarter - , DATE_TRUNC(bookings_source_src_28000.paid_at, year) AS booking__paid_at__year + , DATETIME_TRUNC(bookings_source_src_28000.paid_at, day) AS booking__paid_at__day + , DATETIME_TRUNC(bookings_source_src_28000.paid_at, isoweek) AS booking__paid_at__week + , DATETIME_TRUNC(bookings_source_src_28000.paid_at, month) AS booking__paid_at__month + , DATETIME_TRUNC(bookings_source_src_28000.paid_at, quarter) AS booking__paid_at__quarter + , DATETIME_TRUNC(bookings_source_src_28000.paid_at, year) AS booking__paid_at__year , EXTRACT(year FROM bookings_source_src_28000.paid_at) AS booking__paid_at__extract_year , EXTRACT(quarter FROM bookings_source_src_28000.paid_at) AS booking__paid_at__extract_quarter , EXTRACT(month FROM bookings_source_src_28000.paid_at) AS booking__paid_at__extract_month diff --git a/tests_metricflow/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/BigQuery/test_nested_offsets__plan0_optimized.sql b/tests_metricflow/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/BigQuery/test_nested_offsets__plan0_optimized.sql index 25d771d910..95482a7759 100644 --- a/tests_metricflow/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/BigQuery/test_nested_offsets__plan0_optimized.sql +++ b/tests_metricflow/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/BigQuery/test_nested_offsets__plan0_optimized.sql @@ -26,7 +26,7 @@ FROM ( -- Read Elements From Semantic Model 'bookings_source' -- Metric Time Dimension 'ds' SELECT - DATE_TRUNC(ds, day) AS metric_time__day + DATETIME_TRUNC(ds, day) AS metric_time__day , 1 AS bookings FROM ***************************.fct_bookings bookings_source_src_28000 ) subq_13 diff --git a/tests_metricflow/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/BigQuery/test_nested_offsets_with_time_constraint__plan0.sql b/tests_metricflow/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/BigQuery/test_nested_offsets_with_time_constraint__plan0.sql index bbc68c9d92..9c0be8d3b7 100644 --- a/tests_metricflow/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/BigQuery/test_nested_offsets_with_time_constraint__plan0.sql +++ b/tests_metricflow/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/BigQuery/test_nested_offsets_with_time_constraint__plan0.sql @@ -38,10 +38,10 @@ FROM ( -- Join to Time Spine Dataset SELECT subq_2.metric_time__day AS metric_time__day - , DATE_TRUNC(subq_2.metric_time__day, isoweek) AS metric_time__week - , DATE_TRUNC(subq_2.metric_time__day, month) AS metric_time__month - , DATE_TRUNC(subq_2.metric_time__day, quarter) AS metric_time__quarter - , DATE_TRUNC(subq_2.metric_time__day, year) AS metric_time__year + , DATETIME_TRUNC(subq_2.metric_time__day, isoweek) AS metric_time__week + , DATETIME_TRUNC(subq_2.metric_time__day, month) AS metric_time__month + , DATETIME_TRUNC(subq_2.metric_time__day, quarter) AS metric_time__quarter + , DATETIME_TRUNC(subq_2.metric_time__day, year) AS metric_time__year , EXTRACT(year FROM subq_2.metric_time__day) AS metric_time__extract_year , EXTRACT(quarter FROM subq_2.metric_time__day) AS metric_time__extract_quarter , EXTRACT(month FROM subq_2.metric_time__day) AS metric_time__extract_month @@ -260,33 +260,33 @@ FROM ( , bookings_source_src_28000.booking_value AS approximate_continuous_booking_value_p99 , bookings_source_src_28000.booking_value AS approximate_discrete_booking_value_p99 , bookings_source_src_28000.is_instant - , DATE_TRUNC(bookings_source_src_28000.ds, day) AS ds__day - , DATE_TRUNC(bookings_source_src_28000.ds, isoweek) AS ds__week - , DATE_TRUNC(bookings_source_src_28000.ds, month) AS ds__month - , DATE_TRUNC(bookings_source_src_28000.ds, quarter) AS ds__quarter - , DATE_TRUNC(bookings_source_src_28000.ds, year) AS ds__year + , DATETIME_TRUNC(bookings_source_src_28000.ds, day) AS ds__day + , DATETIME_TRUNC(bookings_source_src_28000.ds, isoweek) AS ds__week + , DATETIME_TRUNC(bookings_source_src_28000.ds, month) AS ds__month + , DATETIME_TRUNC(bookings_source_src_28000.ds, quarter) AS ds__quarter + , DATETIME_TRUNC(bookings_source_src_28000.ds, year) AS ds__year , EXTRACT(year FROM bookings_source_src_28000.ds) AS ds__extract_year , EXTRACT(quarter FROM bookings_source_src_28000.ds) AS ds__extract_quarter , EXTRACT(month FROM bookings_source_src_28000.ds) AS ds__extract_month , EXTRACT(day FROM bookings_source_src_28000.ds) AS ds__extract_day , IF(EXTRACT(dayofweek FROM bookings_source_src_28000.ds) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_28000.ds) - 1) AS ds__extract_dow , EXTRACT(dayofyear FROM bookings_source_src_28000.ds) AS ds__extract_doy - , DATE_TRUNC(bookings_source_src_28000.ds_partitioned, day) AS ds_partitioned__day - , DATE_TRUNC(bookings_source_src_28000.ds_partitioned, isoweek) AS ds_partitioned__week - , DATE_TRUNC(bookings_source_src_28000.ds_partitioned, month) AS ds_partitioned__month - , DATE_TRUNC(bookings_source_src_28000.ds_partitioned, quarter) AS ds_partitioned__quarter - , DATE_TRUNC(bookings_source_src_28000.ds_partitioned, year) AS ds_partitioned__year + , DATETIME_TRUNC(bookings_source_src_28000.ds_partitioned, day) AS ds_partitioned__day + , DATETIME_TRUNC(bookings_source_src_28000.ds_partitioned, isoweek) AS ds_partitioned__week + , DATETIME_TRUNC(bookings_source_src_28000.ds_partitioned, month) AS ds_partitioned__month + , DATETIME_TRUNC(bookings_source_src_28000.ds_partitioned, quarter) AS ds_partitioned__quarter + , DATETIME_TRUNC(bookings_source_src_28000.ds_partitioned, year) AS ds_partitioned__year , EXTRACT(year FROM bookings_source_src_28000.ds_partitioned) AS ds_partitioned__extract_year , EXTRACT(quarter FROM bookings_source_src_28000.ds_partitioned) AS ds_partitioned__extract_quarter , EXTRACT(month FROM bookings_source_src_28000.ds_partitioned) AS ds_partitioned__extract_month , EXTRACT(day FROM bookings_source_src_28000.ds_partitioned) AS ds_partitioned__extract_day , IF(EXTRACT(dayofweek FROM bookings_source_src_28000.ds_partitioned) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_28000.ds_partitioned) - 1) AS ds_partitioned__extract_dow , EXTRACT(dayofyear FROM bookings_source_src_28000.ds_partitioned) AS ds_partitioned__extract_doy - , DATE_TRUNC(bookings_source_src_28000.paid_at, day) AS paid_at__day - , DATE_TRUNC(bookings_source_src_28000.paid_at, isoweek) AS paid_at__week - , DATE_TRUNC(bookings_source_src_28000.paid_at, month) AS paid_at__month - , DATE_TRUNC(bookings_source_src_28000.paid_at, quarter) AS paid_at__quarter - , DATE_TRUNC(bookings_source_src_28000.paid_at, year) AS paid_at__year + , DATETIME_TRUNC(bookings_source_src_28000.paid_at, day) AS paid_at__day + , DATETIME_TRUNC(bookings_source_src_28000.paid_at, isoweek) AS paid_at__week + , DATETIME_TRUNC(bookings_source_src_28000.paid_at, month) AS paid_at__month + , DATETIME_TRUNC(bookings_source_src_28000.paid_at, quarter) AS paid_at__quarter + , DATETIME_TRUNC(bookings_source_src_28000.paid_at, year) AS paid_at__year , EXTRACT(year FROM bookings_source_src_28000.paid_at) AS paid_at__extract_year , EXTRACT(quarter FROM bookings_source_src_28000.paid_at) AS paid_at__extract_quarter , EXTRACT(month FROM bookings_source_src_28000.paid_at) AS paid_at__extract_month @@ -294,33 +294,33 @@ FROM ( , IF(EXTRACT(dayofweek FROM bookings_source_src_28000.paid_at) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_28000.paid_at) - 1) AS paid_at__extract_dow , EXTRACT(dayofyear FROM bookings_source_src_28000.paid_at) AS paid_at__extract_doy , bookings_source_src_28000.is_instant AS booking__is_instant - , DATE_TRUNC(bookings_source_src_28000.ds, day) AS booking__ds__day - , DATE_TRUNC(bookings_source_src_28000.ds, isoweek) AS booking__ds__week - , DATE_TRUNC(bookings_source_src_28000.ds, month) AS booking__ds__month - , DATE_TRUNC(bookings_source_src_28000.ds, quarter) AS booking__ds__quarter - , DATE_TRUNC(bookings_source_src_28000.ds, year) AS booking__ds__year + , DATETIME_TRUNC(bookings_source_src_28000.ds, day) AS booking__ds__day + , DATETIME_TRUNC(bookings_source_src_28000.ds, isoweek) AS booking__ds__week + , DATETIME_TRUNC(bookings_source_src_28000.ds, month) AS booking__ds__month + , DATETIME_TRUNC(bookings_source_src_28000.ds, quarter) AS booking__ds__quarter + , DATETIME_TRUNC(bookings_source_src_28000.ds, year) AS booking__ds__year , EXTRACT(year FROM bookings_source_src_28000.ds) AS booking__ds__extract_year , EXTRACT(quarter FROM bookings_source_src_28000.ds) AS booking__ds__extract_quarter , EXTRACT(month FROM bookings_source_src_28000.ds) AS booking__ds__extract_month , EXTRACT(day FROM bookings_source_src_28000.ds) AS booking__ds__extract_day , IF(EXTRACT(dayofweek FROM bookings_source_src_28000.ds) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_28000.ds) - 1) AS booking__ds__extract_dow , EXTRACT(dayofyear FROM bookings_source_src_28000.ds) AS booking__ds__extract_doy - , DATE_TRUNC(bookings_source_src_28000.ds_partitioned, day) AS booking__ds_partitioned__day - , DATE_TRUNC(bookings_source_src_28000.ds_partitioned, isoweek) AS booking__ds_partitioned__week - , DATE_TRUNC(bookings_source_src_28000.ds_partitioned, month) AS booking__ds_partitioned__month - , DATE_TRUNC(bookings_source_src_28000.ds_partitioned, quarter) AS booking__ds_partitioned__quarter - , DATE_TRUNC(bookings_source_src_28000.ds_partitioned, year) AS booking__ds_partitioned__year + , DATETIME_TRUNC(bookings_source_src_28000.ds_partitioned, day) AS booking__ds_partitioned__day + , DATETIME_TRUNC(bookings_source_src_28000.ds_partitioned, isoweek) AS booking__ds_partitioned__week + , DATETIME_TRUNC(bookings_source_src_28000.ds_partitioned, month) AS booking__ds_partitioned__month + , DATETIME_TRUNC(bookings_source_src_28000.ds_partitioned, quarter) AS booking__ds_partitioned__quarter + , DATETIME_TRUNC(bookings_source_src_28000.ds_partitioned, year) AS booking__ds_partitioned__year , EXTRACT(year FROM bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__extract_year , EXTRACT(quarter FROM bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__extract_quarter , EXTRACT(month FROM bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__extract_month , EXTRACT(day FROM bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__extract_day , IF(EXTRACT(dayofweek FROM bookings_source_src_28000.ds_partitioned) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_28000.ds_partitioned) - 1) AS booking__ds_partitioned__extract_dow , EXTRACT(dayofyear FROM bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__extract_doy - , DATE_TRUNC(bookings_source_src_28000.paid_at, day) AS booking__paid_at__day - , DATE_TRUNC(bookings_source_src_28000.paid_at, isoweek) AS booking__paid_at__week - , DATE_TRUNC(bookings_source_src_28000.paid_at, month) AS booking__paid_at__month - , DATE_TRUNC(bookings_source_src_28000.paid_at, quarter) AS booking__paid_at__quarter - , DATE_TRUNC(bookings_source_src_28000.paid_at, year) AS booking__paid_at__year + , DATETIME_TRUNC(bookings_source_src_28000.paid_at, day) AS booking__paid_at__day + , DATETIME_TRUNC(bookings_source_src_28000.paid_at, isoweek) AS booking__paid_at__week + , DATETIME_TRUNC(bookings_source_src_28000.paid_at, month) AS booking__paid_at__month + , DATETIME_TRUNC(bookings_source_src_28000.paid_at, quarter) AS booking__paid_at__quarter + , DATETIME_TRUNC(bookings_source_src_28000.paid_at, year) AS booking__paid_at__year , EXTRACT(year FROM bookings_source_src_28000.paid_at) AS booking__paid_at__extract_year , EXTRACT(quarter FROM bookings_source_src_28000.paid_at) AS booking__paid_at__extract_quarter , EXTRACT(month FROM bookings_source_src_28000.paid_at) AS booking__paid_at__extract_month diff --git a/tests_metricflow/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/BigQuery/test_nested_offsets_with_time_constraint__plan0_optimized.sql b/tests_metricflow/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/BigQuery/test_nested_offsets_with_time_constraint__plan0_optimized.sql index 69cfc4f579..883e2c5d74 100644 --- a/tests_metricflow/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/BigQuery/test_nested_offsets_with_time_constraint__plan0_optimized.sql +++ b/tests_metricflow/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/BigQuery/test_nested_offsets_with_time_constraint__plan0_optimized.sql @@ -32,7 +32,7 @@ FROM ( -- Read Elements From Semantic Model 'bookings_source' -- Metric Time Dimension 'ds' SELECT - DATE_TRUNC(ds, day) AS metric_time__day + DATETIME_TRUNC(ds, day) AS metric_time__day , 1 AS bookings FROM ***************************.fct_bookings bookings_source_src_28000 ) subq_13 diff --git a/tests_metricflow/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/BigQuery/test_nested_offsets_with_where_constraint__plan0.sql b/tests_metricflow/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/BigQuery/test_nested_offsets_with_where_constraint__plan0.sql index ea13331f93..b79fd59f9b 100644 --- a/tests_metricflow/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/BigQuery/test_nested_offsets_with_where_constraint__plan0.sql +++ b/tests_metricflow/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/BigQuery/test_nested_offsets_with_where_constraint__plan0.sql @@ -42,10 +42,10 @@ FROM ( -- Join to Time Spine Dataset SELECT subq_2.metric_time__day AS metric_time__day - , DATE_TRUNC(subq_2.metric_time__day, isoweek) AS metric_time__week - , DATE_TRUNC(subq_2.metric_time__day, month) AS metric_time__month - , DATE_TRUNC(subq_2.metric_time__day, quarter) AS metric_time__quarter - , DATE_TRUNC(subq_2.metric_time__day, year) AS metric_time__year + , DATETIME_TRUNC(subq_2.metric_time__day, isoweek) AS metric_time__week + , DATETIME_TRUNC(subq_2.metric_time__day, month) AS metric_time__month + , DATETIME_TRUNC(subq_2.metric_time__day, quarter) AS metric_time__quarter + , DATETIME_TRUNC(subq_2.metric_time__day, year) AS metric_time__year , EXTRACT(year FROM subq_2.metric_time__day) AS metric_time__extract_year , EXTRACT(quarter FROM subq_2.metric_time__day) AS metric_time__extract_quarter , EXTRACT(month FROM subq_2.metric_time__day) AS metric_time__extract_month @@ -264,33 +264,33 @@ FROM ( , bookings_source_src_28000.booking_value AS approximate_continuous_booking_value_p99 , bookings_source_src_28000.booking_value AS approximate_discrete_booking_value_p99 , bookings_source_src_28000.is_instant - , DATE_TRUNC(bookings_source_src_28000.ds, day) AS ds__day - , DATE_TRUNC(bookings_source_src_28000.ds, isoweek) AS ds__week - , DATE_TRUNC(bookings_source_src_28000.ds, month) AS ds__month - , DATE_TRUNC(bookings_source_src_28000.ds, quarter) AS ds__quarter - , DATE_TRUNC(bookings_source_src_28000.ds, year) AS ds__year + , DATETIME_TRUNC(bookings_source_src_28000.ds, day) AS ds__day + , DATETIME_TRUNC(bookings_source_src_28000.ds, isoweek) AS ds__week + , DATETIME_TRUNC(bookings_source_src_28000.ds, month) AS ds__month + , DATETIME_TRUNC(bookings_source_src_28000.ds, quarter) AS ds__quarter + , DATETIME_TRUNC(bookings_source_src_28000.ds, year) AS ds__year , EXTRACT(year FROM bookings_source_src_28000.ds) AS ds__extract_year , EXTRACT(quarter FROM bookings_source_src_28000.ds) AS ds__extract_quarter , EXTRACT(month FROM bookings_source_src_28000.ds) AS ds__extract_month , EXTRACT(day FROM bookings_source_src_28000.ds) AS ds__extract_day , IF(EXTRACT(dayofweek FROM bookings_source_src_28000.ds) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_28000.ds) - 1) AS ds__extract_dow , EXTRACT(dayofyear FROM bookings_source_src_28000.ds) AS ds__extract_doy - , DATE_TRUNC(bookings_source_src_28000.ds_partitioned, day) AS ds_partitioned__day - , DATE_TRUNC(bookings_source_src_28000.ds_partitioned, isoweek) AS ds_partitioned__week - , DATE_TRUNC(bookings_source_src_28000.ds_partitioned, month) AS ds_partitioned__month - , DATE_TRUNC(bookings_source_src_28000.ds_partitioned, quarter) AS ds_partitioned__quarter - , DATE_TRUNC(bookings_source_src_28000.ds_partitioned, year) AS ds_partitioned__year + , DATETIME_TRUNC(bookings_source_src_28000.ds_partitioned, day) AS ds_partitioned__day + , DATETIME_TRUNC(bookings_source_src_28000.ds_partitioned, isoweek) AS ds_partitioned__week + , DATETIME_TRUNC(bookings_source_src_28000.ds_partitioned, month) AS ds_partitioned__month + , DATETIME_TRUNC(bookings_source_src_28000.ds_partitioned, quarter) AS ds_partitioned__quarter + , DATETIME_TRUNC(bookings_source_src_28000.ds_partitioned, year) AS ds_partitioned__year , EXTRACT(year FROM bookings_source_src_28000.ds_partitioned) AS ds_partitioned__extract_year , EXTRACT(quarter FROM bookings_source_src_28000.ds_partitioned) AS ds_partitioned__extract_quarter , EXTRACT(month FROM bookings_source_src_28000.ds_partitioned) AS ds_partitioned__extract_month , EXTRACT(day FROM bookings_source_src_28000.ds_partitioned) AS ds_partitioned__extract_day , IF(EXTRACT(dayofweek FROM bookings_source_src_28000.ds_partitioned) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_28000.ds_partitioned) - 1) AS ds_partitioned__extract_dow , EXTRACT(dayofyear FROM bookings_source_src_28000.ds_partitioned) AS ds_partitioned__extract_doy - , DATE_TRUNC(bookings_source_src_28000.paid_at, day) AS paid_at__day - , DATE_TRUNC(bookings_source_src_28000.paid_at, isoweek) AS paid_at__week - , DATE_TRUNC(bookings_source_src_28000.paid_at, month) AS paid_at__month - , DATE_TRUNC(bookings_source_src_28000.paid_at, quarter) AS paid_at__quarter - , DATE_TRUNC(bookings_source_src_28000.paid_at, year) AS paid_at__year + , DATETIME_TRUNC(bookings_source_src_28000.paid_at, day) AS paid_at__day + , DATETIME_TRUNC(bookings_source_src_28000.paid_at, isoweek) AS paid_at__week + , DATETIME_TRUNC(bookings_source_src_28000.paid_at, month) AS paid_at__month + , DATETIME_TRUNC(bookings_source_src_28000.paid_at, quarter) AS paid_at__quarter + , DATETIME_TRUNC(bookings_source_src_28000.paid_at, year) AS paid_at__year , EXTRACT(year FROM bookings_source_src_28000.paid_at) AS paid_at__extract_year , EXTRACT(quarter FROM bookings_source_src_28000.paid_at) AS paid_at__extract_quarter , EXTRACT(month FROM bookings_source_src_28000.paid_at) AS paid_at__extract_month @@ -298,33 +298,33 @@ FROM ( , IF(EXTRACT(dayofweek FROM bookings_source_src_28000.paid_at) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_28000.paid_at) - 1) AS paid_at__extract_dow , EXTRACT(dayofyear FROM bookings_source_src_28000.paid_at) AS paid_at__extract_doy , bookings_source_src_28000.is_instant AS booking__is_instant - , DATE_TRUNC(bookings_source_src_28000.ds, day) AS booking__ds__day - , DATE_TRUNC(bookings_source_src_28000.ds, isoweek) AS booking__ds__week - , DATE_TRUNC(bookings_source_src_28000.ds, month) AS booking__ds__month - , DATE_TRUNC(bookings_source_src_28000.ds, quarter) AS booking__ds__quarter - , DATE_TRUNC(bookings_source_src_28000.ds, year) AS booking__ds__year + , DATETIME_TRUNC(bookings_source_src_28000.ds, day) AS booking__ds__day + , DATETIME_TRUNC(bookings_source_src_28000.ds, isoweek) AS booking__ds__week + , DATETIME_TRUNC(bookings_source_src_28000.ds, month) AS booking__ds__month + , DATETIME_TRUNC(bookings_source_src_28000.ds, quarter) AS booking__ds__quarter + , DATETIME_TRUNC(bookings_source_src_28000.ds, year) AS booking__ds__year , EXTRACT(year FROM bookings_source_src_28000.ds) AS booking__ds__extract_year , EXTRACT(quarter FROM bookings_source_src_28000.ds) AS booking__ds__extract_quarter , EXTRACT(month FROM bookings_source_src_28000.ds) AS booking__ds__extract_month , EXTRACT(day FROM bookings_source_src_28000.ds) AS booking__ds__extract_day , IF(EXTRACT(dayofweek FROM bookings_source_src_28000.ds) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_28000.ds) - 1) AS booking__ds__extract_dow , EXTRACT(dayofyear FROM bookings_source_src_28000.ds) AS booking__ds__extract_doy - , DATE_TRUNC(bookings_source_src_28000.ds_partitioned, day) AS booking__ds_partitioned__day - , DATE_TRUNC(bookings_source_src_28000.ds_partitioned, isoweek) AS booking__ds_partitioned__week - , DATE_TRUNC(bookings_source_src_28000.ds_partitioned, month) AS booking__ds_partitioned__month - , DATE_TRUNC(bookings_source_src_28000.ds_partitioned, quarter) AS booking__ds_partitioned__quarter - , DATE_TRUNC(bookings_source_src_28000.ds_partitioned, year) AS booking__ds_partitioned__year + , DATETIME_TRUNC(bookings_source_src_28000.ds_partitioned, day) AS booking__ds_partitioned__day + , DATETIME_TRUNC(bookings_source_src_28000.ds_partitioned, isoweek) AS booking__ds_partitioned__week + , DATETIME_TRUNC(bookings_source_src_28000.ds_partitioned, month) AS booking__ds_partitioned__month + , DATETIME_TRUNC(bookings_source_src_28000.ds_partitioned, quarter) AS booking__ds_partitioned__quarter + , DATETIME_TRUNC(bookings_source_src_28000.ds_partitioned, year) AS booking__ds_partitioned__year , EXTRACT(year FROM bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__extract_year , EXTRACT(quarter FROM bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__extract_quarter , EXTRACT(month FROM bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__extract_month , EXTRACT(day FROM bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__extract_day , IF(EXTRACT(dayofweek FROM bookings_source_src_28000.ds_partitioned) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_28000.ds_partitioned) - 1) AS booking__ds_partitioned__extract_dow , EXTRACT(dayofyear FROM bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__extract_doy - , DATE_TRUNC(bookings_source_src_28000.paid_at, day) AS booking__paid_at__day - , DATE_TRUNC(bookings_source_src_28000.paid_at, isoweek) AS booking__paid_at__week - , DATE_TRUNC(bookings_source_src_28000.paid_at, month) AS booking__paid_at__month - , DATE_TRUNC(bookings_source_src_28000.paid_at, quarter) AS booking__paid_at__quarter - , DATE_TRUNC(bookings_source_src_28000.paid_at, year) AS booking__paid_at__year + , DATETIME_TRUNC(bookings_source_src_28000.paid_at, day) AS booking__paid_at__day + , DATETIME_TRUNC(bookings_source_src_28000.paid_at, isoweek) AS booking__paid_at__week + , DATETIME_TRUNC(bookings_source_src_28000.paid_at, month) AS booking__paid_at__month + , DATETIME_TRUNC(bookings_source_src_28000.paid_at, quarter) AS booking__paid_at__quarter + , DATETIME_TRUNC(bookings_source_src_28000.paid_at, year) AS booking__paid_at__year , EXTRACT(year FROM bookings_source_src_28000.paid_at) AS booking__paid_at__extract_year , EXTRACT(quarter FROM bookings_source_src_28000.paid_at) AS booking__paid_at__extract_quarter , EXTRACT(month FROM bookings_source_src_28000.paid_at) AS booking__paid_at__extract_month diff --git a/tests_metricflow/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/BigQuery/test_nested_offsets_with_where_constraint__plan0_optimized.sql b/tests_metricflow/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/BigQuery/test_nested_offsets_with_where_constraint__plan0_optimized.sql index 7246f1d46a..1dc4da26fc 100644 --- a/tests_metricflow/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/BigQuery/test_nested_offsets_with_where_constraint__plan0_optimized.sql +++ b/tests_metricflow/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/BigQuery/test_nested_offsets_with_where_constraint__plan0_optimized.sql @@ -31,7 +31,7 @@ FROM ( -- Read Elements From Semantic Model 'bookings_source' -- Metric Time Dimension 'ds' SELECT - DATE_TRUNC(ds, day) AS metric_time__day + DATETIME_TRUNC(ds, day) AS metric_time__day , 1 AS bookings FROM ***************************.fct_bookings bookings_source_src_28000 ) subq_14 diff --git a/tests_metricflow/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/BigQuery/test_offset_to_grain_metric_filter_and_query_have_different_granularities__plan0.sql b/tests_metricflow/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/BigQuery/test_offset_to_grain_metric_filter_and_query_have_different_granularities__plan0.sql index 82b6ea15fc..2ecd5d35b3 100644 --- a/tests_metricflow/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/BigQuery/test_offset_to_grain_metric_filter_and_query_have_different_granularities__plan0.sql +++ b/tests_metricflow/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/BigQuery/test_offset_to_grain_metric_filter_and_query_have_different_granularities__plan0.sql @@ -33,10 +33,10 @@ FROM ( -- Join to Time Spine Dataset SELECT subq_2.metric_time__day AS metric_time__day - , DATE_TRUNC(subq_2.metric_time__day, isoweek) AS metric_time__week - , DATE_TRUNC(subq_2.metric_time__day, month) AS metric_time__month - , DATE_TRUNC(subq_2.metric_time__day, quarter) AS metric_time__quarter - , DATE_TRUNC(subq_2.metric_time__day, year) AS metric_time__year + , DATETIME_TRUNC(subq_2.metric_time__day, isoweek) AS metric_time__week + , DATETIME_TRUNC(subq_2.metric_time__day, month) AS metric_time__month + , DATETIME_TRUNC(subq_2.metric_time__day, quarter) AS metric_time__quarter + , DATETIME_TRUNC(subq_2.metric_time__day, year) AS metric_time__year , EXTRACT(year FROM subq_2.metric_time__day) AS metric_time__extract_year , EXTRACT(quarter FROM subq_2.metric_time__day) AS metric_time__extract_quarter , EXTRACT(month FROM subq_2.metric_time__day) AS metric_time__extract_month @@ -255,33 +255,33 @@ FROM ( , bookings_source_src_28000.booking_value AS approximate_continuous_booking_value_p99 , bookings_source_src_28000.booking_value AS approximate_discrete_booking_value_p99 , bookings_source_src_28000.is_instant - , DATE_TRUNC(bookings_source_src_28000.ds, day) AS ds__day - , DATE_TRUNC(bookings_source_src_28000.ds, isoweek) AS ds__week - , DATE_TRUNC(bookings_source_src_28000.ds, month) AS ds__month - , DATE_TRUNC(bookings_source_src_28000.ds, quarter) AS ds__quarter - , DATE_TRUNC(bookings_source_src_28000.ds, year) AS ds__year + , DATETIME_TRUNC(bookings_source_src_28000.ds, day) AS ds__day + , DATETIME_TRUNC(bookings_source_src_28000.ds, isoweek) AS ds__week + , DATETIME_TRUNC(bookings_source_src_28000.ds, month) AS ds__month + , DATETIME_TRUNC(bookings_source_src_28000.ds, quarter) AS ds__quarter + , DATETIME_TRUNC(bookings_source_src_28000.ds, year) AS ds__year , EXTRACT(year FROM bookings_source_src_28000.ds) AS ds__extract_year , EXTRACT(quarter FROM bookings_source_src_28000.ds) AS ds__extract_quarter , EXTRACT(month FROM bookings_source_src_28000.ds) AS ds__extract_month , EXTRACT(day FROM bookings_source_src_28000.ds) AS ds__extract_day , IF(EXTRACT(dayofweek FROM bookings_source_src_28000.ds) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_28000.ds) - 1) AS ds__extract_dow , EXTRACT(dayofyear FROM bookings_source_src_28000.ds) AS ds__extract_doy - , DATE_TRUNC(bookings_source_src_28000.ds_partitioned, day) AS ds_partitioned__day - , DATE_TRUNC(bookings_source_src_28000.ds_partitioned, isoweek) AS ds_partitioned__week - , DATE_TRUNC(bookings_source_src_28000.ds_partitioned, month) AS ds_partitioned__month - , DATE_TRUNC(bookings_source_src_28000.ds_partitioned, quarter) AS ds_partitioned__quarter - , DATE_TRUNC(bookings_source_src_28000.ds_partitioned, year) AS ds_partitioned__year + , DATETIME_TRUNC(bookings_source_src_28000.ds_partitioned, day) AS ds_partitioned__day + , DATETIME_TRUNC(bookings_source_src_28000.ds_partitioned, isoweek) AS ds_partitioned__week + , DATETIME_TRUNC(bookings_source_src_28000.ds_partitioned, month) AS ds_partitioned__month + , DATETIME_TRUNC(bookings_source_src_28000.ds_partitioned, quarter) AS ds_partitioned__quarter + , DATETIME_TRUNC(bookings_source_src_28000.ds_partitioned, year) AS ds_partitioned__year , EXTRACT(year FROM bookings_source_src_28000.ds_partitioned) AS ds_partitioned__extract_year , EXTRACT(quarter FROM bookings_source_src_28000.ds_partitioned) AS ds_partitioned__extract_quarter , EXTRACT(month FROM bookings_source_src_28000.ds_partitioned) AS ds_partitioned__extract_month , EXTRACT(day FROM bookings_source_src_28000.ds_partitioned) AS ds_partitioned__extract_day , IF(EXTRACT(dayofweek FROM bookings_source_src_28000.ds_partitioned) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_28000.ds_partitioned) - 1) AS ds_partitioned__extract_dow , EXTRACT(dayofyear FROM bookings_source_src_28000.ds_partitioned) AS ds_partitioned__extract_doy - , DATE_TRUNC(bookings_source_src_28000.paid_at, day) AS paid_at__day - , DATE_TRUNC(bookings_source_src_28000.paid_at, isoweek) AS paid_at__week - , DATE_TRUNC(bookings_source_src_28000.paid_at, month) AS paid_at__month - , DATE_TRUNC(bookings_source_src_28000.paid_at, quarter) AS paid_at__quarter - , DATE_TRUNC(bookings_source_src_28000.paid_at, year) AS paid_at__year + , DATETIME_TRUNC(bookings_source_src_28000.paid_at, day) AS paid_at__day + , DATETIME_TRUNC(bookings_source_src_28000.paid_at, isoweek) AS paid_at__week + , DATETIME_TRUNC(bookings_source_src_28000.paid_at, month) AS paid_at__month + , DATETIME_TRUNC(bookings_source_src_28000.paid_at, quarter) AS paid_at__quarter + , DATETIME_TRUNC(bookings_source_src_28000.paid_at, year) AS paid_at__year , EXTRACT(year FROM bookings_source_src_28000.paid_at) AS paid_at__extract_year , EXTRACT(quarter FROM bookings_source_src_28000.paid_at) AS paid_at__extract_quarter , EXTRACT(month FROM bookings_source_src_28000.paid_at) AS paid_at__extract_month @@ -289,33 +289,33 @@ FROM ( , IF(EXTRACT(dayofweek FROM bookings_source_src_28000.paid_at) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_28000.paid_at) - 1) AS paid_at__extract_dow , EXTRACT(dayofyear FROM bookings_source_src_28000.paid_at) AS paid_at__extract_doy , bookings_source_src_28000.is_instant AS booking__is_instant - , DATE_TRUNC(bookings_source_src_28000.ds, day) AS booking__ds__day - , DATE_TRUNC(bookings_source_src_28000.ds, isoweek) AS booking__ds__week - , DATE_TRUNC(bookings_source_src_28000.ds, month) AS booking__ds__month - , DATE_TRUNC(bookings_source_src_28000.ds, quarter) AS booking__ds__quarter - , DATE_TRUNC(bookings_source_src_28000.ds, year) AS booking__ds__year + , DATETIME_TRUNC(bookings_source_src_28000.ds, day) AS booking__ds__day + , DATETIME_TRUNC(bookings_source_src_28000.ds, isoweek) AS booking__ds__week + , DATETIME_TRUNC(bookings_source_src_28000.ds, month) AS booking__ds__month + , DATETIME_TRUNC(bookings_source_src_28000.ds, quarter) AS booking__ds__quarter + , DATETIME_TRUNC(bookings_source_src_28000.ds, year) AS booking__ds__year , EXTRACT(year FROM bookings_source_src_28000.ds) AS booking__ds__extract_year , EXTRACT(quarter FROM bookings_source_src_28000.ds) AS booking__ds__extract_quarter , EXTRACT(month FROM bookings_source_src_28000.ds) AS booking__ds__extract_month , EXTRACT(day FROM bookings_source_src_28000.ds) AS booking__ds__extract_day , IF(EXTRACT(dayofweek FROM bookings_source_src_28000.ds) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_28000.ds) - 1) AS booking__ds__extract_dow , EXTRACT(dayofyear FROM bookings_source_src_28000.ds) AS booking__ds__extract_doy - , DATE_TRUNC(bookings_source_src_28000.ds_partitioned, day) AS booking__ds_partitioned__day - , DATE_TRUNC(bookings_source_src_28000.ds_partitioned, isoweek) AS booking__ds_partitioned__week - , DATE_TRUNC(bookings_source_src_28000.ds_partitioned, month) AS booking__ds_partitioned__month - , DATE_TRUNC(bookings_source_src_28000.ds_partitioned, quarter) AS booking__ds_partitioned__quarter - , DATE_TRUNC(bookings_source_src_28000.ds_partitioned, year) AS booking__ds_partitioned__year + , DATETIME_TRUNC(bookings_source_src_28000.ds_partitioned, day) AS booking__ds_partitioned__day + , DATETIME_TRUNC(bookings_source_src_28000.ds_partitioned, isoweek) AS booking__ds_partitioned__week + , DATETIME_TRUNC(bookings_source_src_28000.ds_partitioned, month) AS booking__ds_partitioned__month + , DATETIME_TRUNC(bookings_source_src_28000.ds_partitioned, quarter) AS booking__ds_partitioned__quarter + , DATETIME_TRUNC(bookings_source_src_28000.ds_partitioned, year) AS booking__ds_partitioned__year , EXTRACT(year FROM bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__extract_year , EXTRACT(quarter FROM bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__extract_quarter , EXTRACT(month FROM bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__extract_month , EXTRACT(day FROM bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__extract_day , IF(EXTRACT(dayofweek FROM bookings_source_src_28000.ds_partitioned) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_28000.ds_partitioned) - 1) AS booking__ds_partitioned__extract_dow , EXTRACT(dayofyear FROM bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__extract_doy - , DATE_TRUNC(bookings_source_src_28000.paid_at, day) AS booking__paid_at__day - , DATE_TRUNC(bookings_source_src_28000.paid_at, isoweek) AS booking__paid_at__week - , DATE_TRUNC(bookings_source_src_28000.paid_at, month) AS booking__paid_at__month - , DATE_TRUNC(bookings_source_src_28000.paid_at, quarter) AS booking__paid_at__quarter - , DATE_TRUNC(bookings_source_src_28000.paid_at, year) AS booking__paid_at__year + , DATETIME_TRUNC(bookings_source_src_28000.paid_at, day) AS booking__paid_at__day + , DATETIME_TRUNC(bookings_source_src_28000.paid_at, isoweek) AS booking__paid_at__week + , DATETIME_TRUNC(bookings_source_src_28000.paid_at, month) AS booking__paid_at__month + , DATETIME_TRUNC(bookings_source_src_28000.paid_at, quarter) AS booking__paid_at__quarter + , DATETIME_TRUNC(bookings_source_src_28000.paid_at, year) AS booking__paid_at__year , EXTRACT(year FROM bookings_source_src_28000.paid_at) AS booking__paid_at__extract_year , EXTRACT(quarter FROM bookings_source_src_28000.paid_at) AS booking__paid_at__extract_quarter , EXTRACT(month FROM bookings_source_src_28000.paid_at) AS booking__paid_at__extract_month @@ -332,8 +332,8 @@ FROM ( ) subq_0 ) subq_1 ON - DATE_TRUNC(subq_2.metric_time__day, month) = subq_1.metric_time__day - WHERE DATE_TRUNC(subq_2.metric_time__day, month) = subq_2.metric_time__day + DATETIME_TRUNC(subq_2.metric_time__day, month) = subq_1.metric_time__day + WHERE DATETIME_TRUNC(subq_2.metric_time__day, month) = subq_2.metric_time__day ) subq_4 ) subq_5 WHERE metric_time__day = '2020-01-01' diff --git a/tests_metricflow/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/BigQuery/test_offset_to_grain_metric_filter_and_query_have_different_granularities__plan0_optimized.sql b/tests_metricflow/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/BigQuery/test_offset_to_grain_metric_filter_and_query_have_different_granularities__plan0_optimized.sql index d5542de120..cdef6c0de0 100644 --- a/tests_metricflow/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/BigQuery/test_offset_to_grain_metric_filter_and_query_have_different_granularities__plan0_optimized.sql +++ b/tests_metricflow/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/BigQuery/test_offset_to_grain_metric_filter_and_query_have_different_granularities__plan0_optimized.sql @@ -15,20 +15,20 @@ FROM ( -- Pass Only Elements: ['bookings', 'metric_time__month', 'metric_time__day'] SELECT subq_13.ds AS metric_time__day - , DATE_TRUNC(subq_13.ds, month) AS metric_time__month + , DATETIME_TRUNC(subq_13.ds, month) AS metric_time__month , subq_11.bookings AS bookings FROM ***************************.mf_time_spine subq_13 INNER JOIN ( -- Read Elements From Semantic Model 'bookings_source' -- Metric Time Dimension 'ds' SELECT - DATE_TRUNC(ds, day) AS metric_time__day + DATETIME_TRUNC(ds, day) AS metric_time__day , 1 AS bookings FROM ***************************.fct_bookings bookings_source_src_28000 ) subq_11 ON - DATE_TRUNC(subq_13.ds, month) = subq_11.metric_time__day - WHERE DATE_TRUNC(subq_13.ds, month) = subq_13.ds + DATETIME_TRUNC(subq_13.ds, month) = subq_11.metric_time__day + WHERE DATETIME_TRUNC(subq_13.ds, month) = subq_13.ds ) subq_15 WHERE metric_time__day = '2020-01-01' GROUP BY diff --git a/tests_metricflow/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/BigQuery/test_offset_to_grain_metric_multiple_granularities__plan0.sql b/tests_metricflow/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/BigQuery/test_offset_to_grain_metric_multiple_granularities__plan0.sql index 9d7fedf6d3..e9ec5732eb 100644 --- a/tests_metricflow/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/BigQuery/test_offset_to_grain_metric_multiple_granularities__plan0.sql +++ b/tests_metricflow/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/BigQuery/test_offset_to_grain_metric_multiple_granularities__plan0.sql @@ -29,10 +29,10 @@ FROM ( -- Join to Time Spine Dataset SELECT subq_2.metric_time__day AS metric_time__day - , DATE_TRUNC(subq_2.metric_time__day, isoweek) AS metric_time__week - , DATE_TRUNC(subq_2.metric_time__day, month) AS metric_time__month - , DATE_TRUNC(subq_2.metric_time__day, quarter) AS metric_time__quarter - , DATE_TRUNC(subq_2.metric_time__day, year) AS metric_time__year + , DATETIME_TRUNC(subq_2.metric_time__day, isoweek) AS metric_time__week + , DATETIME_TRUNC(subq_2.metric_time__day, month) AS metric_time__month + , DATETIME_TRUNC(subq_2.metric_time__day, quarter) AS metric_time__quarter + , DATETIME_TRUNC(subq_2.metric_time__day, year) AS metric_time__year , EXTRACT(year FROM subq_2.metric_time__day) AS metric_time__extract_year , EXTRACT(quarter FROM subq_2.metric_time__day) AS metric_time__extract_quarter , EXTRACT(month FROM subq_2.metric_time__day) AS metric_time__extract_month @@ -251,33 +251,33 @@ FROM ( , bookings_source_src_28000.booking_value AS approximate_continuous_booking_value_p99 , bookings_source_src_28000.booking_value AS approximate_discrete_booking_value_p99 , bookings_source_src_28000.is_instant - , DATE_TRUNC(bookings_source_src_28000.ds, day) AS ds__day - , DATE_TRUNC(bookings_source_src_28000.ds, isoweek) AS ds__week - , DATE_TRUNC(bookings_source_src_28000.ds, month) AS ds__month - , DATE_TRUNC(bookings_source_src_28000.ds, quarter) AS ds__quarter - , DATE_TRUNC(bookings_source_src_28000.ds, year) AS ds__year + , DATETIME_TRUNC(bookings_source_src_28000.ds, day) AS ds__day + , DATETIME_TRUNC(bookings_source_src_28000.ds, isoweek) AS ds__week + , DATETIME_TRUNC(bookings_source_src_28000.ds, month) AS ds__month + , DATETIME_TRUNC(bookings_source_src_28000.ds, quarter) AS ds__quarter + , DATETIME_TRUNC(bookings_source_src_28000.ds, year) AS ds__year , EXTRACT(year FROM bookings_source_src_28000.ds) AS ds__extract_year , EXTRACT(quarter FROM bookings_source_src_28000.ds) AS ds__extract_quarter , EXTRACT(month FROM bookings_source_src_28000.ds) AS ds__extract_month , EXTRACT(day FROM bookings_source_src_28000.ds) AS ds__extract_day , IF(EXTRACT(dayofweek FROM bookings_source_src_28000.ds) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_28000.ds) - 1) AS ds__extract_dow , EXTRACT(dayofyear FROM bookings_source_src_28000.ds) AS ds__extract_doy - , DATE_TRUNC(bookings_source_src_28000.ds_partitioned, day) AS ds_partitioned__day - , DATE_TRUNC(bookings_source_src_28000.ds_partitioned, isoweek) AS ds_partitioned__week - , DATE_TRUNC(bookings_source_src_28000.ds_partitioned, month) AS ds_partitioned__month - , DATE_TRUNC(bookings_source_src_28000.ds_partitioned, quarter) AS ds_partitioned__quarter - , DATE_TRUNC(bookings_source_src_28000.ds_partitioned, year) AS ds_partitioned__year + , DATETIME_TRUNC(bookings_source_src_28000.ds_partitioned, day) AS ds_partitioned__day + , DATETIME_TRUNC(bookings_source_src_28000.ds_partitioned, isoweek) AS ds_partitioned__week + , DATETIME_TRUNC(bookings_source_src_28000.ds_partitioned, month) AS ds_partitioned__month + , DATETIME_TRUNC(bookings_source_src_28000.ds_partitioned, quarter) AS ds_partitioned__quarter + , DATETIME_TRUNC(bookings_source_src_28000.ds_partitioned, year) AS ds_partitioned__year , EXTRACT(year FROM bookings_source_src_28000.ds_partitioned) AS ds_partitioned__extract_year , EXTRACT(quarter FROM bookings_source_src_28000.ds_partitioned) AS ds_partitioned__extract_quarter , EXTRACT(month FROM bookings_source_src_28000.ds_partitioned) AS ds_partitioned__extract_month , EXTRACT(day FROM bookings_source_src_28000.ds_partitioned) AS ds_partitioned__extract_day , IF(EXTRACT(dayofweek FROM bookings_source_src_28000.ds_partitioned) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_28000.ds_partitioned) - 1) AS ds_partitioned__extract_dow , EXTRACT(dayofyear FROM bookings_source_src_28000.ds_partitioned) AS ds_partitioned__extract_doy - , DATE_TRUNC(bookings_source_src_28000.paid_at, day) AS paid_at__day - , DATE_TRUNC(bookings_source_src_28000.paid_at, isoweek) AS paid_at__week - , DATE_TRUNC(bookings_source_src_28000.paid_at, month) AS paid_at__month - , DATE_TRUNC(bookings_source_src_28000.paid_at, quarter) AS paid_at__quarter - , DATE_TRUNC(bookings_source_src_28000.paid_at, year) AS paid_at__year + , DATETIME_TRUNC(bookings_source_src_28000.paid_at, day) AS paid_at__day + , DATETIME_TRUNC(bookings_source_src_28000.paid_at, isoweek) AS paid_at__week + , DATETIME_TRUNC(bookings_source_src_28000.paid_at, month) AS paid_at__month + , DATETIME_TRUNC(bookings_source_src_28000.paid_at, quarter) AS paid_at__quarter + , DATETIME_TRUNC(bookings_source_src_28000.paid_at, year) AS paid_at__year , EXTRACT(year FROM bookings_source_src_28000.paid_at) AS paid_at__extract_year , EXTRACT(quarter FROM bookings_source_src_28000.paid_at) AS paid_at__extract_quarter , EXTRACT(month FROM bookings_source_src_28000.paid_at) AS paid_at__extract_month @@ -285,33 +285,33 @@ FROM ( , IF(EXTRACT(dayofweek FROM bookings_source_src_28000.paid_at) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_28000.paid_at) - 1) AS paid_at__extract_dow , EXTRACT(dayofyear FROM bookings_source_src_28000.paid_at) AS paid_at__extract_doy , bookings_source_src_28000.is_instant AS booking__is_instant - , DATE_TRUNC(bookings_source_src_28000.ds, day) AS booking__ds__day - , DATE_TRUNC(bookings_source_src_28000.ds, isoweek) AS booking__ds__week - , DATE_TRUNC(bookings_source_src_28000.ds, month) AS booking__ds__month - , DATE_TRUNC(bookings_source_src_28000.ds, quarter) AS booking__ds__quarter - , DATE_TRUNC(bookings_source_src_28000.ds, year) AS booking__ds__year + , DATETIME_TRUNC(bookings_source_src_28000.ds, day) AS booking__ds__day + , DATETIME_TRUNC(bookings_source_src_28000.ds, isoweek) AS booking__ds__week + , DATETIME_TRUNC(bookings_source_src_28000.ds, month) AS booking__ds__month + , DATETIME_TRUNC(bookings_source_src_28000.ds, quarter) AS booking__ds__quarter + , DATETIME_TRUNC(bookings_source_src_28000.ds, year) AS booking__ds__year , EXTRACT(year FROM bookings_source_src_28000.ds) AS booking__ds__extract_year , EXTRACT(quarter FROM bookings_source_src_28000.ds) AS booking__ds__extract_quarter , EXTRACT(month FROM bookings_source_src_28000.ds) AS booking__ds__extract_month , EXTRACT(day FROM bookings_source_src_28000.ds) AS booking__ds__extract_day , IF(EXTRACT(dayofweek FROM bookings_source_src_28000.ds) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_28000.ds) - 1) AS booking__ds__extract_dow , EXTRACT(dayofyear FROM bookings_source_src_28000.ds) AS booking__ds__extract_doy - , DATE_TRUNC(bookings_source_src_28000.ds_partitioned, day) AS booking__ds_partitioned__day - , DATE_TRUNC(bookings_source_src_28000.ds_partitioned, isoweek) AS booking__ds_partitioned__week - , DATE_TRUNC(bookings_source_src_28000.ds_partitioned, month) AS booking__ds_partitioned__month - , DATE_TRUNC(bookings_source_src_28000.ds_partitioned, quarter) AS booking__ds_partitioned__quarter - , DATE_TRUNC(bookings_source_src_28000.ds_partitioned, year) AS booking__ds_partitioned__year + , DATETIME_TRUNC(bookings_source_src_28000.ds_partitioned, day) AS booking__ds_partitioned__day + , DATETIME_TRUNC(bookings_source_src_28000.ds_partitioned, isoweek) AS booking__ds_partitioned__week + , DATETIME_TRUNC(bookings_source_src_28000.ds_partitioned, month) AS booking__ds_partitioned__month + , DATETIME_TRUNC(bookings_source_src_28000.ds_partitioned, quarter) AS booking__ds_partitioned__quarter + , DATETIME_TRUNC(bookings_source_src_28000.ds_partitioned, year) AS booking__ds_partitioned__year , EXTRACT(year FROM bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__extract_year , EXTRACT(quarter FROM bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__extract_quarter , EXTRACT(month FROM bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__extract_month , EXTRACT(day FROM bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__extract_day , IF(EXTRACT(dayofweek FROM bookings_source_src_28000.ds_partitioned) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_28000.ds_partitioned) - 1) AS booking__ds_partitioned__extract_dow , EXTRACT(dayofyear FROM bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__extract_doy - , DATE_TRUNC(bookings_source_src_28000.paid_at, day) AS booking__paid_at__day - , DATE_TRUNC(bookings_source_src_28000.paid_at, isoweek) AS booking__paid_at__week - , DATE_TRUNC(bookings_source_src_28000.paid_at, month) AS booking__paid_at__month - , DATE_TRUNC(bookings_source_src_28000.paid_at, quarter) AS booking__paid_at__quarter - , DATE_TRUNC(bookings_source_src_28000.paid_at, year) AS booking__paid_at__year + , DATETIME_TRUNC(bookings_source_src_28000.paid_at, day) AS booking__paid_at__day + , DATETIME_TRUNC(bookings_source_src_28000.paid_at, isoweek) AS booking__paid_at__week + , DATETIME_TRUNC(bookings_source_src_28000.paid_at, month) AS booking__paid_at__month + , DATETIME_TRUNC(bookings_source_src_28000.paid_at, quarter) AS booking__paid_at__quarter + , DATETIME_TRUNC(bookings_source_src_28000.paid_at, year) AS booking__paid_at__year , EXTRACT(year FROM bookings_source_src_28000.paid_at) AS booking__paid_at__extract_year , EXTRACT(quarter FROM bookings_source_src_28000.paid_at) AS booking__paid_at__extract_quarter , EXTRACT(month FROM bookings_source_src_28000.paid_at) AS booking__paid_at__extract_month @@ -328,7 +328,7 @@ FROM ( ) subq_0 ) subq_1 ON - DATE_TRUNC(subq_2.metric_time__day, month) = subq_1.metric_time__day + DATETIME_TRUNC(subq_2.metric_time__day, month) = subq_1.metric_time__day ) subq_4 ) subq_5 GROUP BY diff --git a/tests_metricflow/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/BigQuery/test_offset_to_grain_metric_multiple_granularities__plan0_optimized.sql b/tests_metricflow/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/BigQuery/test_offset_to_grain_metric_multiple_granularities__plan0_optimized.sql index ba2d0ffcfc..de07009dad 100644 --- a/tests_metricflow/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/BigQuery/test_offset_to_grain_metric_multiple_granularities__plan0_optimized.sql +++ b/tests_metricflow/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/BigQuery/test_offset_to_grain_metric_multiple_granularities__plan0_optimized.sql @@ -11,20 +11,20 @@ FROM ( -- Compute Metrics via Expressions SELECT subq_11.ds AS metric_time__day - , DATE_TRUNC(subq_11.ds, month) AS metric_time__month - , DATE_TRUNC(subq_11.ds, year) AS metric_time__year + , DATETIME_TRUNC(subq_11.ds, month) AS metric_time__month + , DATETIME_TRUNC(subq_11.ds, year) AS metric_time__year , SUM(subq_9.bookings) AS bookings_start_of_month FROM ***************************.mf_time_spine subq_11 INNER JOIN ( -- Read Elements From Semantic Model 'bookings_source' -- Metric Time Dimension 'ds' SELECT - DATE_TRUNC(ds, day) AS metric_time__day + DATETIME_TRUNC(ds, day) AS metric_time__day , 1 AS bookings FROM ***************************.fct_bookings bookings_source_src_28000 ) subq_9 ON - DATE_TRUNC(subq_11.ds, month) = subq_9.metric_time__day + DATETIME_TRUNC(subq_11.ds, month) = subq_9.metric_time__day GROUP BY metric_time__day , metric_time__month diff --git a/tests_metricflow/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/BigQuery/test_offset_to_grain_with_agg_time_dim__plan0.sql b/tests_metricflow/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/BigQuery/test_offset_to_grain_with_agg_time_dim__plan0.sql index 25d845a9c4..98c2aaf089 100644 --- a/tests_metricflow/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/BigQuery/test_offset_to_grain_with_agg_time_dim__plan0.sql +++ b/tests_metricflow/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/BigQuery/test_offset_to_grain_with_agg_time_dim__plan0.sql @@ -142,33 +142,33 @@ FROM ( , bookings_source_src_28000.booking_value AS approximate_continuous_booking_value_p99 , bookings_source_src_28000.booking_value AS approximate_discrete_booking_value_p99 , bookings_source_src_28000.is_instant - , DATE_TRUNC(bookings_source_src_28000.ds, day) AS ds__day - , DATE_TRUNC(bookings_source_src_28000.ds, isoweek) AS ds__week - , DATE_TRUNC(bookings_source_src_28000.ds, month) AS ds__month - , DATE_TRUNC(bookings_source_src_28000.ds, quarter) AS ds__quarter - , DATE_TRUNC(bookings_source_src_28000.ds, year) AS ds__year + , DATETIME_TRUNC(bookings_source_src_28000.ds, day) AS ds__day + , DATETIME_TRUNC(bookings_source_src_28000.ds, isoweek) AS ds__week + , DATETIME_TRUNC(bookings_source_src_28000.ds, month) AS ds__month + , DATETIME_TRUNC(bookings_source_src_28000.ds, quarter) AS ds__quarter + , DATETIME_TRUNC(bookings_source_src_28000.ds, year) AS ds__year , EXTRACT(year FROM bookings_source_src_28000.ds) AS ds__extract_year , EXTRACT(quarter FROM bookings_source_src_28000.ds) AS ds__extract_quarter , EXTRACT(month FROM bookings_source_src_28000.ds) AS ds__extract_month , EXTRACT(day FROM bookings_source_src_28000.ds) AS ds__extract_day , IF(EXTRACT(dayofweek FROM bookings_source_src_28000.ds) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_28000.ds) - 1) AS ds__extract_dow , EXTRACT(dayofyear FROM bookings_source_src_28000.ds) AS ds__extract_doy - , DATE_TRUNC(bookings_source_src_28000.ds_partitioned, day) AS ds_partitioned__day - , DATE_TRUNC(bookings_source_src_28000.ds_partitioned, isoweek) AS ds_partitioned__week - , DATE_TRUNC(bookings_source_src_28000.ds_partitioned, month) AS ds_partitioned__month - , DATE_TRUNC(bookings_source_src_28000.ds_partitioned, quarter) AS ds_partitioned__quarter - , DATE_TRUNC(bookings_source_src_28000.ds_partitioned, year) AS ds_partitioned__year + , DATETIME_TRUNC(bookings_source_src_28000.ds_partitioned, day) AS ds_partitioned__day + , DATETIME_TRUNC(bookings_source_src_28000.ds_partitioned, isoweek) AS ds_partitioned__week + , DATETIME_TRUNC(bookings_source_src_28000.ds_partitioned, month) AS ds_partitioned__month + , DATETIME_TRUNC(bookings_source_src_28000.ds_partitioned, quarter) AS ds_partitioned__quarter + , DATETIME_TRUNC(bookings_source_src_28000.ds_partitioned, year) AS ds_partitioned__year , EXTRACT(year FROM bookings_source_src_28000.ds_partitioned) AS ds_partitioned__extract_year , EXTRACT(quarter FROM bookings_source_src_28000.ds_partitioned) AS ds_partitioned__extract_quarter , EXTRACT(month FROM bookings_source_src_28000.ds_partitioned) AS ds_partitioned__extract_month , EXTRACT(day FROM bookings_source_src_28000.ds_partitioned) AS ds_partitioned__extract_day , IF(EXTRACT(dayofweek FROM bookings_source_src_28000.ds_partitioned) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_28000.ds_partitioned) - 1) AS ds_partitioned__extract_dow , EXTRACT(dayofyear FROM bookings_source_src_28000.ds_partitioned) AS ds_partitioned__extract_doy - , DATE_TRUNC(bookings_source_src_28000.paid_at, day) AS paid_at__day - , DATE_TRUNC(bookings_source_src_28000.paid_at, isoweek) AS paid_at__week - , DATE_TRUNC(bookings_source_src_28000.paid_at, month) AS paid_at__month - , DATE_TRUNC(bookings_source_src_28000.paid_at, quarter) AS paid_at__quarter - , DATE_TRUNC(bookings_source_src_28000.paid_at, year) AS paid_at__year + , DATETIME_TRUNC(bookings_source_src_28000.paid_at, day) AS paid_at__day + , DATETIME_TRUNC(bookings_source_src_28000.paid_at, isoweek) AS paid_at__week + , DATETIME_TRUNC(bookings_source_src_28000.paid_at, month) AS paid_at__month + , DATETIME_TRUNC(bookings_source_src_28000.paid_at, quarter) AS paid_at__quarter + , DATETIME_TRUNC(bookings_source_src_28000.paid_at, year) AS paid_at__year , EXTRACT(year FROM bookings_source_src_28000.paid_at) AS paid_at__extract_year , EXTRACT(quarter FROM bookings_source_src_28000.paid_at) AS paid_at__extract_quarter , EXTRACT(month FROM bookings_source_src_28000.paid_at) AS paid_at__extract_month @@ -176,33 +176,33 @@ FROM ( , IF(EXTRACT(dayofweek FROM bookings_source_src_28000.paid_at) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_28000.paid_at) - 1) AS paid_at__extract_dow , EXTRACT(dayofyear FROM bookings_source_src_28000.paid_at) AS paid_at__extract_doy , bookings_source_src_28000.is_instant AS booking__is_instant - , DATE_TRUNC(bookings_source_src_28000.ds, day) AS booking__ds__day - , DATE_TRUNC(bookings_source_src_28000.ds, isoweek) AS booking__ds__week - , DATE_TRUNC(bookings_source_src_28000.ds, month) AS booking__ds__month - , DATE_TRUNC(bookings_source_src_28000.ds, quarter) AS booking__ds__quarter - , DATE_TRUNC(bookings_source_src_28000.ds, year) AS booking__ds__year + , DATETIME_TRUNC(bookings_source_src_28000.ds, day) AS booking__ds__day + , DATETIME_TRUNC(bookings_source_src_28000.ds, isoweek) AS booking__ds__week + , DATETIME_TRUNC(bookings_source_src_28000.ds, month) AS booking__ds__month + , DATETIME_TRUNC(bookings_source_src_28000.ds, quarter) AS booking__ds__quarter + , DATETIME_TRUNC(bookings_source_src_28000.ds, year) AS booking__ds__year , EXTRACT(year FROM bookings_source_src_28000.ds) AS booking__ds__extract_year , EXTRACT(quarter FROM bookings_source_src_28000.ds) AS booking__ds__extract_quarter , EXTRACT(month FROM bookings_source_src_28000.ds) AS booking__ds__extract_month , EXTRACT(day FROM bookings_source_src_28000.ds) AS booking__ds__extract_day , IF(EXTRACT(dayofweek FROM bookings_source_src_28000.ds) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_28000.ds) - 1) AS booking__ds__extract_dow , EXTRACT(dayofyear FROM bookings_source_src_28000.ds) AS booking__ds__extract_doy - , DATE_TRUNC(bookings_source_src_28000.ds_partitioned, day) AS booking__ds_partitioned__day - , DATE_TRUNC(bookings_source_src_28000.ds_partitioned, isoweek) AS booking__ds_partitioned__week - , DATE_TRUNC(bookings_source_src_28000.ds_partitioned, month) AS booking__ds_partitioned__month - , DATE_TRUNC(bookings_source_src_28000.ds_partitioned, quarter) AS booking__ds_partitioned__quarter - , DATE_TRUNC(bookings_source_src_28000.ds_partitioned, year) AS booking__ds_partitioned__year + , DATETIME_TRUNC(bookings_source_src_28000.ds_partitioned, day) AS booking__ds_partitioned__day + , DATETIME_TRUNC(bookings_source_src_28000.ds_partitioned, isoweek) AS booking__ds_partitioned__week + , DATETIME_TRUNC(bookings_source_src_28000.ds_partitioned, month) AS booking__ds_partitioned__month + , DATETIME_TRUNC(bookings_source_src_28000.ds_partitioned, quarter) AS booking__ds_partitioned__quarter + , DATETIME_TRUNC(bookings_source_src_28000.ds_partitioned, year) AS booking__ds_partitioned__year , EXTRACT(year FROM bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__extract_year , EXTRACT(quarter FROM bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__extract_quarter , EXTRACT(month FROM bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__extract_month , EXTRACT(day FROM bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__extract_day , IF(EXTRACT(dayofweek FROM bookings_source_src_28000.ds_partitioned) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_28000.ds_partitioned) - 1) AS booking__ds_partitioned__extract_dow , EXTRACT(dayofyear FROM bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__extract_doy - , DATE_TRUNC(bookings_source_src_28000.paid_at, day) AS booking__paid_at__day - , DATE_TRUNC(bookings_source_src_28000.paid_at, isoweek) AS booking__paid_at__week - , DATE_TRUNC(bookings_source_src_28000.paid_at, month) AS booking__paid_at__month - , DATE_TRUNC(bookings_source_src_28000.paid_at, quarter) AS booking__paid_at__quarter - , DATE_TRUNC(bookings_source_src_28000.paid_at, year) AS booking__paid_at__year + , DATETIME_TRUNC(bookings_source_src_28000.paid_at, day) AS booking__paid_at__day + , DATETIME_TRUNC(bookings_source_src_28000.paid_at, isoweek) AS booking__paid_at__week + , DATETIME_TRUNC(bookings_source_src_28000.paid_at, month) AS booking__paid_at__month + , DATETIME_TRUNC(bookings_source_src_28000.paid_at, quarter) AS booking__paid_at__quarter + , DATETIME_TRUNC(bookings_source_src_28000.paid_at, year) AS booking__paid_at__year , EXTRACT(year FROM bookings_source_src_28000.paid_at) AS booking__paid_at__extract_year , EXTRACT(quarter FROM bookings_source_src_28000.paid_at) AS booking__paid_at__extract_quarter , EXTRACT(month FROM bookings_source_src_28000.paid_at) AS booking__paid_at__extract_month @@ -242,10 +242,10 @@ FROM ( -- Join to Time Spine Dataset SELECT subq_7.booking__ds__day AS booking__ds__day - , DATE_TRUNC(subq_7.booking__ds__day, isoweek) AS booking__ds__week - , DATE_TRUNC(subq_7.booking__ds__day, month) AS booking__ds__month - , DATE_TRUNC(subq_7.booking__ds__day, quarter) AS booking__ds__quarter - , DATE_TRUNC(subq_7.booking__ds__day, year) AS booking__ds__year + , DATETIME_TRUNC(subq_7.booking__ds__day, isoweek) AS booking__ds__week + , DATETIME_TRUNC(subq_7.booking__ds__day, month) AS booking__ds__month + , DATETIME_TRUNC(subq_7.booking__ds__day, quarter) AS booking__ds__quarter + , DATETIME_TRUNC(subq_7.booking__ds__day, year) AS booking__ds__year , EXTRACT(year FROM subq_7.booking__ds__day) AS booking__ds__extract_year , EXTRACT(quarter FROM subq_7.booking__ds__day) AS booking__ds__extract_quarter , EXTRACT(month FROM subq_7.booking__ds__day) AS booking__ds__extract_month @@ -464,33 +464,33 @@ FROM ( , bookings_source_src_28000.booking_value AS approximate_continuous_booking_value_p99 , bookings_source_src_28000.booking_value AS approximate_discrete_booking_value_p99 , bookings_source_src_28000.is_instant - , DATE_TRUNC(bookings_source_src_28000.ds, day) AS ds__day - , DATE_TRUNC(bookings_source_src_28000.ds, isoweek) AS ds__week - , DATE_TRUNC(bookings_source_src_28000.ds, month) AS ds__month - , DATE_TRUNC(bookings_source_src_28000.ds, quarter) AS ds__quarter - , DATE_TRUNC(bookings_source_src_28000.ds, year) AS ds__year + , DATETIME_TRUNC(bookings_source_src_28000.ds, day) AS ds__day + , DATETIME_TRUNC(bookings_source_src_28000.ds, isoweek) AS ds__week + , DATETIME_TRUNC(bookings_source_src_28000.ds, month) AS ds__month + , DATETIME_TRUNC(bookings_source_src_28000.ds, quarter) AS ds__quarter + , DATETIME_TRUNC(bookings_source_src_28000.ds, year) AS ds__year , EXTRACT(year FROM bookings_source_src_28000.ds) AS ds__extract_year , EXTRACT(quarter FROM bookings_source_src_28000.ds) AS ds__extract_quarter , EXTRACT(month FROM bookings_source_src_28000.ds) AS ds__extract_month , EXTRACT(day FROM bookings_source_src_28000.ds) AS ds__extract_day , IF(EXTRACT(dayofweek FROM bookings_source_src_28000.ds) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_28000.ds) - 1) AS ds__extract_dow , EXTRACT(dayofyear FROM bookings_source_src_28000.ds) AS ds__extract_doy - , DATE_TRUNC(bookings_source_src_28000.ds_partitioned, day) AS ds_partitioned__day - , DATE_TRUNC(bookings_source_src_28000.ds_partitioned, isoweek) AS ds_partitioned__week - , DATE_TRUNC(bookings_source_src_28000.ds_partitioned, month) AS ds_partitioned__month - , DATE_TRUNC(bookings_source_src_28000.ds_partitioned, quarter) AS ds_partitioned__quarter - , DATE_TRUNC(bookings_source_src_28000.ds_partitioned, year) AS ds_partitioned__year + , DATETIME_TRUNC(bookings_source_src_28000.ds_partitioned, day) AS ds_partitioned__day + , DATETIME_TRUNC(bookings_source_src_28000.ds_partitioned, isoweek) AS ds_partitioned__week + , DATETIME_TRUNC(bookings_source_src_28000.ds_partitioned, month) AS ds_partitioned__month + , DATETIME_TRUNC(bookings_source_src_28000.ds_partitioned, quarter) AS ds_partitioned__quarter + , DATETIME_TRUNC(bookings_source_src_28000.ds_partitioned, year) AS ds_partitioned__year , EXTRACT(year FROM bookings_source_src_28000.ds_partitioned) AS ds_partitioned__extract_year , EXTRACT(quarter FROM bookings_source_src_28000.ds_partitioned) AS ds_partitioned__extract_quarter , EXTRACT(month FROM bookings_source_src_28000.ds_partitioned) AS ds_partitioned__extract_month , EXTRACT(day FROM bookings_source_src_28000.ds_partitioned) AS ds_partitioned__extract_day , IF(EXTRACT(dayofweek FROM bookings_source_src_28000.ds_partitioned) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_28000.ds_partitioned) - 1) AS ds_partitioned__extract_dow , EXTRACT(dayofyear FROM bookings_source_src_28000.ds_partitioned) AS ds_partitioned__extract_doy - , DATE_TRUNC(bookings_source_src_28000.paid_at, day) AS paid_at__day - , DATE_TRUNC(bookings_source_src_28000.paid_at, isoweek) AS paid_at__week - , DATE_TRUNC(bookings_source_src_28000.paid_at, month) AS paid_at__month - , DATE_TRUNC(bookings_source_src_28000.paid_at, quarter) AS paid_at__quarter - , DATE_TRUNC(bookings_source_src_28000.paid_at, year) AS paid_at__year + , DATETIME_TRUNC(bookings_source_src_28000.paid_at, day) AS paid_at__day + , DATETIME_TRUNC(bookings_source_src_28000.paid_at, isoweek) AS paid_at__week + , DATETIME_TRUNC(bookings_source_src_28000.paid_at, month) AS paid_at__month + , DATETIME_TRUNC(bookings_source_src_28000.paid_at, quarter) AS paid_at__quarter + , DATETIME_TRUNC(bookings_source_src_28000.paid_at, year) AS paid_at__year , EXTRACT(year FROM bookings_source_src_28000.paid_at) AS paid_at__extract_year , EXTRACT(quarter FROM bookings_source_src_28000.paid_at) AS paid_at__extract_quarter , EXTRACT(month FROM bookings_source_src_28000.paid_at) AS paid_at__extract_month @@ -498,33 +498,33 @@ FROM ( , IF(EXTRACT(dayofweek FROM bookings_source_src_28000.paid_at) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_28000.paid_at) - 1) AS paid_at__extract_dow , EXTRACT(dayofyear FROM bookings_source_src_28000.paid_at) AS paid_at__extract_doy , bookings_source_src_28000.is_instant AS booking__is_instant - , DATE_TRUNC(bookings_source_src_28000.ds, day) AS booking__ds__day - , DATE_TRUNC(bookings_source_src_28000.ds, isoweek) AS booking__ds__week - , DATE_TRUNC(bookings_source_src_28000.ds, month) AS booking__ds__month - , DATE_TRUNC(bookings_source_src_28000.ds, quarter) AS booking__ds__quarter - , DATE_TRUNC(bookings_source_src_28000.ds, year) AS booking__ds__year + , DATETIME_TRUNC(bookings_source_src_28000.ds, day) AS booking__ds__day + , DATETIME_TRUNC(bookings_source_src_28000.ds, isoweek) AS booking__ds__week + , DATETIME_TRUNC(bookings_source_src_28000.ds, month) AS booking__ds__month + , DATETIME_TRUNC(bookings_source_src_28000.ds, quarter) AS booking__ds__quarter + , DATETIME_TRUNC(bookings_source_src_28000.ds, year) AS booking__ds__year , EXTRACT(year FROM bookings_source_src_28000.ds) AS booking__ds__extract_year , EXTRACT(quarter FROM bookings_source_src_28000.ds) AS booking__ds__extract_quarter , EXTRACT(month FROM bookings_source_src_28000.ds) AS booking__ds__extract_month , EXTRACT(day FROM bookings_source_src_28000.ds) AS booking__ds__extract_day , IF(EXTRACT(dayofweek FROM bookings_source_src_28000.ds) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_28000.ds) - 1) AS booking__ds__extract_dow , EXTRACT(dayofyear FROM bookings_source_src_28000.ds) AS booking__ds__extract_doy - , DATE_TRUNC(bookings_source_src_28000.ds_partitioned, day) AS booking__ds_partitioned__day - , DATE_TRUNC(bookings_source_src_28000.ds_partitioned, isoweek) AS booking__ds_partitioned__week - , DATE_TRUNC(bookings_source_src_28000.ds_partitioned, month) AS booking__ds_partitioned__month - , DATE_TRUNC(bookings_source_src_28000.ds_partitioned, quarter) AS booking__ds_partitioned__quarter - , DATE_TRUNC(bookings_source_src_28000.ds_partitioned, year) AS booking__ds_partitioned__year + , DATETIME_TRUNC(bookings_source_src_28000.ds_partitioned, day) AS booking__ds_partitioned__day + , DATETIME_TRUNC(bookings_source_src_28000.ds_partitioned, isoweek) AS booking__ds_partitioned__week + , DATETIME_TRUNC(bookings_source_src_28000.ds_partitioned, month) AS booking__ds_partitioned__month + , DATETIME_TRUNC(bookings_source_src_28000.ds_partitioned, quarter) AS booking__ds_partitioned__quarter + , DATETIME_TRUNC(bookings_source_src_28000.ds_partitioned, year) AS booking__ds_partitioned__year , EXTRACT(year FROM bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__extract_year , EXTRACT(quarter FROM bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__extract_quarter , EXTRACT(month FROM bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__extract_month , EXTRACT(day FROM bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__extract_day , IF(EXTRACT(dayofweek FROM bookings_source_src_28000.ds_partitioned) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_28000.ds_partitioned) - 1) AS booking__ds_partitioned__extract_dow , EXTRACT(dayofyear FROM bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__extract_doy - , DATE_TRUNC(bookings_source_src_28000.paid_at, day) AS booking__paid_at__day - , DATE_TRUNC(bookings_source_src_28000.paid_at, isoweek) AS booking__paid_at__week - , DATE_TRUNC(bookings_source_src_28000.paid_at, month) AS booking__paid_at__month - , DATE_TRUNC(bookings_source_src_28000.paid_at, quarter) AS booking__paid_at__quarter - , DATE_TRUNC(bookings_source_src_28000.paid_at, year) AS booking__paid_at__year + , DATETIME_TRUNC(bookings_source_src_28000.paid_at, day) AS booking__paid_at__day + , DATETIME_TRUNC(bookings_source_src_28000.paid_at, isoweek) AS booking__paid_at__week + , DATETIME_TRUNC(bookings_source_src_28000.paid_at, month) AS booking__paid_at__month + , DATETIME_TRUNC(bookings_source_src_28000.paid_at, quarter) AS booking__paid_at__quarter + , DATETIME_TRUNC(bookings_source_src_28000.paid_at, year) AS booking__paid_at__year , EXTRACT(year FROM bookings_source_src_28000.paid_at) AS booking__paid_at__extract_year , EXTRACT(quarter FROM bookings_source_src_28000.paid_at) AS booking__paid_at__extract_quarter , EXTRACT(month FROM bookings_source_src_28000.paid_at) AS booking__paid_at__extract_month @@ -541,7 +541,7 @@ FROM ( ) subq_5 ) subq_6 ON - DATE_TRUNC(subq_7.booking__ds__day, month) = subq_6.booking__ds__day + DATETIME_TRUNC(subq_7.booking__ds__day, month) = subq_6.booking__ds__day ) subq_9 ) subq_10 GROUP BY diff --git a/tests_metricflow/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/BigQuery/test_offset_to_grain_with_agg_time_dim__plan0_optimized.sql b/tests_metricflow/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/BigQuery/test_offset_to_grain_with_agg_time_dim__plan0_optimized.sql index fa4f6371d9..158bfbdfa2 100644 --- a/tests_metricflow/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/BigQuery/test_offset_to_grain_with_agg_time_dim__plan0_optimized.sql +++ b/tests_metricflow/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/BigQuery/test_offset_to_grain_with_agg_time_dim__plan0_optimized.sql @@ -19,7 +19,7 @@ FROM ( -- Metric Time Dimension 'ds' -- Pass Only Elements: ['bookings', 'booking__ds__day'] SELECT - DATE_TRUNC(ds, day) AS booking__ds__day + DATETIME_TRUNC(ds, day) AS booking__ds__day , 1 AS bookings FROM ***************************.fct_bookings bookings_source_src_28000 ) subq_16 @@ -39,12 +39,12 @@ FROM ( -- Read Elements From Semantic Model 'bookings_source' -- Metric Time Dimension 'ds' SELECT - DATE_TRUNC(ds, day) AS booking__ds__day + DATETIME_TRUNC(ds, day) AS booking__ds__day , 1 AS bookings FROM ***************************.fct_bookings bookings_source_src_28000 ) subq_20 ON - DATE_TRUNC(subq_22.ds, month) = subq_20.booking__ds__day + DATETIME_TRUNC(subq_22.ds, month) = subq_20.booking__ds__day GROUP BY booking__ds__day ) subq_26 diff --git a/tests_metricflow/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/BigQuery/test_offset_window_metric_filter_and_query_have_different_granularities__plan0.sql b/tests_metricflow/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/BigQuery/test_offset_window_metric_filter_and_query_have_different_granularities__plan0.sql index a618d1766f..663ef82bce 100644 --- a/tests_metricflow/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/BigQuery/test_offset_window_metric_filter_and_query_have_different_granularities__plan0.sql +++ b/tests_metricflow/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/BigQuery/test_offset_window_metric_filter_and_query_have_different_granularities__plan0.sql @@ -39,10 +39,10 @@ FROM ( -- Join to Time Spine Dataset SELECT subq_2.metric_time__day AS metric_time__day - , DATE_TRUNC(subq_2.metric_time__day, isoweek) AS metric_time__week - , DATE_TRUNC(subq_2.metric_time__day, month) AS metric_time__month - , DATE_TRUNC(subq_2.metric_time__day, quarter) AS metric_time__quarter - , DATE_TRUNC(subq_2.metric_time__day, year) AS metric_time__year + , DATETIME_TRUNC(subq_2.metric_time__day, isoweek) AS metric_time__week + , DATETIME_TRUNC(subq_2.metric_time__day, month) AS metric_time__month + , DATETIME_TRUNC(subq_2.metric_time__day, quarter) AS metric_time__quarter + , DATETIME_TRUNC(subq_2.metric_time__day, year) AS metric_time__year , EXTRACT(year FROM subq_2.metric_time__day) AS metric_time__extract_year , EXTRACT(quarter FROM subq_2.metric_time__day) AS metric_time__extract_quarter , EXTRACT(month FROM subq_2.metric_time__day) AS metric_time__extract_month @@ -261,33 +261,33 @@ FROM ( , bookings_source_src_28000.booking_value AS approximate_continuous_booking_value_p99 , bookings_source_src_28000.booking_value AS approximate_discrete_booking_value_p99 , bookings_source_src_28000.is_instant - , DATE_TRUNC(bookings_source_src_28000.ds, day) AS ds__day - , DATE_TRUNC(bookings_source_src_28000.ds, isoweek) AS ds__week - , DATE_TRUNC(bookings_source_src_28000.ds, month) AS ds__month - , DATE_TRUNC(bookings_source_src_28000.ds, quarter) AS ds__quarter - , DATE_TRUNC(bookings_source_src_28000.ds, year) AS ds__year + , DATETIME_TRUNC(bookings_source_src_28000.ds, day) AS ds__day + , DATETIME_TRUNC(bookings_source_src_28000.ds, isoweek) AS ds__week + , DATETIME_TRUNC(bookings_source_src_28000.ds, month) AS ds__month + , DATETIME_TRUNC(bookings_source_src_28000.ds, quarter) AS ds__quarter + , DATETIME_TRUNC(bookings_source_src_28000.ds, year) AS ds__year , EXTRACT(year FROM bookings_source_src_28000.ds) AS ds__extract_year , EXTRACT(quarter FROM bookings_source_src_28000.ds) AS ds__extract_quarter , EXTRACT(month FROM bookings_source_src_28000.ds) AS ds__extract_month , EXTRACT(day FROM bookings_source_src_28000.ds) AS ds__extract_day , IF(EXTRACT(dayofweek FROM bookings_source_src_28000.ds) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_28000.ds) - 1) AS ds__extract_dow , EXTRACT(dayofyear FROM bookings_source_src_28000.ds) AS ds__extract_doy - , DATE_TRUNC(bookings_source_src_28000.ds_partitioned, day) AS ds_partitioned__day - , DATE_TRUNC(bookings_source_src_28000.ds_partitioned, isoweek) AS ds_partitioned__week - , DATE_TRUNC(bookings_source_src_28000.ds_partitioned, month) AS ds_partitioned__month - , DATE_TRUNC(bookings_source_src_28000.ds_partitioned, quarter) AS ds_partitioned__quarter - , DATE_TRUNC(bookings_source_src_28000.ds_partitioned, year) AS ds_partitioned__year + , DATETIME_TRUNC(bookings_source_src_28000.ds_partitioned, day) AS ds_partitioned__day + , DATETIME_TRUNC(bookings_source_src_28000.ds_partitioned, isoweek) AS ds_partitioned__week + , DATETIME_TRUNC(bookings_source_src_28000.ds_partitioned, month) AS ds_partitioned__month + , DATETIME_TRUNC(bookings_source_src_28000.ds_partitioned, quarter) AS ds_partitioned__quarter + , DATETIME_TRUNC(bookings_source_src_28000.ds_partitioned, year) AS ds_partitioned__year , EXTRACT(year FROM bookings_source_src_28000.ds_partitioned) AS ds_partitioned__extract_year , EXTRACT(quarter FROM bookings_source_src_28000.ds_partitioned) AS ds_partitioned__extract_quarter , EXTRACT(month FROM bookings_source_src_28000.ds_partitioned) AS ds_partitioned__extract_month , EXTRACT(day FROM bookings_source_src_28000.ds_partitioned) AS ds_partitioned__extract_day , IF(EXTRACT(dayofweek FROM bookings_source_src_28000.ds_partitioned) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_28000.ds_partitioned) - 1) AS ds_partitioned__extract_dow , EXTRACT(dayofyear FROM bookings_source_src_28000.ds_partitioned) AS ds_partitioned__extract_doy - , DATE_TRUNC(bookings_source_src_28000.paid_at, day) AS paid_at__day - , DATE_TRUNC(bookings_source_src_28000.paid_at, isoweek) AS paid_at__week - , DATE_TRUNC(bookings_source_src_28000.paid_at, month) AS paid_at__month - , DATE_TRUNC(bookings_source_src_28000.paid_at, quarter) AS paid_at__quarter - , DATE_TRUNC(bookings_source_src_28000.paid_at, year) AS paid_at__year + , DATETIME_TRUNC(bookings_source_src_28000.paid_at, day) AS paid_at__day + , DATETIME_TRUNC(bookings_source_src_28000.paid_at, isoweek) AS paid_at__week + , DATETIME_TRUNC(bookings_source_src_28000.paid_at, month) AS paid_at__month + , DATETIME_TRUNC(bookings_source_src_28000.paid_at, quarter) AS paid_at__quarter + , DATETIME_TRUNC(bookings_source_src_28000.paid_at, year) AS paid_at__year , EXTRACT(year FROM bookings_source_src_28000.paid_at) AS paid_at__extract_year , EXTRACT(quarter FROM bookings_source_src_28000.paid_at) AS paid_at__extract_quarter , EXTRACT(month FROM bookings_source_src_28000.paid_at) AS paid_at__extract_month @@ -295,33 +295,33 @@ FROM ( , IF(EXTRACT(dayofweek FROM bookings_source_src_28000.paid_at) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_28000.paid_at) - 1) AS paid_at__extract_dow , EXTRACT(dayofyear FROM bookings_source_src_28000.paid_at) AS paid_at__extract_doy , bookings_source_src_28000.is_instant AS booking__is_instant - , DATE_TRUNC(bookings_source_src_28000.ds, day) AS booking__ds__day - , DATE_TRUNC(bookings_source_src_28000.ds, isoweek) AS booking__ds__week - , DATE_TRUNC(bookings_source_src_28000.ds, month) AS booking__ds__month - , DATE_TRUNC(bookings_source_src_28000.ds, quarter) AS booking__ds__quarter - , DATE_TRUNC(bookings_source_src_28000.ds, year) AS booking__ds__year + , DATETIME_TRUNC(bookings_source_src_28000.ds, day) AS booking__ds__day + , DATETIME_TRUNC(bookings_source_src_28000.ds, isoweek) AS booking__ds__week + , DATETIME_TRUNC(bookings_source_src_28000.ds, month) AS booking__ds__month + , DATETIME_TRUNC(bookings_source_src_28000.ds, quarter) AS booking__ds__quarter + , DATETIME_TRUNC(bookings_source_src_28000.ds, year) AS booking__ds__year , EXTRACT(year FROM bookings_source_src_28000.ds) AS booking__ds__extract_year , EXTRACT(quarter FROM bookings_source_src_28000.ds) AS booking__ds__extract_quarter , EXTRACT(month FROM bookings_source_src_28000.ds) AS booking__ds__extract_month , EXTRACT(day FROM bookings_source_src_28000.ds) AS booking__ds__extract_day , IF(EXTRACT(dayofweek FROM bookings_source_src_28000.ds) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_28000.ds) - 1) AS booking__ds__extract_dow , EXTRACT(dayofyear FROM bookings_source_src_28000.ds) AS booking__ds__extract_doy - , DATE_TRUNC(bookings_source_src_28000.ds_partitioned, day) AS booking__ds_partitioned__day - , DATE_TRUNC(bookings_source_src_28000.ds_partitioned, isoweek) AS booking__ds_partitioned__week - , DATE_TRUNC(bookings_source_src_28000.ds_partitioned, month) AS booking__ds_partitioned__month - , DATE_TRUNC(bookings_source_src_28000.ds_partitioned, quarter) AS booking__ds_partitioned__quarter - , DATE_TRUNC(bookings_source_src_28000.ds_partitioned, year) AS booking__ds_partitioned__year + , DATETIME_TRUNC(bookings_source_src_28000.ds_partitioned, day) AS booking__ds_partitioned__day + , DATETIME_TRUNC(bookings_source_src_28000.ds_partitioned, isoweek) AS booking__ds_partitioned__week + , DATETIME_TRUNC(bookings_source_src_28000.ds_partitioned, month) AS booking__ds_partitioned__month + , DATETIME_TRUNC(bookings_source_src_28000.ds_partitioned, quarter) AS booking__ds_partitioned__quarter + , DATETIME_TRUNC(bookings_source_src_28000.ds_partitioned, year) AS booking__ds_partitioned__year , EXTRACT(year FROM bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__extract_year , EXTRACT(quarter FROM bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__extract_quarter , EXTRACT(month FROM bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__extract_month , EXTRACT(day FROM bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__extract_day , IF(EXTRACT(dayofweek FROM bookings_source_src_28000.ds_partitioned) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_28000.ds_partitioned) - 1) AS booking__ds_partitioned__extract_dow , EXTRACT(dayofyear FROM bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__extract_doy - , DATE_TRUNC(bookings_source_src_28000.paid_at, day) AS booking__paid_at__day - , DATE_TRUNC(bookings_source_src_28000.paid_at, isoweek) AS booking__paid_at__week - , DATE_TRUNC(bookings_source_src_28000.paid_at, month) AS booking__paid_at__month - , DATE_TRUNC(bookings_source_src_28000.paid_at, quarter) AS booking__paid_at__quarter - , DATE_TRUNC(bookings_source_src_28000.paid_at, year) AS booking__paid_at__year + , DATETIME_TRUNC(bookings_source_src_28000.paid_at, day) AS booking__paid_at__day + , DATETIME_TRUNC(bookings_source_src_28000.paid_at, isoweek) AS booking__paid_at__week + , DATETIME_TRUNC(bookings_source_src_28000.paid_at, month) AS booking__paid_at__month + , DATETIME_TRUNC(bookings_source_src_28000.paid_at, quarter) AS booking__paid_at__quarter + , DATETIME_TRUNC(bookings_source_src_28000.paid_at, year) AS booking__paid_at__year , EXTRACT(year FROM bookings_source_src_28000.paid_at) AS booking__paid_at__extract_year , EXTRACT(quarter FROM bookings_source_src_28000.paid_at) AS booking__paid_at__extract_quarter , EXTRACT(month FROM bookings_source_src_28000.paid_at) AS booking__paid_at__extract_month @@ -494,33 +494,33 @@ FROM ( , bookings_source_src_28000.booking_value AS approximate_continuous_booking_value_p99 , bookings_source_src_28000.booking_value AS approximate_discrete_booking_value_p99 , bookings_source_src_28000.is_instant - , DATE_TRUNC(bookings_source_src_28000.ds, day) AS ds__day - , DATE_TRUNC(bookings_source_src_28000.ds, isoweek) AS ds__week - , DATE_TRUNC(bookings_source_src_28000.ds, month) AS ds__month - , DATE_TRUNC(bookings_source_src_28000.ds, quarter) AS ds__quarter - , DATE_TRUNC(bookings_source_src_28000.ds, year) AS ds__year + , DATETIME_TRUNC(bookings_source_src_28000.ds, day) AS ds__day + , DATETIME_TRUNC(bookings_source_src_28000.ds, isoweek) AS ds__week + , DATETIME_TRUNC(bookings_source_src_28000.ds, month) AS ds__month + , DATETIME_TRUNC(bookings_source_src_28000.ds, quarter) AS ds__quarter + , DATETIME_TRUNC(bookings_source_src_28000.ds, year) AS ds__year , EXTRACT(year FROM bookings_source_src_28000.ds) AS ds__extract_year , EXTRACT(quarter FROM bookings_source_src_28000.ds) AS ds__extract_quarter , EXTRACT(month FROM bookings_source_src_28000.ds) AS ds__extract_month , EXTRACT(day FROM bookings_source_src_28000.ds) AS ds__extract_day , IF(EXTRACT(dayofweek FROM bookings_source_src_28000.ds) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_28000.ds) - 1) AS ds__extract_dow , EXTRACT(dayofyear FROM bookings_source_src_28000.ds) AS ds__extract_doy - , DATE_TRUNC(bookings_source_src_28000.ds_partitioned, day) AS ds_partitioned__day - , DATE_TRUNC(bookings_source_src_28000.ds_partitioned, isoweek) AS ds_partitioned__week - , DATE_TRUNC(bookings_source_src_28000.ds_partitioned, month) AS ds_partitioned__month - , DATE_TRUNC(bookings_source_src_28000.ds_partitioned, quarter) AS ds_partitioned__quarter - , DATE_TRUNC(bookings_source_src_28000.ds_partitioned, year) AS ds_partitioned__year + , DATETIME_TRUNC(bookings_source_src_28000.ds_partitioned, day) AS ds_partitioned__day + , DATETIME_TRUNC(bookings_source_src_28000.ds_partitioned, isoweek) AS ds_partitioned__week + , DATETIME_TRUNC(bookings_source_src_28000.ds_partitioned, month) AS ds_partitioned__month + , DATETIME_TRUNC(bookings_source_src_28000.ds_partitioned, quarter) AS ds_partitioned__quarter + , DATETIME_TRUNC(bookings_source_src_28000.ds_partitioned, year) AS ds_partitioned__year , EXTRACT(year FROM bookings_source_src_28000.ds_partitioned) AS ds_partitioned__extract_year , EXTRACT(quarter FROM bookings_source_src_28000.ds_partitioned) AS ds_partitioned__extract_quarter , EXTRACT(month FROM bookings_source_src_28000.ds_partitioned) AS ds_partitioned__extract_month , EXTRACT(day FROM bookings_source_src_28000.ds_partitioned) AS ds_partitioned__extract_day , IF(EXTRACT(dayofweek FROM bookings_source_src_28000.ds_partitioned) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_28000.ds_partitioned) - 1) AS ds_partitioned__extract_dow , EXTRACT(dayofyear FROM bookings_source_src_28000.ds_partitioned) AS ds_partitioned__extract_doy - , DATE_TRUNC(bookings_source_src_28000.paid_at, day) AS paid_at__day - , DATE_TRUNC(bookings_source_src_28000.paid_at, isoweek) AS paid_at__week - , DATE_TRUNC(bookings_source_src_28000.paid_at, month) AS paid_at__month - , DATE_TRUNC(bookings_source_src_28000.paid_at, quarter) AS paid_at__quarter - , DATE_TRUNC(bookings_source_src_28000.paid_at, year) AS paid_at__year + , DATETIME_TRUNC(bookings_source_src_28000.paid_at, day) AS paid_at__day + , DATETIME_TRUNC(bookings_source_src_28000.paid_at, isoweek) AS paid_at__week + , DATETIME_TRUNC(bookings_source_src_28000.paid_at, month) AS paid_at__month + , DATETIME_TRUNC(bookings_source_src_28000.paid_at, quarter) AS paid_at__quarter + , DATETIME_TRUNC(bookings_source_src_28000.paid_at, year) AS paid_at__year , EXTRACT(year FROM bookings_source_src_28000.paid_at) AS paid_at__extract_year , EXTRACT(quarter FROM bookings_source_src_28000.paid_at) AS paid_at__extract_quarter , EXTRACT(month FROM bookings_source_src_28000.paid_at) AS paid_at__extract_month @@ -528,33 +528,33 @@ FROM ( , IF(EXTRACT(dayofweek FROM bookings_source_src_28000.paid_at) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_28000.paid_at) - 1) AS paid_at__extract_dow , EXTRACT(dayofyear FROM bookings_source_src_28000.paid_at) AS paid_at__extract_doy , bookings_source_src_28000.is_instant AS booking__is_instant - , DATE_TRUNC(bookings_source_src_28000.ds, day) AS booking__ds__day - , DATE_TRUNC(bookings_source_src_28000.ds, isoweek) AS booking__ds__week - , DATE_TRUNC(bookings_source_src_28000.ds, month) AS booking__ds__month - , DATE_TRUNC(bookings_source_src_28000.ds, quarter) AS booking__ds__quarter - , DATE_TRUNC(bookings_source_src_28000.ds, year) AS booking__ds__year + , DATETIME_TRUNC(bookings_source_src_28000.ds, day) AS booking__ds__day + , DATETIME_TRUNC(bookings_source_src_28000.ds, isoweek) AS booking__ds__week + , DATETIME_TRUNC(bookings_source_src_28000.ds, month) AS booking__ds__month + , DATETIME_TRUNC(bookings_source_src_28000.ds, quarter) AS booking__ds__quarter + , DATETIME_TRUNC(bookings_source_src_28000.ds, year) AS booking__ds__year , EXTRACT(year FROM bookings_source_src_28000.ds) AS booking__ds__extract_year , EXTRACT(quarter FROM bookings_source_src_28000.ds) AS booking__ds__extract_quarter , EXTRACT(month FROM bookings_source_src_28000.ds) AS booking__ds__extract_month , EXTRACT(day FROM bookings_source_src_28000.ds) AS booking__ds__extract_day , IF(EXTRACT(dayofweek FROM bookings_source_src_28000.ds) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_28000.ds) - 1) AS booking__ds__extract_dow , EXTRACT(dayofyear FROM bookings_source_src_28000.ds) AS booking__ds__extract_doy - , DATE_TRUNC(bookings_source_src_28000.ds_partitioned, day) AS booking__ds_partitioned__day - , DATE_TRUNC(bookings_source_src_28000.ds_partitioned, isoweek) AS booking__ds_partitioned__week - , DATE_TRUNC(bookings_source_src_28000.ds_partitioned, month) AS booking__ds_partitioned__month - , DATE_TRUNC(bookings_source_src_28000.ds_partitioned, quarter) AS booking__ds_partitioned__quarter - , DATE_TRUNC(bookings_source_src_28000.ds_partitioned, year) AS booking__ds_partitioned__year + , DATETIME_TRUNC(bookings_source_src_28000.ds_partitioned, day) AS booking__ds_partitioned__day + , DATETIME_TRUNC(bookings_source_src_28000.ds_partitioned, isoweek) AS booking__ds_partitioned__week + , DATETIME_TRUNC(bookings_source_src_28000.ds_partitioned, month) AS booking__ds_partitioned__month + , DATETIME_TRUNC(bookings_source_src_28000.ds_partitioned, quarter) AS booking__ds_partitioned__quarter + , DATETIME_TRUNC(bookings_source_src_28000.ds_partitioned, year) AS booking__ds_partitioned__year , EXTRACT(year FROM bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__extract_year , EXTRACT(quarter FROM bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__extract_quarter , EXTRACT(month FROM bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__extract_month , EXTRACT(day FROM bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__extract_day , IF(EXTRACT(dayofweek FROM bookings_source_src_28000.ds_partitioned) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_28000.ds_partitioned) - 1) AS booking__ds_partitioned__extract_dow , EXTRACT(dayofyear FROM bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__extract_doy - , DATE_TRUNC(bookings_source_src_28000.paid_at, day) AS booking__paid_at__day - , DATE_TRUNC(bookings_source_src_28000.paid_at, isoweek) AS booking__paid_at__week - , DATE_TRUNC(bookings_source_src_28000.paid_at, month) AS booking__paid_at__month - , DATE_TRUNC(bookings_source_src_28000.paid_at, quarter) AS booking__paid_at__quarter - , DATE_TRUNC(bookings_source_src_28000.paid_at, year) AS booking__paid_at__year + , DATETIME_TRUNC(bookings_source_src_28000.paid_at, day) AS booking__paid_at__day + , DATETIME_TRUNC(bookings_source_src_28000.paid_at, isoweek) AS booking__paid_at__week + , DATETIME_TRUNC(bookings_source_src_28000.paid_at, month) AS booking__paid_at__month + , DATETIME_TRUNC(bookings_source_src_28000.paid_at, quarter) AS booking__paid_at__quarter + , DATETIME_TRUNC(bookings_source_src_28000.paid_at, year) AS booking__paid_at__year , EXTRACT(year FROM bookings_source_src_28000.paid_at) AS booking__paid_at__extract_year , EXTRACT(quarter FROM bookings_source_src_28000.paid_at) AS booking__paid_at__extract_quarter , EXTRACT(month FROM bookings_source_src_28000.paid_at) AS booking__paid_at__extract_month diff --git a/tests_metricflow/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/BigQuery/test_offset_window_metric_filter_and_query_have_different_granularities__plan0_optimized.sql b/tests_metricflow/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/BigQuery/test_offset_window_metric_filter_and_query_have_different_granularities__plan0_optimized.sql index a0c623e6c9..31f0a39d91 100644 --- a/tests_metricflow/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/BigQuery/test_offset_window_metric_filter_and_query_have_different_granularities__plan0_optimized.sql +++ b/tests_metricflow/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/BigQuery/test_offset_window_metric_filter_and_query_have_different_granularities__plan0_optimized.sql @@ -21,13 +21,13 @@ FROM ( -- Pass Only Elements: ['booking_value', 'metric_time__month', 'metric_time__day'] SELECT subq_21.ds AS metric_time__day - , DATE_TRUNC(subq_21.ds, month) AS metric_time__month + , DATETIME_TRUNC(subq_21.ds, month) AS metric_time__month , bookings_source_src_28000.booking_value AS booking_value FROM ***************************.mf_time_spine subq_21 INNER JOIN ***************************.fct_bookings bookings_source_src_28000 ON - DATE_SUB(CAST(subq_21.ds AS DATETIME), INTERVAL 1 week) = DATE_TRUNC(bookings_source_src_28000.ds, day) + DATE_SUB(CAST(subq_21.ds AS DATETIME), INTERVAL 1 week) = DATETIME_TRUNC(bookings_source_src_28000.ds, day) ) subq_23 WHERE metric_time__day = '2020-01-01' GROUP BY @@ -46,8 +46,8 @@ FROM ( -- Metric Time Dimension 'ds' -- Pass Only Elements: ['bookers', 'metric_time__month', 'metric_time__day'] SELECT - DATE_TRUNC(ds, day) AS metric_time__day - , DATE_TRUNC(ds, month) AS metric_time__month + DATETIME_TRUNC(ds, day) AS metric_time__day + , DATETIME_TRUNC(ds, month) AS metric_time__month , guest_id AS bookers FROM ***************************.fct_bookings bookings_source_src_28000 ) subq_30 diff --git a/tests_metricflow/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/BigQuery/test_offset_window_metric_multiple_granularities__plan0.sql b/tests_metricflow/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/BigQuery/test_offset_window_metric_multiple_granularities__plan0.sql index 2a96df9e68..1bdeb88919 100644 --- a/tests_metricflow/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/BigQuery/test_offset_window_metric_multiple_granularities__plan0.sql +++ b/tests_metricflow/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/BigQuery/test_offset_window_metric_multiple_granularities__plan0.sql @@ -37,10 +37,10 @@ FROM ( -- Join to Time Spine Dataset SELECT subq_2.metric_time__day AS metric_time__day - , DATE_TRUNC(subq_2.metric_time__day, isoweek) AS metric_time__week - , DATE_TRUNC(subq_2.metric_time__day, month) AS metric_time__month - , DATE_TRUNC(subq_2.metric_time__day, quarter) AS metric_time__quarter - , DATE_TRUNC(subq_2.metric_time__day, year) AS metric_time__year + , DATETIME_TRUNC(subq_2.metric_time__day, isoweek) AS metric_time__week + , DATETIME_TRUNC(subq_2.metric_time__day, month) AS metric_time__month + , DATETIME_TRUNC(subq_2.metric_time__day, quarter) AS metric_time__quarter + , DATETIME_TRUNC(subq_2.metric_time__day, year) AS metric_time__year , EXTRACT(year FROM subq_2.metric_time__day) AS metric_time__extract_year , EXTRACT(quarter FROM subq_2.metric_time__day) AS metric_time__extract_quarter , EXTRACT(month FROM subq_2.metric_time__day) AS metric_time__extract_month @@ -259,33 +259,33 @@ FROM ( , bookings_source_src_28000.booking_value AS approximate_continuous_booking_value_p99 , bookings_source_src_28000.booking_value AS approximate_discrete_booking_value_p99 , bookings_source_src_28000.is_instant - , DATE_TRUNC(bookings_source_src_28000.ds, day) AS ds__day - , DATE_TRUNC(bookings_source_src_28000.ds, isoweek) AS ds__week - , DATE_TRUNC(bookings_source_src_28000.ds, month) AS ds__month - , DATE_TRUNC(bookings_source_src_28000.ds, quarter) AS ds__quarter - , DATE_TRUNC(bookings_source_src_28000.ds, year) AS ds__year + , DATETIME_TRUNC(bookings_source_src_28000.ds, day) AS ds__day + , DATETIME_TRUNC(bookings_source_src_28000.ds, isoweek) AS ds__week + , DATETIME_TRUNC(bookings_source_src_28000.ds, month) AS ds__month + , DATETIME_TRUNC(bookings_source_src_28000.ds, quarter) AS ds__quarter + , DATETIME_TRUNC(bookings_source_src_28000.ds, year) AS ds__year , EXTRACT(year FROM bookings_source_src_28000.ds) AS ds__extract_year , EXTRACT(quarter FROM bookings_source_src_28000.ds) AS ds__extract_quarter , EXTRACT(month FROM bookings_source_src_28000.ds) AS ds__extract_month , EXTRACT(day FROM bookings_source_src_28000.ds) AS ds__extract_day , IF(EXTRACT(dayofweek FROM bookings_source_src_28000.ds) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_28000.ds) - 1) AS ds__extract_dow , EXTRACT(dayofyear FROM bookings_source_src_28000.ds) AS ds__extract_doy - , DATE_TRUNC(bookings_source_src_28000.ds_partitioned, day) AS ds_partitioned__day - , DATE_TRUNC(bookings_source_src_28000.ds_partitioned, isoweek) AS ds_partitioned__week - , DATE_TRUNC(bookings_source_src_28000.ds_partitioned, month) AS ds_partitioned__month - , DATE_TRUNC(bookings_source_src_28000.ds_partitioned, quarter) AS ds_partitioned__quarter - , DATE_TRUNC(bookings_source_src_28000.ds_partitioned, year) AS ds_partitioned__year + , DATETIME_TRUNC(bookings_source_src_28000.ds_partitioned, day) AS ds_partitioned__day + , DATETIME_TRUNC(bookings_source_src_28000.ds_partitioned, isoweek) AS ds_partitioned__week + , DATETIME_TRUNC(bookings_source_src_28000.ds_partitioned, month) AS ds_partitioned__month + , DATETIME_TRUNC(bookings_source_src_28000.ds_partitioned, quarter) AS ds_partitioned__quarter + , DATETIME_TRUNC(bookings_source_src_28000.ds_partitioned, year) AS ds_partitioned__year , EXTRACT(year FROM bookings_source_src_28000.ds_partitioned) AS ds_partitioned__extract_year , EXTRACT(quarter FROM bookings_source_src_28000.ds_partitioned) AS ds_partitioned__extract_quarter , EXTRACT(month FROM bookings_source_src_28000.ds_partitioned) AS ds_partitioned__extract_month , EXTRACT(day FROM bookings_source_src_28000.ds_partitioned) AS ds_partitioned__extract_day , IF(EXTRACT(dayofweek FROM bookings_source_src_28000.ds_partitioned) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_28000.ds_partitioned) - 1) AS ds_partitioned__extract_dow , EXTRACT(dayofyear FROM bookings_source_src_28000.ds_partitioned) AS ds_partitioned__extract_doy - , DATE_TRUNC(bookings_source_src_28000.paid_at, day) AS paid_at__day - , DATE_TRUNC(bookings_source_src_28000.paid_at, isoweek) AS paid_at__week - , DATE_TRUNC(bookings_source_src_28000.paid_at, month) AS paid_at__month - , DATE_TRUNC(bookings_source_src_28000.paid_at, quarter) AS paid_at__quarter - , DATE_TRUNC(bookings_source_src_28000.paid_at, year) AS paid_at__year + , DATETIME_TRUNC(bookings_source_src_28000.paid_at, day) AS paid_at__day + , DATETIME_TRUNC(bookings_source_src_28000.paid_at, isoweek) AS paid_at__week + , DATETIME_TRUNC(bookings_source_src_28000.paid_at, month) AS paid_at__month + , DATETIME_TRUNC(bookings_source_src_28000.paid_at, quarter) AS paid_at__quarter + , DATETIME_TRUNC(bookings_source_src_28000.paid_at, year) AS paid_at__year , EXTRACT(year FROM bookings_source_src_28000.paid_at) AS paid_at__extract_year , EXTRACT(quarter FROM bookings_source_src_28000.paid_at) AS paid_at__extract_quarter , EXTRACT(month FROM bookings_source_src_28000.paid_at) AS paid_at__extract_month @@ -293,33 +293,33 @@ FROM ( , IF(EXTRACT(dayofweek FROM bookings_source_src_28000.paid_at) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_28000.paid_at) - 1) AS paid_at__extract_dow , EXTRACT(dayofyear FROM bookings_source_src_28000.paid_at) AS paid_at__extract_doy , bookings_source_src_28000.is_instant AS booking__is_instant - , DATE_TRUNC(bookings_source_src_28000.ds, day) AS booking__ds__day - , DATE_TRUNC(bookings_source_src_28000.ds, isoweek) AS booking__ds__week - , DATE_TRUNC(bookings_source_src_28000.ds, month) AS booking__ds__month - , DATE_TRUNC(bookings_source_src_28000.ds, quarter) AS booking__ds__quarter - , DATE_TRUNC(bookings_source_src_28000.ds, year) AS booking__ds__year + , DATETIME_TRUNC(bookings_source_src_28000.ds, day) AS booking__ds__day + , DATETIME_TRUNC(bookings_source_src_28000.ds, isoweek) AS booking__ds__week + , DATETIME_TRUNC(bookings_source_src_28000.ds, month) AS booking__ds__month + , DATETIME_TRUNC(bookings_source_src_28000.ds, quarter) AS booking__ds__quarter + , DATETIME_TRUNC(bookings_source_src_28000.ds, year) AS booking__ds__year , EXTRACT(year FROM bookings_source_src_28000.ds) AS booking__ds__extract_year , EXTRACT(quarter FROM bookings_source_src_28000.ds) AS booking__ds__extract_quarter , EXTRACT(month FROM bookings_source_src_28000.ds) AS booking__ds__extract_month , EXTRACT(day FROM bookings_source_src_28000.ds) AS booking__ds__extract_day , IF(EXTRACT(dayofweek FROM bookings_source_src_28000.ds) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_28000.ds) - 1) AS booking__ds__extract_dow , EXTRACT(dayofyear FROM bookings_source_src_28000.ds) AS booking__ds__extract_doy - , DATE_TRUNC(bookings_source_src_28000.ds_partitioned, day) AS booking__ds_partitioned__day - , DATE_TRUNC(bookings_source_src_28000.ds_partitioned, isoweek) AS booking__ds_partitioned__week - , DATE_TRUNC(bookings_source_src_28000.ds_partitioned, month) AS booking__ds_partitioned__month - , DATE_TRUNC(bookings_source_src_28000.ds_partitioned, quarter) AS booking__ds_partitioned__quarter - , DATE_TRUNC(bookings_source_src_28000.ds_partitioned, year) AS booking__ds_partitioned__year + , DATETIME_TRUNC(bookings_source_src_28000.ds_partitioned, day) AS booking__ds_partitioned__day + , DATETIME_TRUNC(bookings_source_src_28000.ds_partitioned, isoweek) AS booking__ds_partitioned__week + , DATETIME_TRUNC(bookings_source_src_28000.ds_partitioned, month) AS booking__ds_partitioned__month + , DATETIME_TRUNC(bookings_source_src_28000.ds_partitioned, quarter) AS booking__ds_partitioned__quarter + , DATETIME_TRUNC(bookings_source_src_28000.ds_partitioned, year) AS booking__ds_partitioned__year , EXTRACT(year FROM bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__extract_year , EXTRACT(quarter FROM bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__extract_quarter , EXTRACT(month FROM bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__extract_month , EXTRACT(day FROM bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__extract_day , IF(EXTRACT(dayofweek FROM bookings_source_src_28000.ds_partitioned) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_28000.ds_partitioned) - 1) AS booking__ds_partitioned__extract_dow , EXTRACT(dayofyear FROM bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__extract_doy - , DATE_TRUNC(bookings_source_src_28000.paid_at, day) AS booking__paid_at__day - , DATE_TRUNC(bookings_source_src_28000.paid_at, isoweek) AS booking__paid_at__week - , DATE_TRUNC(bookings_source_src_28000.paid_at, month) AS booking__paid_at__month - , DATE_TRUNC(bookings_source_src_28000.paid_at, quarter) AS booking__paid_at__quarter - , DATE_TRUNC(bookings_source_src_28000.paid_at, year) AS booking__paid_at__year + , DATETIME_TRUNC(bookings_source_src_28000.paid_at, day) AS booking__paid_at__day + , DATETIME_TRUNC(bookings_source_src_28000.paid_at, isoweek) AS booking__paid_at__week + , DATETIME_TRUNC(bookings_source_src_28000.paid_at, month) AS booking__paid_at__month + , DATETIME_TRUNC(bookings_source_src_28000.paid_at, quarter) AS booking__paid_at__quarter + , DATETIME_TRUNC(bookings_source_src_28000.paid_at, year) AS booking__paid_at__year , EXTRACT(year FROM bookings_source_src_28000.paid_at) AS booking__paid_at__extract_year , EXTRACT(quarter FROM bookings_source_src_28000.paid_at) AS booking__paid_at__extract_quarter , EXTRACT(month FROM bookings_source_src_28000.paid_at) AS booking__paid_at__extract_month @@ -485,33 +485,33 @@ FROM ( , bookings_source_src_28000.booking_value AS approximate_continuous_booking_value_p99 , bookings_source_src_28000.booking_value AS approximate_discrete_booking_value_p99 , bookings_source_src_28000.is_instant - , DATE_TRUNC(bookings_source_src_28000.ds, day) AS ds__day - , DATE_TRUNC(bookings_source_src_28000.ds, isoweek) AS ds__week - , DATE_TRUNC(bookings_source_src_28000.ds, month) AS ds__month - , DATE_TRUNC(bookings_source_src_28000.ds, quarter) AS ds__quarter - , DATE_TRUNC(bookings_source_src_28000.ds, year) AS ds__year + , DATETIME_TRUNC(bookings_source_src_28000.ds, day) AS ds__day + , DATETIME_TRUNC(bookings_source_src_28000.ds, isoweek) AS ds__week + , DATETIME_TRUNC(bookings_source_src_28000.ds, month) AS ds__month + , DATETIME_TRUNC(bookings_source_src_28000.ds, quarter) AS ds__quarter + , DATETIME_TRUNC(bookings_source_src_28000.ds, year) AS ds__year , EXTRACT(year FROM bookings_source_src_28000.ds) AS ds__extract_year , EXTRACT(quarter FROM bookings_source_src_28000.ds) AS ds__extract_quarter , EXTRACT(month FROM bookings_source_src_28000.ds) AS ds__extract_month , EXTRACT(day FROM bookings_source_src_28000.ds) AS ds__extract_day , IF(EXTRACT(dayofweek FROM bookings_source_src_28000.ds) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_28000.ds) - 1) AS ds__extract_dow , EXTRACT(dayofyear FROM bookings_source_src_28000.ds) AS ds__extract_doy - , DATE_TRUNC(bookings_source_src_28000.ds_partitioned, day) AS ds_partitioned__day - , DATE_TRUNC(bookings_source_src_28000.ds_partitioned, isoweek) AS ds_partitioned__week - , DATE_TRUNC(bookings_source_src_28000.ds_partitioned, month) AS ds_partitioned__month - , DATE_TRUNC(bookings_source_src_28000.ds_partitioned, quarter) AS ds_partitioned__quarter - , DATE_TRUNC(bookings_source_src_28000.ds_partitioned, year) AS ds_partitioned__year + , DATETIME_TRUNC(bookings_source_src_28000.ds_partitioned, day) AS ds_partitioned__day + , DATETIME_TRUNC(bookings_source_src_28000.ds_partitioned, isoweek) AS ds_partitioned__week + , DATETIME_TRUNC(bookings_source_src_28000.ds_partitioned, month) AS ds_partitioned__month + , DATETIME_TRUNC(bookings_source_src_28000.ds_partitioned, quarter) AS ds_partitioned__quarter + , DATETIME_TRUNC(bookings_source_src_28000.ds_partitioned, year) AS ds_partitioned__year , EXTRACT(year FROM bookings_source_src_28000.ds_partitioned) AS ds_partitioned__extract_year , EXTRACT(quarter FROM bookings_source_src_28000.ds_partitioned) AS ds_partitioned__extract_quarter , EXTRACT(month FROM bookings_source_src_28000.ds_partitioned) AS ds_partitioned__extract_month , EXTRACT(day FROM bookings_source_src_28000.ds_partitioned) AS ds_partitioned__extract_day , IF(EXTRACT(dayofweek FROM bookings_source_src_28000.ds_partitioned) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_28000.ds_partitioned) - 1) AS ds_partitioned__extract_dow , EXTRACT(dayofyear FROM bookings_source_src_28000.ds_partitioned) AS ds_partitioned__extract_doy - , DATE_TRUNC(bookings_source_src_28000.paid_at, day) AS paid_at__day - , DATE_TRUNC(bookings_source_src_28000.paid_at, isoweek) AS paid_at__week - , DATE_TRUNC(bookings_source_src_28000.paid_at, month) AS paid_at__month - , DATE_TRUNC(bookings_source_src_28000.paid_at, quarter) AS paid_at__quarter - , DATE_TRUNC(bookings_source_src_28000.paid_at, year) AS paid_at__year + , DATETIME_TRUNC(bookings_source_src_28000.paid_at, day) AS paid_at__day + , DATETIME_TRUNC(bookings_source_src_28000.paid_at, isoweek) AS paid_at__week + , DATETIME_TRUNC(bookings_source_src_28000.paid_at, month) AS paid_at__month + , DATETIME_TRUNC(bookings_source_src_28000.paid_at, quarter) AS paid_at__quarter + , DATETIME_TRUNC(bookings_source_src_28000.paid_at, year) AS paid_at__year , EXTRACT(year FROM bookings_source_src_28000.paid_at) AS paid_at__extract_year , EXTRACT(quarter FROM bookings_source_src_28000.paid_at) AS paid_at__extract_quarter , EXTRACT(month FROM bookings_source_src_28000.paid_at) AS paid_at__extract_month @@ -519,33 +519,33 @@ FROM ( , IF(EXTRACT(dayofweek FROM bookings_source_src_28000.paid_at) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_28000.paid_at) - 1) AS paid_at__extract_dow , EXTRACT(dayofyear FROM bookings_source_src_28000.paid_at) AS paid_at__extract_doy , bookings_source_src_28000.is_instant AS booking__is_instant - , DATE_TRUNC(bookings_source_src_28000.ds, day) AS booking__ds__day - , DATE_TRUNC(bookings_source_src_28000.ds, isoweek) AS booking__ds__week - , DATE_TRUNC(bookings_source_src_28000.ds, month) AS booking__ds__month - , DATE_TRUNC(bookings_source_src_28000.ds, quarter) AS booking__ds__quarter - , DATE_TRUNC(bookings_source_src_28000.ds, year) AS booking__ds__year + , DATETIME_TRUNC(bookings_source_src_28000.ds, day) AS booking__ds__day + , DATETIME_TRUNC(bookings_source_src_28000.ds, isoweek) AS booking__ds__week + , DATETIME_TRUNC(bookings_source_src_28000.ds, month) AS booking__ds__month + , DATETIME_TRUNC(bookings_source_src_28000.ds, quarter) AS booking__ds__quarter + , DATETIME_TRUNC(bookings_source_src_28000.ds, year) AS booking__ds__year , EXTRACT(year FROM bookings_source_src_28000.ds) AS booking__ds__extract_year , EXTRACT(quarter FROM bookings_source_src_28000.ds) AS booking__ds__extract_quarter , EXTRACT(month FROM bookings_source_src_28000.ds) AS booking__ds__extract_month , EXTRACT(day FROM bookings_source_src_28000.ds) AS booking__ds__extract_day , IF(EXTRACT(dayofweek FROM bookings_source_src_28000.ds) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_28000.ds) - 1) AS booking__ds__extract_dow , EXTRACT(dayofyear FROM bookings_source_src_28000.ds) AS booking__ds__extract_doy - , DATE_TRUNC(bookings_source_src_28000.ds_partitioned, day) AS booking__ds_partitioned__day - , DATE_TRUNC(bookings_source_src_28000.ds_partitioned, isoweek) AS booking__ds_partitioned__week - , DATE_TRUNC(bookings_source_src_28000.ds_partitioned, month) AS booking__ds_partitioned__month - , DATE_TRUNC(bookings_source_src_28000.ds_partitioned, quarter) AS booking__ds_partitioned__quarter - , DATE_TRUNC(bookings_source_src_28000.ds_partitioned, year) AS booking__ds_partitioned__year + , DATETIME_TRUNC(bookings_source_src_28000.ds_partitioned, day) AS booking__ds_partitioned__day + , DATETIME_TRUNC(bookings_source_src_28000.ds_partitioned, isoweek) AS booking__ds_partitioned__week + , DATETIME_TRUNC(bookings_source_src_28000.ds_partitioned, month) AS booking__ds_partitioned__month + , DATETIME_TRUNC(bookings_source_src_28000.ds_partitioned, quarter) AS booking__ds_partitioned__quarter + , DATETIME_TRUNC(bookings_source_src_28000.ds_partitioned, year) AS booking__ds_partitioned__year , EXTRACT(year FROM bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__extract_year , EXTRACT(quarter FROM bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__extract_quarter , EXTRACT(month FROM bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__extract_month , EXTRACT(day FROM bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__extract_day , IF(EXTRACT(dayofweek FROM bookings_source_src_28000.ds_partitioned) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_28000.ds_partitioned) - 1) AS booking__ds_partitioned__extract_dow , EXTRACT(dayofyear FROM bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__extract_doy - , DATE_TRUNC(bookings_source_src_28000.paid_at, day) AS booking__paid_at__day - , DATE_TRUNC(bookings_source_src_28000.paid_at, isoweek) AS booking__paid_at__week - , DATE_TRUNC(bookings_source_src_28000.paid_at, month) AS booking__paid_at__month - , DATE_TRUNC(bookings_source_src_28000.paid_at, quarter) AS booking__paid_at__quarter - , DATE_TRUNC(bookings_source_src_28000.paid_at, year) AS booking__paid_at__year + , DATETIME_TRUNC(bookings_source_src_28000.paid_at, day) AS booking__paid_at__day + , DATETIME_TRUNC(bookings_source_src_28000.paid_at, isoweek) AS booking__paid_at__week + , DATETIME_TRUNC(bookings_source_src_28000.paid_at, month) AS booking__paid_at__month + , DATETIME_TRUNC(bookings_source_src_28000.paid_at, quarter) AS booking__paid_at__quarter + , DATETIME_TRUNC(bookings_source_src_28000.paid_at, year) AS booking__paid_at__year , EXTRACT(year FROM bookings_source_src_28000.paid_at) AS booking__paid_at__extract_year , EXTRACT(quarter FROM bookings_source_src_28000.paid_at) AS booking__paid_at__extract_quarter , EXTRACT(month FROM bookings_source_src_28000.paid_at) AS booking__paid_at__extract_month diff --git a/tests_metricflow/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/BigQuery/test_offset_window_metric_multiple_granularities__plan0_optimized.sql b/tests_metricflow/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/BigQuery/test_offset_window_metric_multiple_granularities__plan0_optimized.sql index 9c7267c179..a67284e4ba 100644 --- a/tests_metricflow/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/BigQuery/test_offset_window_metric_multiple_granularities__plan0_optimized.sql +++ b/tests_metricflow/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/BigQuery/test_offset_window_metric_multiple_granularities__plan0_optimized.sql @@ -19,14 +19,14 @@ FROM ( -- Compute Metrics via Expressions SELECT subq_17.ds AS metric_time__day - , DATE_TRUNC(subq_17.ds, month) AS metric_time__month - , DATE_TRUNC(subq_17.ds, year) AS metric_time__year + , DATETIME_TRUNC(subq_17.ds, month) AS metric_time__month + , DATETIME_TRUNC(subq_17.ds, year) AS metric_time__year , SUM(bookings_source_src_28000.booking_value) AS booking_value FROM ***************************.mf_time_spine subq_17 INNER JOIN ***************************.fct_bookings bookings_source_src_28000 ON - DATE_SUB(CAST(subq_17.ds AS DATETIME), INTERVAL 1 week) = DATE_TRUNC(bookings_source_src_28000.ds, day) + DATE_SUB(CAST(subq_17.ds AS DATETIME), INTERVAL 1 week) = DATETIME_TRUNC(bookings_source_src_28000.ds, day) GROUP BY metric_time__day , metric_time__month @@ -39,9 +39,9 @@ FROM ( -- Aggregate Measures -- Compute Metrics via Expressions SELECT - DATE_TRUNC(ds, day) AS metric_time__day - , DATE_TRUNC(ds, month) AS metric_time__month - , DATE_TRUNC(ds, year) AS metric_time__year + DATETIME_TRUNC(ds, day) AS metric_time__day + , DATETIME_TRUNC(ds, month) AS metric_time__month + , DATETIME_TRUNC(ds, year) AS metric_time__year , COUNT(DISTINCT guest_id) AS bookers FROM ***************************.fct_bookings bookings_source_src_28000 GROUP BY diff --git a/tests_metricflow/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/BigQuery/test_offset_window_with_agg_time_dim__plan0.sql b/tests_metricflow/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/BigQuery/test_offset_window_with_agg_time_dim__plan0.sql index 477671fea5..1fff76a029 100644 --- a/tests_metricflow/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/BigQuery/test_offset_window_with_agg_time_dim__plan0.sql +++ b/tests_metricflow/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/BigQuery/test_offset_window_with_agg_time_dim__plan0.sql @@ -142,33 +142,33 @@ FROM ( , bookings_source_src_28000.booking_value AS approximate_continuous_booking_value_p99 , bookings_source_src_28000.booking_value AS approximate_discrete_booking_value_p99 , bookings_source_src_28000.is_instant - , DATE_TRUNC(bookings_source_src_28000.ds, day) AS ds__day - , DATE_TRUNC(bookings_source_src_28000.ds, isoweek) AS ds__week - , DATE_TRUNC(bookings_source_src_28000.ds, month) AS ds__month - , DATE_TRUNC(bookings_source_src_28000.ds, quarter) AS ds__quarter - , DATE_TRUNC(bookings_source_src_28000.ds, year) AS ds__year + , DATETIME_TRUNC(bookings_source_src_28000.ds, day) AS ds__day + , DATETIME_TRUNC(bookings_source_src_28000.ds, isoweek) AS ds__week + , DATETIME_TRUNC(bookings_source_src_28000.ds, month) AS ds__month + , DATETIME_TRUNC(bookings_source_src_28000.ds, quarter) AS ds__quarter + , DATETIME_TRUNC(bookings_source_src_28000.ds, year) AS ds__year , EXTRACT(year FROM bookings_source_src_28000.ds) AS ds__extract_year , EXTRACT(quarter FROM bookings_source_src_28000.ds) AS ds__extract_quarter , EXTRACT(month FROM bookings_source_src_28000.ds) AS ds__extract_month , EXTRACT(day FROM bookings_source_src_28000.ds) AS ds__extract_day , IF(EXTRACT(dayofweek FROM bookings_source_src_28000.ds) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_28000.ds) - 1) AS ds__extract_dow , EXTRACT(dayofyear FROM bookings_source_src_28000.ds) AS ds__extract_doy - , DATE_TRUNC(bookings_source_src_28000.ds_partitioned, day) AS ds_partitioned__day - , DATE_TRUNC(bookings_source_src_28000.ds_partitioned, isoweek) AS ds_partitioned__week - , DATE_TRUNC(bookings_source_src_28000.ds_partitioned, month) AS ds_partitioned__month - , DATE_TRUNC(bookings_source_src_28000.ds_partitioned, quarter) AS ds_partitioned__quarter - , DATE_TRUNC(bookings_source_src_28000.ds_partitioned, year) AS ds_partitioned__year + , DATETIME_TRUNC(bookings_source_src_28000.ds_partitioned, day) AS ds_partitioned__day + , DATETIME_TRUNC(bookings_source_src_28000.ds_partitioned, isoweek) AS ds_partitioned__week + , DATETIME_TRUNC(bookings_source_src_28000.ds_partitioned, month) AS ds_partitioned__month + , DATETIME_TRUNC(bookings_source_src_28000.ds_partitioned, quarter) AS ds_partitioned__quarter + , DATETIME_TRUNC(bookings_source_src_28000.ds_partitioned, year) AS ds_partitioned__year , EXTRACT(year FROM bookings_source_src_28000.ds_partitioned) AS ds_partitioned__extract_year , EXTRACT(quarter FROM bookings_source_src_28000.ds_partitioned) AS ds_partitioned__extract_quarter , EXTRACT(month FROM bookings_source_src_28000.ds_partitioned) AS ds_partitioned__extract_month , EXTRACT(day FROM bookings_source_src_28000.ds_partitioned) AS ds_partitioned__extract_day , IF(EXTRACT(dayofweek FROM bookings_source_src_28000.ds_partitioned) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_28000.ds_partitioned) - 1) AS ds_partitioned__extract_dow , EXTRACT(dayofyear FROM bookings_source_src_28000.ds_partitioned) AS ds_partitioned__extract_doy - , DATE_TRUNC(bookings_source_src_28000.paid_at, day) AS paid_at__day - , DATE_TRUNC(bookings_source_src_28000.paid_at, isoweek) AS paid_at__week - , DATE_TRUNC(bookings_source_src_28000.paid_at, month) AS paid_at__month - , DATE_TRUNC(bookings_source_src_28000.paid_at, quarter) AS paid_at__quarter - , DATE_TRUNC(bookings_source_src_28000.paid_at, year) AS paid_at__year + , DATETIME_TRUNC(bookings_source_src_28000.paid_at, day) AS paid_at__day + , DATETIME_TRUNC(bookings_source_src_28000.paid_at, isoweek) AS paid_at__week + , DATETIME_TRUNC(bookings_source_src_28000.paid_at, month) AS paid_at__month + , DATETIME_TRUNC(bookings_source_src_28000.paid_at, quarter) AS paid_at__quarter + , DATETIME_TRUNC(bookings_source_src_28000.paid_at, year) AS paid_at__year , EXTRACT(year FROM bookings_source_src_28000.paid_at) AS paid_at__extract_year , EXTRACT(quarter FROM bookings_source_src_28000.paid_at) AS paid_at__extract_quarter , EXTRACT(month FROM bookings_source_src_28000.paid_at) AS paid_at__extract_month @@ -176,33 +176,33 @@ FROM ( , IF(EXTRACT(dayofweek FROM bookings_source_src_28000.paid_at) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_28000.paid_at) - 1) AS paid_at__extract_dow , EXTRACT(dayofyear FROM bookings_source_src_28000.paid_at) AS paid_at__extract_doy , bookings_source_src_28000.is_instant AS booking__is_instant - , DATE_TRUNC(bookings_source_src_28000.ds, day) AS booking__ds__day - , DATE_TRUNC(bookings_source_src_28000.ds, isoweek) AS booking__ds__week - , DATE_TRUNC(bookings_source_src_28000.ds, month) AS booking__ds__month - , DATE_TRUNC(bookings_source_src_28000.ds, quarter) AS booking__ds__quarter - , DATE_TRUNC(bookings_source_src_28000.ds, year) AS booking__ds__year + , DATETIME_TRUNC(bookings_source_src_28000.ds, day) AS booking__ds__day + , DATETIME_TRUNC(bookings_source_src_28000.ds, isoweek) AS booking__ds__week + , DATETIME_TRUNC(bookings_source_src_28000.ds, month) AS booking__ds__month + , DATETIME_TRUNC(bookings_source_src_28000.ds, quarter) AS booking__ds__quarter + , DATETIME_TRUNC(bookings_source_src_28000.ds, year) AS booking__ds__year , EXTRACT(year FROM bookings_source_src_28000.ds) AS booking__ds__extract_year , EXTRACT(quarter FROM bookings_source_src_28000.ds) AS booking__ds__extract_quarter , EXTRACT(month FROM bookings_source_src_28000.ds) AS booking__ds__extract_month , EXTRACT(day FROM bookings_source_src_28000.ds) AS booking__ds__extract_day , IF(EXTRACT(dayofweek FROM bookings_source_src_28000.ds) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_28000.ds) - 1) AS booking__ds__extract_dow , EXTRACT(dayofyear FROM bookings_source_src_28000.ds) AS booking__ds__extract_doy - , DATE_TRUNC(bookings_source_src_28000.ds_partitioned, day) AS booking__ds_partitioned__day - , DATE_TRUNC(bookings_source_src_28000.ds_partitioned, isoweek) AS booking__ds_partitioned__week - , DATE_TRUNC(bookings_source_src_28000.ds_partitioned, month) AS booking__ds_partitioned__month - , DATE_TRUNC(bookings_source_src_28000.ds_partitioned, quarter) AS booking__ds_partitioned__quarter - , DATE_TRUNC(bookings_source_src_28000.ds_partitioned, year) AS booking__ds_partitioned__year + , DATETIME_TRUNC(bookings_source_src_28000.ds_partitioned, day) AS booking__ds_partitioned__day + , DATETIME_TRUNC(bookings_source_src_28000.ds_partitioned, isoweek) AS booking__ds_partitioned__week + , DATETIME_TRUNC(bookings_source_src_28000.ds_partitioned, month) AS booking__ds_partitioned__month + , DATETIME_TRUNC(bookings_source_src_28000.ds_partitioned, quarter) AS booking__ds_partitioned__quarter + , DATETIME_TRUNC(bookings_source_src_28000.ds_partitioned, year) AS booking__ds_partitioned__year , EXTRACT(year FROM bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__extract_year , EXTRACT(quarter FROM bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__extract_quarter , EXTRACT(month FROM bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__extract_month , EXTRACT(day FROM bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__extract_day , IF(EXTRACT(dayofweek FROM bookings_source_src_28000.ds_partitioned) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_28000.ds_partitioned) - 1) AS booking__ds_partitioned__extract_dow , EXTRACT(dayofyear FROM bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__extract_doy - , DATE_TRUNC(bookings_source_src_28000.paid_at, day) AS booking__paid_at__day - , DATE_TRUNC(bookings_source_src_28000.paid_at, isoweek) AS booking__paid_at__week - , DATE_TRUNC(bookings_source_src_28000.paid_at, month) AS booking__paid_at__month - , DATE_TRUNC(bookings_source_src_28000.paid_at, quarter) AS booking__paid_at__quarter - , DATE_TRUNC(bookings_source_src_28000.paid_at, year) AS booking__paid_at__year + , DATETIME_TRUNC(bookings_source_src_28000.paid_at, day) AS booking__paid_at__day + , DATETIME_TRUNC(bookings_source_src_28000.paid_at, isoweek) AS booking__paid_at__week + , DATETIME_TRUNC(bookings_source_src_28000.paid_at, month) AS booking__paid_at__month + , DATETIME_TRUNC(bookings_source_src_28000.paid_at, quarter) AS booking__paid_at__quarter + , DATETIME_TRUNC(bookings_source_src_28000.paid_at, year) AS booking__paid_at__year , EXTRACT(year FROM bookings_source_src_28000.paid_at) AS booking__paid_at__extract_year , EXTRACT(quarter FROM bookings_source_src_28000.paid_at) AS booking__paid_at__extract_quarter , EXTRACT(month FROM bookings_source_src_28000.paid_at) AS booking__paid_at__extract_month @@ -242,10 +242,10 @@ FROM ( -- Join to Time Spine Dataset SELECT subq_7.booking__ds__day AS booking__ds__day - , DATE_TRUNC(subq_7.booking__ds__day, isoweek) AS booking__ds__week - , DATE_TRUNC(subq_7.booking__ds__day, month) AS booking__ds__month - , DATE_TRUNC(subq_7.booking__ds__day, quarter) AS booking__ds__quarter - , DATE_TRUNC(subq_7.booking__ds__day, year) AS booking__ds__year + , DATETIME_TRUNC(subq_7.booking__ds__day, isoweek) AS booking__ds__week + , DATETIME_TRUNC(subq_7.booking__ds__day, month) AS booking__ds__month + , DATETIME_TRUNC(subq_7.booking__ds__day, quarter) AS booking__ds__quarter + , DATETIME_TRUNC(subq_7.booking__ds__day, year) AS booking__ds__year , EXTRACT(year FROM subq_7.booking__ds__day) AS booking__ds__extract_year , EXTRACT(quarter FROM subq_7.booking__ds__day) AS booking__ds__extract_quarter , EXTRACT(month FROM subq_7.booking__ds__day) AS booking__ds__extract_month @@ -464,33 +464,33 @@ FROM ( , bookings_source_src_28000.booking_value AS approximate_continuous_booking_value_p99 , bookings_source_src_28000.booking_value AS approximate_discrete_booking_value_p99 , bookings_source_src_28000.is_instant - , DATE_TRUNC(bookings_source_src_28000.ds, day) AS ds__day - , DATE_TRUNC(bookings_source_src_28000.ds, isoweek) AS ds__week - , DATE_TRUNC(bookings_source_src_28000.ds, month) AS ds__month - , DATE_TRUNC(bookings_source_src_28000.ds, quarter) AS ds__quarter - , DATE_TRUNC(bookings_source_src_28000.ds, year) AS ds__year + , DATETIME_TRUNC(bookings_source_src_28000.ds, day) AS ds__day + , DATETIME_TRUNC(bookings_source_src_28000.ds, isoweek) AS ds__week + , DATETIME_TRUNC(bookings_source_src_28000.ds, month) AS ds__month + , DATETIME_TRUNC(bookings_source_src_28000.ds, quarter) AS ds__quarter + , DATETIME_TRUNC(bookings_source_src_28000.ds, year) AS ds__year , EXTRACT(year FROM bookings_source_src_28000.ds) AS ds__extract_year , EXTRACT(quarter FROM bookings_source_src_28000.ds) AS ds__extract_quarter , EXTRACT(month FROM bookings_source_src_28000.ds) AS ds__extract_month , EXTRACT(day FROM bookings_source_src_28000.ds) AS ds__extract_day , IF(EXTRACT(dayofweek FROM bookings_source_src_28000.ds) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_28000.ds) - 1) AS ds__extract_dow , EXTRACT(dayofyear FROM bookings_source_src_28000.ds) AS ds__extract_doy - , DATE_TRUNC(bookings_source_src_28000.ds_partitioned, day) AS ds_partitioned__day - , DATE_TRUNC(bookings_source_src_28000.ds_partitioned, isoweek) AS ds_partitioned__week - , DATE_TRUNC(bookings_source_src_28000.ds_partitioned, month) AS ds_partitioned__month - , DATE_TRUNC(bookings_source_src_28000.ds_partitioned, quarter) AS ds_partitioned__quarter - , DATE_TRUNC(bookings_source_src_28000.ds_partitioned, year) AS ds_partitioned__year + , DATETIME_TRUNC(bookings_source_src_28000.ds_partitioned, day) AS ds_partitioned__day + , DATETIME_TRUNC(bookings_source_src_28000.ds_partitioned, isoweek) AS ds_partitioned__week + , DATETIME_TRUNC(bookings_source_src_28000.ds_partitioned, month) AS ds_partitioned__month + , DATETIME_TRUNC(bookings_source_src_28000.ds_partitioned, quarter) AS ds_partitioned__quarter + , DATETIME_TRUNC(bookings_source_src_28000.ds_partitioned, year) AS ds_partitioned__year , EXTRACT(year FROM bookings_source_src_28000.ds_partitioned) AS ds_partitioned__extract_year , EXTRACT(quarter FROM bookings_source_src_28000.ds_partitioned) AS ds_partitioned__extract_quarter , EXTRACT(month FROM bookings_source_src_28000.ds_partitioned) AS ds_partitioned__extract_month , EXTRACT(day FROM bookings_source_src_28000.ds_partitioned) AS ds_partitioned__extract_day , IF(EXTRACT(dayofweek FROM bookings_source_src_28000.ds_partitioned) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_28000.ds_partitioned) - 1) AS ds_partitioned__extract_dow , EXTRACT(dayofyear FROM bookings_source_src_28000.ds_partitioned) AS ds_partitioned__extract_doy - , DATE_TRUNC(bookings_source_src_28000.paid_at, day) AS paid_at__day - , DATE_TRUNC(bookings_source_src_28000.paid_at, isoweek) AS paid_at__week - , DATE_TRUNC(bookings_source_src_28000.paid_at, month) AS paid_at__month - , DATE_TRUNC(bookings_source_src_28000.paid_at, quarter) AS paid_at__quarter - , DATE_TRUNC(bookings_source_src_28000.paid_at, year) AS paid_at__year + , DATETIME_TRUNC(bookings_source_src_28000.paid_at, day) AS paid_at__day + , DATETIME_TRUNC(bookings_source_src_28000.paid_at, isoweek) AS paid_at__week + , DATETIME_TRUNC(bookings_source_src_28000.paid_at, month) AS paid_at__month + , DATETIME_TRUNC(bookings_source_src_28000.paid_at, quarter) AS paid_at__quarter + , DATETIME_TRUNC(bookings_source_src_28000.paid_at, year) AS paid_at__year , EXTRACT(year FROM bookings_source_src_28000.paid_at) AS paid_at__extract_year , EXTRACT(quarter FROM bookings_source_src_28000.paid_at) AS paid_at__extract_quarter , EXTRACT(month FROM bookings_source_src_28000.paid_at) AS paid_at__extract_month @@ -498,33 +498,33 @@ FROM ( , IF(EXTRACT(dayofweek FROM bookings_source_src_28000.paid_at) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_28000.paid_at) - 1) AS paid_at__extract_dow , EXTRACT(dayofyear FROM bookings_source_src_28000.paid_at) AS paid_at__extract_doy , bookings_source_src_28000.is_instant AS booking__is_instant - , DATE_TRUNC(bookings_source_src_28000.ds, day) AS booking__ds__day - , DATE_TRUNC(bookings_source_src_28000.ds, isoweek) AS booking__ds__week - , DATE_TRUNC(bookings_source_src_28000.ds, month) AS booking__ds__month - , DATE_TRUNC(bookings_source_src_28000.ds, quarter) AS booking__ds__quarter - , DATE_TRUNC(bookings_source_src_28000.ds, year) AS booking__ds__year + , DATETIME_TRUNC(bookings_source_src_28000.ds, day) AS booking__ds__day + , DATETIME_TRUNC(bookings_source_src_28000.ds, isoweek) AS booking__ds__week + , DATETIME_TRUNC(bookings_source_src_28000.ds, month) AS booking__ds__month + , DATETIME_TRUNC(bookings_source_src_28000.ds, quarter) AS booking__ds__quarter + , DATETIME_TRUNC(bookings_source_src_28000.ds, year) AS booking__ds__year , EXTRACT(year FROM bookings_source_src_28000.ds) AS booking__ds__extract_year , EXTRACT(quarter FROM bookings_source_src_28000.ds) AS booking__ds__extract_quarter , EXTRACT(month FROM bookings_source_src_28000.ds) AS booking__ds__extract_month , EXTRACT(day FROM bookings_source_src_28000.ds) AS booking__ds__extract_day , IF(EXTRACT(dayofweek FROM bookings_source_src_28000.ds) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_28000.ds) - 1) AS booking__ds__extract_dow , EXTRACT(dayofyear FROM bookings_source_src_28000.ds) AS booking__ds__extract_doy - , DATE_TRUNC(bookings_source_src_28000.ds_partitioned, day) AS booking__ds_partitioned__day - , DATE_TRUNC(bookings_source_src_28000.ds_partitioned, isoweek) AS booking__ds_partitioned__week - , DATE_TRUNC(bookings_source_src_28000.ds_partitioned, month) AS booking__ds_partitioned__month - , DATE_TRUNC(bookings_source_src_28000.ds_partitioned, quarter) AS booking__ds_partitioned__quarter - , DATE_TRUNC(bookings_source_src_28000.ds_partitioned, year) AS booking__ds_partitioned__year + , DATETIME_TRUNC(bookings_source_src_28000.ds_partitioned, day) AS booking__ds_partitioned__day + , DATETIME_TRUNC(bookings_source_src_28000.ds_partitioned, isoweek) AS booking__ds_partitioned__week + , DATETIME_TRUNC(bookings_source_src_28000.ds_partitioned, month) AS booking__ds_partitioned__month + , DATETIME_TRUNC(bookings_source_src_28000.ds_partitioned, quarter) AS booking__ds_partitioned__quarter + , DATETIME_TRUNC(bookings_source_src_28000.ds_partitioned, year) AS booking__ds_partitioned__year , EXTRACT(year FROM bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__extract_year , EXTRACT(quarter FROM bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__extract_quarter , EXTRACT(month FROM bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__extract_month , EXTRACT(day FROM bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__extract_day , IF(EXTRACT(dayofweek FROM bookings_source_src_28000.ds_partitioned) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_28000.ds_partitioned) - 1) AS booking__ds_partitioned__extract_dow , EXTRACT(dayofyear FROM bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__extract_doy - , DATE_TRUNC(bookings_source_src_28000.paid_at, day) AS booking__paid_at__day - , DATE_TRUNC(bookings_source_src_28000.paid_at, isoweek) AS booking__paid_at__week - , DATE_TRUNC(bookings_source_src_28000.paid_at, month) AS booking__paid_at__month - , DATE_TRUNC(bookings_source_src_28000.paid_at, quarter) AS booking__paid_at__quarter - , DATE_TRUNC(bookings_source_src_28000.paid_at, year) AS booking__paid_at__year + , DATETIME_TRUNC(bookings_source_src_28000.paid_at, day) AS booking__paid_at__day + , DATETIME_TRUNC(bookings_source_src_28000.paid_at, isoweek) AS booking__paid_at__week + , DATETIME_TRUNC(bookings_source_src_28000.paid_at, month) AS booking__paid_at__month + , DATETIME_TRUNC(bookings_source_src_28000.paid_at, quarter) AS booking__paid_at__quarter + , DATETIME_TRUNC(bookings_source_src_28000.paid_at, year) AS booking__paid_at__year , EXTRACT(year FROM bookings_source_src_28000.paid_at) AS booking__paid_at__extract_year , EXTRACT(quarter FROM bookings_source_src_28000.paid_at) AS booking__paid_at__extract_quarter , EXTRACT(month FROM bookings_source_src_28000.paid_at) AS booking__paid_at__extract_month diff --git a/tests_metricflow/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/BigQuery/test_offset_window_with_agg_time_dim__plan0_optimized.sql b/tests_metricflow/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/BigQuery/test_offset_window_with_agg_time_dim__plan0_optimized.sql index 51273e495b..085f915e3c 100644 --- a/tests_metricflow/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/BigQuery/test_offset_window_with_agg_time_dim__plan0_optimized.sql +++ b/tests_metricflow/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/BigQuery/test_offset_window_with_agg_time_dim__plan0_optimized.sql @@ -19,7 +19,7 @@ FROM ( -- Metric Time Dimension 'ds' -- Pass Only Elements: ['bookings', 'booking__ds__day'] SELECT - DATE_TRUNC(ds, day) AS booking__ds__day + DATETIME_TRUNC(ds, day) AS booking__ds__day , 1 AS bookings FROM ***************************.fct_bookings bookings_source_src_28000 ) subq_16 @@ -39,7 +39,7 @@ FROM ( -- Read Elements From Semantic Model 'bookings_source' -- Metric Time Dimension 'ds' SELECT - DATE_TRUNC(ds, day) AS booking__ds__day + DATETIME_TRUNC(ds, day) AS booking__ds__day , 1 AS bookings FROM ***************************.fct_bookings bookings_source_src_28000 ) subq_20 diff --git a/tests_metricflow/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/BigQuery/test_time_offset_metric_with_time_constraint__plan0.sql b/tests_metricflow/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/BigQuery/test_time_offset_metric_with_time_constraint__plan0.sql index 300c2d0c9a..d97a1ed56d 100644 --- a/tests_metricflow/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/BigQuery/test_time_offset_metric_with_time_constraint__plan0.sql +++ b/tests_metricflow/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/BigQuery/test_time_offset_metric_with_time_constraint__plan0.sql @@ -21,10 +21,10 @@ FROM ( -- Join to Time Spine Dataset SELECT subq_2.metric_time__day AS metric_time__day - , DATE_TRUNC(subq_2.metric_time__day, isoweek) AS metric_time__week - , DATE_TRUNC(subq_2.metric_time__day, month) AS metric_time__month - , DATE_TRUNC(subq_2.metric_time__day, quarter) AS metric_time__quarter - , DATE_TRUNC(subq_2.metric_time__day, year) AS metric_time__year + , DATETIME_TRUNC(subq_2.metric_time__day, isoweek) AS metric_time__week + , DATETIME_TRUNC(subq_2.metric_time__day, month) AS metric_time__month + , DATETIME_TRUNC(subq_2.metric_time__day, quarter) AS metric_time__quarter + , DATETIME_TRUNC(subq_2.metric_time__day, year) AS metric_time__year , EXTRACT(year FROM subq_2.metric_time__day) AS metric_time__extract_year , EXTRACT(quarter FROM subq_2.metric_time__day) AS metric_time__extract_quarter , EXTRACT(month FROM subq_2.metric_time__day) AS metric_time__extract_month @@ -244,33 +244,33 @@ FROM ( , bookings_source_src_28000.booking_value AS approximate_continuous_booking_value_p99 , bookings_source_src_28000.booking_value AS approximate_discrete_booking_value_p99 , bookings_source_src_28000.is_instant - , DATE_TRUNC(bookings_source_src_28000.ds, day) AS ds__day - , DATE_TRUNC(bookings_source_src_28000.ds, isoweek) AS ds__week - , DATE_TRUNC(bookings_source_src_28000.ds, month) AS ds__month - , DATE_TRUNC(bookings_source_src_28000.ds, quarter) AS ds__quarter - , DATE_TRUNC(bookings_source_src_28000.ds, year) AS ds__year + , DATETIME_TRUNC(bookings_source_src_28000.ds, day) AS ds__day + , DATETIME_TRUNC(bookings_source_src_28000.ds, isoweek) AS ds__week + , DATETIME_TRUNC(bookings_source_src_28000.ds, month) AS ds__month + , DATETIME_TRUNC(bookings_source_src_28000.ds, quarter) AS ds__quarter + , DATETIME_TRUNC(bookings_source_src_28000.ds, year) AS ds__year , EXTRACT(year FROM bookings_source_src_28000.ds) AS ds__extract_year , EXTRACT(quarter FROM bookings_source_src_28000.ds) AS ds__extract_quarter , EXTRACT(month FROM bookings_source_src_28000.ds) AS ds__extract_month , EXTRACT(day FROM bookings_source_src_28000.ds) AS ds__extract_day , IF(EXTRACT(dayofweek FROM bookings_source_src_28000.ds) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_28000.ds) - 1) AS ds__extract_dow , EXTRACT(dayofyear FROM bookings_source_src_28000.ds) AS ds__extract_doy - , DATE_TRUNC(bookings_source_src_28000.ds_partitioned, day) AS ds_partitioned__day - , DATE_TRUNC(bookings_source_src_28000.ds_partitioned, isoweek) AS ds_partitioned__week - , DATE_TRUNC(bookings_source_src_28000.ds_partitioned, month) AS ds_partitioned__month - , DATE_TRUNC(bookings_source_src_28000.ds_partitioned, quarter) AS ds_partitioned__quarter - , DATE_TRUNC(bookings_source_src_28000.ds_partitioned, year) AS ds_partitioned__year + , DATETIME_TRUNC(bookings_source_src_28000.ds_partitioned, day) AS ds_partitioned__day + , DATETIME_TRUNC(bookings_source_src_28000.ds_partitioned, isoweek) AS ds_partitioned__week + , DATETIME_TRUNC(bookings_source_src_28000.ds_partitioned, month) AS ds_partitioned__month + , DATETIME_TRUNC(bookings_source_src_28000.ds_partitioned, quarter) AS ds_partitioned__quarter + , DATETIME_TRUNC(bookings_source_src_28000.ds_partitioned, year) AS ds_partitioned__year , EXTRACT(year FROM bookings_source_src_28000.ds_partitioned) AS ds_partitioned__extract_year , EXTRACT(quarter FROM bookings_source_src_28000.ds_partitioned) AS ds_partitioned__extract_quarter , EXTRACT(month FROM bookings_source_src_28000.ds_partitioned) AS ds_partitioned__extract_month , EXTRACT(day FROM bookings_source_src_28000.ds_partitioned) AS ds_partitioned__extract_day , IF(EXTRACT(dayofweek FROM bookings_source_src_28000.ds_partitioned) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_28000.ds_partitioned) - 1) AS ds_partitioned__extract_dow , EXTRACT(dayofyear FROM bookings_source_src_28000.ds_partitioned) AS ds_partitioned__extract_doy - , DATE_TRUNC(bookings_source_src_28000.paid_at, day) AS paid_at__day - , DATE_TRUNC(bookings_source_src_28000.paid_at, isoweek) AS paid_at__week - , DATE_TRUNC(bookings_source_src_28000.paid_at, month) AS paid_at__month - , DATE_TRUNC(bookings_source_src_28000.paid_at, quarter) AS paid_at__quarter - , DATE_TRUNC(bookings_source_src_28000.paid_at, year) AS paid_at__year + , DATETIME_TRUNC(bookings_source_src_28000.paid_at, day) AS paid_at__day + , DATETIME_TRUNC(bookings_source_src_28000.paid_at, isoweek) AS paid_at__week + , DATETIME_TRUNC(bookings_source_src_28000.paid_at, month) AS paid_at__month + , DATETIME_TRUNC(bookings_source_src_28000.paid_at, quarter) AS paid_at__quarter + , DATETIME_TRUNC(bookings_source_src_28000.paid_at, year) AS paid_at__year , EXTRACT(year FROM bookings_source_src_28000.paid_at) AS paid_at__extract_year , EXTRACT(quarter FROM bookings_source_src_28000.paid_at) AS paid_at__extract_quarter , EXTRACT(month FROM bookings_source_src_28000.paid_at) AS paid_at__extract_month @@ -278,33 +278,33 @@ FROM ( , IF(EXTRACT(dayofweek FROM bookings_source_src_28000.paid_at) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_28000.paid_at) - 1) AS paid_at__extract_dow , EXTRACT(dayofyear FROM bookings_source_src_28000.paid_at) AS paid_at__extract_doy , bookings_source_src_28000.is_instant AS booking__is_instant - , DATE_TRUNC(bookings_source_src_28000.ds, day) AS booking__ds__day - , DATE_TRUNC(bookings_source_src_28000.ds, isoweek) AS booking__ds__week - , DATE_TRUNC(bookings_source_src_28000.ds, month) AS booking__ds__month - , DATE_TRUNC(bookings_source_src_28000.ds, quarter) AS booking__ds__quarter - , DATE_TRUNC(bookings_source_src_28000.ds, year) AS booking__ds__year + , DATETIME_TRUNC(bookings_source_src_28000.ds, day) AS booking__ds__day + , DATETIME_TRUNC(bookings_source_src_28000.ds, isoweek) AS booking__ds__week + , DATETIME_TRUNC(bookings_source_src_28000.ds, month) AS booking__ds__month + , DATETIME_TRUNC(bookings_source_src_28000.ds, quarter) AS booking__ds__quarter + , DATETIME_TRUNC(bookings_source_src_28000.ds, year) AS booking__ds__year , EXTRACT(year FROM bookings_source_src_28000.ds) AS booking__ds__extract_year , EXTRACT(quarter FROM bookings_source_src_28000.ds) AS booking__ds__extract_quarter , EXTRACT(month FROM bookings_source_src_28000.ds) AS booking__ds__extract_month , EXTRACT(day FROM bookings_source_src_28000.ds) AS booking__ds__extract_day , IF(EXTRACT(dayofweek FROM bookings_source_src_28000.ds) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_28000.ds) - 1) AS booking__ds__extract_dow , EXTRACT(dayofyear FROM bookings_source_src_28000.ds) AS booking__ds__extract_doy - , DATE_TRUNC(bookings_source_src_28000.ds_partitioned, day) AS booking__ds_partitioned__day - , DATE_TRUNC(bookings_source_src_28000.ds_partitioned, isoweek) AS booking__ds_partitioned__week - , DATE_TRUNC(bookings_source_src_28000.ds_partitioned, month) AS booking__ds_partitioned__month - , DATE_TRUNC(bookings_source_src_28000.ds_partitioned, quarter) AS booking__ds_partitioned__quarter - , DATE_TRUNC(bookings_source_src_28000.ds_partitioned, year) AS booking__ds_partitioned__year + , DATETIME_TRUNC(bookings_source_src_28000.ds_partitioned, day) AS booking__ds_partitioned__day + , DATETIME_TRUNC(bookings_source_src_28000.ds_partitioned, isoweek) AS booking__ds_partitioned__week + , DATETIME_TRUNC(bookings_source_src_28000.ds_partitioned, month) AS booking__ds_partitioned__month + , DATETIME_TRUNC(bookings_source_src_28000.ds_partitioned, quarter) AS booking__ds_partitioned__quarter + , DATETIME_TRUNC(bookings_source_src_28000.ds_partitioned, year) AS booking__ds_partitioned__year , EXTRACT(year FROM bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__extract_year , EXTRACT(quarter FROM bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__extract_quarter , EXTRACT(month FROM bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__extract_month , EXTRACT(day FROM bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__extract_day , IF(EXTRACT(dayofweek FROM bookings_source_src_28000.ds_partitioned) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_28000.ds_partitioned) - 1) AS booking__ds_partitioned__extract_dow , EXTRACT(dayofyear FROM bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__extract_doy - , DATE_TRUNC(bookings_source_src_28000.paid_at, day) AS booking__paid_at__day - , DATE_TRUNC(bookings_source_src_28000.paid_at, isoweek) AS booking__paid_at__week - , DATE_TRUNC(bookings_source_src_28000.paid_at, month) AS booking__paid_at__month - , DATE_TRUNC(bookings_source_src_28000.paid_at, quarter) AS booking__paid_at__quarter - , DATE_TRUNC(bookings_source_src_28000.paid_at, year) AS booking__paid_at__year + , DATETIME_TRUNC(bookings_source_src_28000.paid_at, day) AS booking__paid_at__day + , DATETIME_TRUNC(bookings_source_src_28000.paid_at, isoweek) AS booking__paid_at__week + , DATETIME_TRUNC(bookings_source_src_28000.paid_at, month) AS booking__paid_at__month + , DATETIME_TRUNC(bookings_source_src_28000.paid_at, quarter) AS booking__paid_at__quarter + , DATETIME_TRUNC(bookings_source_src_28000.paid_at, year) AS booking__paid_at__year , EXTRACT(year FROM bookings_source_src_28000.paid_at) AS booking__paid_at__extract_year , EXTRACT(quarter FROM bookings_source_src_28000.paid_at) AS booking__paid_at__extract_quarter , EXTRACT(month FROM bookings_source_src_28000.paid_at) AS booking__paid_at__extract_month diff --git a/tests_metricflow/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/BigQuery/test_time_offset_metric_with_time_constraint__plan0_optimized.sql b/tests_metricflow/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/BigQuery/test_time_offset_metric_with_time_constraint__plan0_optimized.sql index 577df0861f..7ad43c2901 100644 --- a/tests_metricflow/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/BigQuery/test_time_offset_metric_with_time_constraint__plan0_optimized.sql +++ b/tests_metricflow/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/BigQuery/test_time_offset_metric_with_time_constraint__plan0_optimized.sql @@ -21,7 +21,7 @@ FROM ( -- Read Elements From Semantic Model 'bookings_source' -- Metric Time Dimension 'ds' SELECT - DATE_TRUNC(ds, day) AS metric_time__day + DATETIME_TRUNC(ds, day) AS metric_time__day , 1 AS bookings FROM ***************************.fct_bookings bookings_source_src_28000 ) subq_9 diff --git a/tests_metricflow/snapshots/test_distinct_values_to_sql.py/SqlQueryPlan/BigQuery/test_dimension_values_with_a_join_and_a_filter__plan0.sql b/tests_metricflow/snapshots/test_distinct_values_to_sql.py/SqlQueryPlan/BigQuery/test_dimension_values_with_a_join_and_a_filter__plan0.sql index 0c1597746c..0fa51d4648 100644 --- a/tests_metricflow/snapshots/test_distinct_values_to_sql.py/SqlQueryPlan/BigQuery/test_dimension_values_with_a_join_and_a_filter__plan0.sql +++ b/tests_metricflow/snapshots/test_distinct_values_to_sql.py/SqlQueryPlan/BigQuery/test_dimension_values_with_a_join_and_a_filter__plan0.sql @@ -128,22 +128,22 @@ FROM ( 1 AS listings , listings_latest_src_28000.capacity AS largest_listing , listings_latest_src_28000.capacity AS smallest_listing - , DATE_TRUNC(listings_latest_src_28000.created_at, day) AS ds__day - , DATE_TRUNC(listings_latest_src_28000.created_at, isoweek) AS ds__week - , DATE_TRUNC(listings_latest_src_28000.created_at, month) AS ds__month - , DATE_TRUNC(listings_latest_src_28000.created_at, quarter) AS ds__quarter - , DATE_TRUNC(listings_latest_src_28000.created_at, year) AS ds__year + , DATETIME_TRUNC(listings_latest_src_28000.created_at, day) AS ds__day + , DATETIME_TRUNC(listings_latest_src_28000.created_at, isoweek) AS ds__week + , DATETIME_TRUNC(listings_latest_src_28000.created_at, month) AS ds__month + , DATETIME_TRUNC(listings_latest_src_28000.created_at, quarter) AS ds__quarter + , DATETIME_TRUNC(listings_latest_src_28000.created_at, year) AS ds__year , EXTRACT(year FROM listings_latest_src_28000.created_at) AS ds__extract_year , EXTRACT(quarter FROM listings_latest_src_28000.created_at) AS ds__extract_quarter , EXTRACT(month FROM listings_latest_src_28000.created_at) AS ds__extract_month , EXTRACT(day FROM listings_latest_src_28000.created_at) AS ds__extract_day , IF(EXTRACT(dayofweek FROM listings_latest_src_28000.created_at) = 1, 7, EXTRACT(dayofweek FROM listings_latest_src_28000.created_at) - 1) AS ds__extract_dow , EXTRACT(dayofyear FROM listings_latest_src_28000.created_at) AS ds__extract_doy - , DATE_TRUNC(listings_latest_src_28000.created_at, day) AS created_at__day - , DATE_TRUNC(listings_latest_src_28000.created_at, isoweek) AS created_at__week - , DATE_TRUNC(listings_latest_src_28000.created_at, month) AS created_at__month - , DATE_TRUNC(listings_latest_src_28000.created_at, quarter) AS created_at__quarter - , DATE_TRUNC(listings_latest_src_28000.created_at, year) AS created_at__year + , DATETIME_TRUNC(listings_latest_src_28000.created_at, day) AS created_at__day + , DATETIME_TRUNC(listings_latest_src_28000.created_at, isoweek) AS created_at__week + , DATETIME_TRUNC(listings_latest_src_28000.created_at, month) AS created_at__month + , DATETIME_TRUNC(listings_latest_src_28000.created_at, quarter) AS created_at__quarter + , DATETIME_TRUNC(listings_latest_src_28000.created_at, year) AS created_at__year , EXTRACT(year FROM listings_latest_src_28000.created_at) AS created_at__extract_year , EXTRACT(quarter FROM listings_latest_src_28000.created_at) AS created_at__extract_quarter , EXTRACT(month FROM listings_latest_src_28000.created_at) AS created_at__extract_month @@ -153,22 +153,22 @@ FROM ( , listings_latest_src_28000.country AS country_latest , listings_latest_src_28000.is_lux AS is_lux_latest , listings_latest_src_28000.capacity AS capacity_latest - , DATE_TRUNC(listings_latest_src_28000.created_at, day) AS listing__ds__day - , DATE_TRUNC(listings_latest_src_28000.created_at, isoweek) AS listing__ds__week - , DATE_TRUNC(listings_latest_src_28000.created_at, month) AS listing__ds__month - , DATE_TRUNC(listings_latest_src_28000.created_at, quarter) AS listing__ds__quarter - , DATE_TRUNC(listings_latest_src_28000.created_at, year) AS listing__ds__year + , DATETIME_TRUNC(listings_latest_src_28000.created_at, day) AS listing__ds__day + , DATETIME_TRUNC(listings_latest_src_28000.created_at, isoweek) AS listing__ds__week + , DATETIME_TRUNC(listings_latest_src_28000.created_at, month) AS listing__ds__month + , DATETIME_TRUNC(listings_latest_src_28000.created_at, quarter) AS listing__ds__quarter + , DATETIME_TRUNC(listings_latest_src_28000.created_at, year) AS listing__ds__year , EXTRACT(year FROM listings_latest_src_28000.created_at) AS listing__ds__extract_year , EXTRACT(quarter FROM listings_latest_src_28000.created_at) AS listing__ds__extract_quarter , EXTRACT(month FROM listings_latest_src_28000.created_at) AS listing__ds__extract_month , EXTRACT(day FROM listings_latest_src_28000.created_at) AS listing__ds__extract_day , IF(EXTRACT(dayofweek FROM listings_latest_src_28000.created_at) = 1, 7, EXTRACT(dayofweek FROM listings_latest_src_28000.created_at) - 1) AS listing__ds__extract_dow , EXTRACT(dayofyear FROM listings_latest_src_28000.created_at) AS listing__ds__extract_doy - , DATE_TRUNC(listings_latest_src_28000.created_at, day) AS listing__created_at__day - , DATE_TRUNC(listings_latest_src_28000.created_at, isoweek) AS listing__created_at__week - , DATE_TRUNC(listings_latest_src_28000.created_at, month) AS listing__created_at__month - , DATE_TRUNC(listings_latest_src_28000.created_at, quarter) AS listing__created_at__quarter - , DATE_TRUNC(listings_latest_src_28000.created_at, year) AS listing__created_at__year + , DATETIME_TRUNC(listings_latest_src_28000.created_at, day) AS listing__created_at__day + , DATETIME_TRUNC(listings_latest_src_28000.created_at, isoweek) AS listing__created_at__week + , DATETIME_TRUNC(listings_latest_src_28000.created_at, month) AS listing__created_at__month + , DATETIME_TRUNC(listings_latest_src_28000.created_at, quarter) AS listing__created_at__quarter + , DATETIME_TRUNC(listings_latest_src_28000.created_at, year) AS listing__created_at__year , EXTRACT(year FROM listings_latest_src_28000.created_at) AS listing__created_at__extract_year , EXTRACT(quarter FROM listings_latest_src_28000.created_at) AS listing__created_at__extract_quarter , EXTRACT(month FROM listings_latest_src_28000.created_at) AS listing__created_at__extract_month @@ -191,11 +191,11 @@ FROM ( FROM ( -- Read Elements From Semantic Model 'users_latest' SELECT - DATE_TRUNC(users_latest_src_28000.ds, day) AS ds_latest__day - , DATE_TRUNC(users_latest_src_28000.ds, isoweek) AS ds_latest__week - , DATE_TRUNC(users_latest_src_28000.ds, month) AS ds_latest__month - , DATE_TRUNC(users_latest_src_28000.ds, quarter) AS ds_latest__quarter - , DATE_TRUNC(users_latest_src_28000.ds, year) AS ds_latest__year + DATETIME_TRUNC(users_latest_src_28000.ds, day) AS ds_latest__day + , DATETIME_TRUNC(users_latest_src_28000.ds, isoweek) AS ds_latest__week + , DATETIME_TRUNC(users_latest_src_28000.ds, month) AS ds_latest__month + , DATETIME_TRUNC(users_latest_src_28000.ds, quarter) AS ds_latest__quarter + , DATETIME_TRUNC(users_latest_src_28000.ds, year) AS ds_latest__year , EXTRACT(year FROM users_latest_src_28000.ds) AS ds_latest__extract_year , EXTRACT(quarter FROM users_latest_src_28000.ds) AS ds_latest__extract_quarter , EXTRACT(month FROM users_latest_src_28000.ds) AS ds_latest__extract_month @@ -203,11 +203,11 @@ FROM ( , IF(EXTRACT(dayofweek FROM users_latest_src_28000.ds) = 1, 7, EXTRACT(dayofweek FROM users_latest_src_28000.ds) - 1) AS ds_latest__extract_dow , EXTRACT(dayofyear FROM users_latest_src_28000.ds) AS ds_latest__extract_doy , users_latest_src_28000.home_state_latest - , DATE_TRUNC(users_latest_src_28000.ds, day) AS user__ds_latest__day - , DATE_TRUNC(users_latest_src_28000.ds, isoweek) AS user__ds_latest__week - , DATE_TRUNC(users_latest_src_28000.ds, month) AS user__ds_latest__month - , DATE_TRUNC(users_latest_src_28000.ds, quarter) AS user__ds_latest__quarter - , DATE_TRUNC(users_latest_src_28000.ds, year) AS user__ds_latest__year + , DATETIME_TRUNC(users_latest_src_28000.ds, day) AS user__ds_latest__day + , DATETIME_TRUNC(users_latest_src_28000.ds, isoweek) AS user__ds_latest__week + , DATETIME_TRUNC(users_latest_src_28000.ds, month) AS user__ds_latest__month + , DATETIME_TRUNC(users_latest_src_28000.ds, quarter) AS user__ds_latest__quarter + , DATETIME_TRUNC(users_latest_src_28000.ds, year) AS user__ds_latest__year , EXTRACT(year FROM users_latest_src_28000.ds) AS user__ds_latest__extract_year , EXTRACT(quarter FROM users_latest_src_28000.ds) AS user__ds_latest__extract_quarter , EXTRACT(month FROM users_latest_src_28000.ds) AS user__ds_latest__extract_month diff --git a/tests_metricflow/snapshots/test_distinct_values_to_sql.py/SqlQueryPlan/BigQuery/test_dimensions_requiring_join__plan0.sql b/tests_metricflow/snapshots/test_distinct_values_to_sql.py/SqlQueryPlan/BigQuery/test_dimensions_requiring_join__plan0.sql index ebe3631edd..f112ad4699 100644 --- a/tests_metricflow/snapshots/test_distinct_values_to_sql.py/SqlQueryPlan/BigQuery/test_dimensions_requiring_join__plan0.sql +++ b/tests_metricflow/snapshots/test_distinct_values_to_sql.py/SqlQueryPlan/BigQuery/test_dimensions_requiring_join__plan0.sql @@ -68,22 +68,22 @@ FROM ( 1 AS listings , listings_latest_src_28000.capacity AS largest_listing , listings_latest_src_28000.capacity AS smallest_listing - , DATE_TRUNC(listings_latest_src_28000.created_at, day) AS ds__day - , DATE_TRUNC(listings_latest_src_28000.created_at, isoweek) AS ds__week - , DATE_TRUNC(listings_latest_src_28000.created_at, month) AS ds__month - , DATE_TRUNC(listings_latest_src_28000.created_at, quarter) AS ds__quarter - , DATE_TRUNC(listings_latest_src_28000.created_at, year) AS ds__year + , DATETIME_TRUNC(listings_latest_src_28000.created_at, day) AS ds__day + , DATETIME_TRUNC(listings_latest_src_28000.created_at, isoweek) AS ds__week + , DATETIME_TRUNC(listings_latest_src_28000.created_at, month) AS ds__month + , DATETIME_TRUNC(listings_latest_src_28000.created_at, quarter) AS ds__quarter + , DATETIME_TRUNC(listings_latest_src_28000.created_at, year) AS ds__year , EXTRACT(year FROM listings_latest_src_28000.created_at) AS ds__extract_year , EXTRACT(quarter FROM listings_latest_src_28000.created_at) AS ds__extract_quarter , EXTRACT(month FROM listings_latest_src_28000.created_at) AS ds__extract_month , EXTRACT(day FROM listings_latest_src_28000.created_at) AS ds__extract_day , IF(EXTRACT(dayofweek FROM listings_latest_src_28000.created_at) = 1, 7, EXTRACT(dayofweek FROM listings_latest_src_28000.created_at) - 1) AS ds__extract_dow , EXTRACT(dayofyear FROM listings_latest_src_28000.created_at) AS ds__extract_doy - , DATE_TRUNC(listings_latest_src_28000.created_at, day) AS created_at__day - , DATE_TRUNC(listings_latest_src_28000.created_at, isoweek) AS created_at__week - , DATE_TRUNC(listings_latest_src_28000.created_at, month) AS created_at__month - , DATE_TRUNC(listings_latest_src_28000.created_at, quarter) AS created_at__quarter - , DATE_TRUNC(listings_latest_src_28000.created_at, year) AS created_at__year + , DATETIME_TRUNC(listings_latest_src_28000.created_at, day) AS created_at__day + , DATETIME_TRUNC(listings_latest_src_28000.created_at, isoweek) AS created_at__week + , DATETIME_TRUNC(listings_latest_src_28000.created_at, month) AS created_at__month + , DATETIME_TRUNC(listings_latest_src_28000.created_at, quarter) AS created_at__quarter + , DATETIME_TRUNC(listings_latest_src_28000.created_at, year) AS created_at__year , EXTRACT(year FROM listings_latest_src_28000.created_at) AS created_at__extract_year , EXTRACT(quarter FROM listings_latest_src_28000.created_at) AS created_at__extract_quarter , EXTRACT(month FROM listings_latest_src_28000.created_at) AS created_at__extract_month @@ -93,22 +93,22 @@ FROM ( , listings_latest_src_28000.country AS country_latest , listings_latest_src_28000.is_lux AS is_lux_latest , listings_latest_src_28000.capacity AS capacity_latest - , DATE_TRUNC(listings_latest_src_28000.created_at, day) AS listing__ds__day - , DATE_TRUNC(listings_latest_src_28000.created_at, isoweek) AS listing__ds__week - , DATE_TRUNC(listings_latest_src_28000.created_at, month) AS listing__ds__month - , DATE_TRUNC(listings_latest_src_28000.created_at, quarter) AS listing__ds__quarter - , DATE_TRUNC(listings_latest_src_28000.created_at, year) AS listing__ds__year + , DATETIME_TRUNC(listings_latest_src_28000.created_at, day) AS listing__ds__day + , DATETIME_TRUNC(listings_latest_src_28000.created_at, isoweek) AS listing__ds__week + , DATETIME_TRUNC(listings_latest_src_28000.created_at, month) AS listing__ds__month + , DATETIME_TRUNC(listings_latest_src_28000.created_at, quarter) AS listing__ds__quarter + , DATETIME_TRUNC(listings_latest_src_28000.created_at, year) AS listing__ds__year , EXTRACT(year FROM listings_latest_src_28000.created_at) AS listing__ds__extract_year , EXTRACT(quarter FROM listings_latest_src_28000.created_at) AS listing__ds__extract_quarter , EXTRACT(month FROM listings_latest_src_28000.created_at) AS listing__ds__extract_month , EXTRACT(day FROM listings_latest_src_28000.created_at) AS listing__ds__extract_day , IF(EXTRACT(dayofweek FROM listings_latest_src_28000.created_at) = 1, 7, EXTRACT(dayofweek FROM listings_latest_src_28000.created_at) - 1) AS listing__ds__extract_dow , EXTRACT(dayofyear FROM listings_latest_src_28000.created_at) AS listing__ds__extract_doy - , DATE_TRUNC(listings_latest_src_28000.created_at, day) AS listing__created_at__day - , DATE_TRUNC(listings_latest_src_28000.created_at, isoweek) AS listing__created_at__week - , DATE_TRUNC(listings_latest_src_28000.created_at, month) AS listing__created_at__month - , DATE_TRUNC(listings_latest_src_28000.created_at, quarter) AS listing__created_at__quarter - , DATE_TRUNC(listings_latest_src_28000.created_at, year) AS listing__created_at__year + , DATETIME_TRUNC(listings_latest_src_28000.created_at, day) AS listing__created_at__day + , DATETIME_TRUNC(listings_latest_src_28000.created_at, isoweek) AS listing__created_at__week + , DATETIME_TRUNC(listings_latest_src_28000.created_at, month) AS listing__created_at__month + , DATETIME_TRUNC(listings_latest_src_28000.created_at, quarter) AS listing__created_at__quarter + , DATETIME_TRUNC(listings_latest_src_28000.created_at, year) AS listing__created_at__year , EXTRACT(year FROM listings_latest_src_28000.created_at) AS listing__created_at__extract_year , EXTRACT(quarter FROM listings_latest_src_28000.created_at) AS listing__created_at__extract_quarter , EXTRACT(month FROM listings_latest_src_28000.created_at) AS listing__created_at__extract_month @@ -131,11 +131,11 @@ FROM ( FROM ( -- Read Elements From Semantic Model 'users_latest' SELECT - DATE_TRUNC(users_latest_src_28000.ds, day) AS ds_latest__day - , DATE_TRUNC(users_latest_src_28000.ds, isoweek) AS ds_latest__week - , DATE_TRUNC(users_latest_src_28000.ds, month) AS ds_latest__month - , DATE_TRUNC(users_latest_src_28000.ds, quarter) AS ds_latest__quarter - , DATE_TRUNC(users_latest_src_28000.ds, year) AS ds_latest__year + DATETIME_TRUNC(users_latest_src_28000.ds, day) AS ds_latest__day + , DATETIME_TRUNC(users_latest_src_28000.ds, isoweek) AS ds_latest__week + , DATETIME_TRUNC(users_latest_src_28000.ds, month) AS ds_latest__month + , DATETIME_TRUNC(users_latest_src_28000.ds, quarter) AS ds_latest__quarter + , DATETIME_TRUNC(users_latest_src_28000.ds, year) AS ds_latest__year , EXTRACT(year FROM users_latest_src_28000.ds) AS ds_latest__extract_year , EXTRACT(quarter FROM users_latest_src_28000.ds) AS ds_latest__extract_quarter , EXTRACT(month FROM users_latest_src_28000.ds) AS ds_latest__extract_month @@ -143,11 +143,11 @@ FROM ( , IF(EXTRACT(dayofweek FROM users_latest_src_28000.ds) = 1, 7, EXTRACT(dayofweek FROM users_latest_src_28000.ds) - 1) AS ds_latest__extract_dow , EXTRACT(dayofyear FROM users_latest_src_28000.ds) AS ds_latest__extract_doy , users_latest_src_28000.home_state_latest - , DATE_TRUNC(users_latest_src_28000.ds, day) AS user__ds_latest__day - , DATE_TRUNC(users_latest_src_28000.ds, isoweek) AS user__ds_latest__week - , DATE_TRUNC(users_latest_src_28000.ds, month) AS user__ds_latest__month - , DATE_TRUNC(users_latest_src_28000.ds, quarter) AS user__ds_latest__quarter - , DATE_TRUNC(users_latest_src_28000.ds, year) AS user__ds_latest__year + , DATETIME_TRUNC(users_latest_src_28000.ds, day) AS user__ds_latest__day + , DATETIME_TRUNC(users_latest_src_28000.ds, isoweek) AS user__ds_latest__week + , DATETIME_TRUNC(users_latest_src_28000.ds, month) AS user__ds_latest__month + , DATETIME_TRUNC(users_latest_src_28000.ds, quarter) AS user__ds_latest__quarter + , DATETIME_TRUNC(users_latest_src_28000.ds, year) AS user__ds_latest__year , EXTRACT(year FROM users_latest_src_28000.ds) AS user__ds_latest__extract_year , EXTRACT(quarter FROM users_latest_src_28000.ds) AS user__ds_latest__extract_quarter , EXTRACT(month FROM users_latest_src_28000.ds) AS user__ds_latest__extract_month diff --git a/tests_metricflow/snapshots/test_fill_nulls_with_rendering.py/SqlQueryPlan/BigQuery/test_cumulative_fill_nulls__plan0.sql b/tests_metricflow/snapshots/test_fill_nulls_with_rendering.py/SqlQueryPlan/BigQuery/test_cumulative_fill_nulls__plan0.sql index 6b5db05974..8de9be463c 100644 --- a/tests_metricflow/snapshots/test_fill_nulls_with_rendering.py/SqlQueryPlan/BigQuery/test_cumulative_fill_nulls__plan0.sql +++ b/tests_metricflow/snapshots/test_fill_nulls_with_rendering.py/SqlQueryPlan/BigQuery/test_cumulative_fill_nulls__plan0.sql @@ -249,33 +249,33 @@ FROM ( , bookings_source_src_28000.booking_value AS approximate_continuous_booking_value_p99 , bookings_source_src_28000.booking_value AS approximate_discrete_booking_value_p99 , bookings_source_src_28000.is_instant - , DATE_TRUNC(bookings_source_src_28000.ds, day) AS ds__day - , DATE_TRUNC(bookings_source_src_28000.ds, isoweek) AS ds__week - , DATE_TRUNC(bookings_source_src_28000.ds, month) AS ds__month - , DATE_TRUNC(bookings_source_src_28000.ds, quarter) AS ds__quarter - , DATE_TRUNC(bookings_source_src_28000.ds, year) AS ds__year + , DATETIME_TRUNC(bookings_source_src_28000.ds, day) AS ds__day + , DATETIME_TRUNC(bookings_source_src_28000.ds, isoweek) AS ds__week + , DATETIME_TRUNC(bookings_source_src_28000.ds, month) AS ds__month + , DATETIME_TRUNC(bookings_source_src_28000.ds, quarter) AS ds__quarter + , DATETIME_TRUNC(bookings_source_src_28000.ds, year) AS ds__year , EXTRACT(year FROM bookings_source_src_28000.ds) AS ds__extract_year , EXTRACT(quarter FROM bookings_source_src_28000.ds) AS ds__extract_quarter , EXTRACT(month FROM bookings_source_src_28000.ds) AS ds__extract_month , EXTRACT(day FROM bookings_source_src_28000.ds) AS ds__extract_day , IF(EXTRACT(dayofweek FROM bookings_source_src_28000.ds) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_28000.ds) - 1) AS ds__extract_dow , EXTRACT(dayofyear FROM bookings_source_src_28000.ds) AS ds__extract_doy - , DATE_TRUNC(bookings_source_src_28000.ds_partitioned, day) AS ds_partitioned__day - , DATE_TRUNC(bookings_source_src_28000.ds_partitioned, isoweek) AS ds_partitioned__week - , DATE_TRUNC(bookings_source_src_28000.ds_partitioned, month) AS ds_partitioned__month - , DATE_TRUNC(bookings_source_src_28000.ds_partitioned, quarter) AS ds_partitioned__quarter - , DATE_TRUNC(bookings_source_src_28000.ds_partitioned, year) AS ds_partitioned__year + , DATETIME_TRUNC(bookings_source_src_28000.ds_partitioned, day) AS ds_partitioned__day + , DATETIME_TRUNC(bookings_source_src_28000.ds_partitioned, isoweek) AS ds_partitioned__week + , DATETIME_TRUNC(bookings_source_src_28000.ds_partitioned, month) AS ds_partitioned__month + , DATETIME_TRUNC(bookings_source_src_28000.ds_partitioned, quarter) AS ds_partitioned__quarter + , DATETIME_TRUNC(bookings_source_src_28000.ds_partitioned, year) AS ds_partitioned__year , EXTRACT(year FROM bookings_source_src_28000.ds_partitioned) AS ds_partitioned__extract_year , EXTRACT(quarter FROM bookings_source_src_28000.ds_partitioned) AS ds_partitioned__extract_quarter , EXTRACT(month FROM bookings_source_src_28000.ds_partitioned) AS ds_partitioned__extract_month , EXTRACT(day FROM bookings_source_src_28000.ds_partitioned) AS ds_partitioned__extract_day , IF(EXTRACT(dayofweek FROM bookings_source_src_28000.ds_partitioned) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_28000.ds_partitioned) - 1) AS ds_partitioned__extract_dow , EXTRACT(dayofyear FROM bookings_source_src_28000.ds_partitioned) AS ds_partitioned__extract_doy - , DATE_TRUNC(bookings_source_src_28000.paid_at, day) AS paid_at__day - , DATE_TRUNC(bookings_source_src_28000.paid_at, isoweek) AS paid_at__week - , DATE_TRUNC(bookings_source_src_28000.paid_at, month) AS paid_at__month - , DATE_TRUNC(bookings_source_src_28000.paid_at, quarter) AS paid_at__quarter - , DATE_TRUNC(bookings_source_src_28000.paid_at, year) AS paid_at__year + , DATETIME_TRUNC(bookings_source_src_28000.paid_at, day) AS paid_at__day + , DATETIME_TRUNC(bookings_source_src_28000.paid_at, isoweek) AS paid_at__week + , DATETIME_TRUNC(bookings_source_src_28000.paid_at, month) AS paid_at__month + , DATETIME_TRUNC(bookings_source_src_28000.paid_at, quarter) AS paid_at__quarter + , DATETIME_TRUNC(bookings_source_src_28000.paid_at, year) AS paid_at__year , EXTRACT(year FROM bookings_source_src_28000.paid_at) AS paid_at__extract_year , EXTRACT(quarter FROM bookings_source_src_28000.paid_at) AS paid_at__extract_quarter , EXTRACT(month FROM bookings_source_src_28000.paid_at) AS paid_at__extract_month @@ -283,33 +283,33 @@ FROM ( , IF(EXTRACT(dayofweek FROM bookings_source_src_28000.paid_at) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_28000.paid_at) - 1) AS paid_at__extract_dow , EXTRACT(dayofyear FROM bookings_source_src_28000.paid_at) AS paid_at__extract_doy , bookings_source_src_28000.is_instant AS booking__is_instant - , DATE_TRUNC(bookings_source_src_28000.ds, day) AS booking__ds__day - , DATE_TRUNC(bookings_source_src_28000.ds, isoweek) AS booking__ds__week - , DATE_TRUNC(bookings_source_src_28000.ds, month) AS booking__ds__month - , DATE_TRUNC(bookings_source_src_28000.ds, quarter) AS booking__ds__quarter - , DATE_TRUNC(bookings_source_src_28000.ds, year) AS booking__ds__year + , DATETIME_TRUNC(bookings_source_src_28000.ds, day) AS booking__ds__day + , DATETIME_TRUNC(bookings_source_src_28000.ds, isoweek) AS booking__ds__week + , DATETIME_TRUNC(bookings_source_src_28000.ds, month) AS booking__ds__month + , DATETIME_TRUNC(bookings_source_src_28000.ds, quarter) AS booking__ds__quarter + , DATETIME_TRUNC(bookings_source_src_28000.ds, year) AS booking__ds__year , EXTRACT(year FROM bookings_source_src_28000.ds) AS booking__ds__extract_year , EXTRACT(quarter FROM bookings_source_src_28000.ds) AS booking__ds__extract_quarter , EXTRACT(month FROM bookings_source_src_28000.ds) AS booking__ds__extract_month , EXTRACT(day FROM bookings_source_src_28000.ds) AS booking__ds__extract_day , IF(EXTRACT(dayofweek FROM bookings_source_src_28000.ds) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_28000.ds) - 1) AS booking__ds__extract_dow , EXTRACT(dayofyear FROM bookings_source_src_28000.ds) AS booking__ds__extract_doy - , DATE_TRUNC(bookings_source_src_28000.ds_partitioned, day) AS booking__ds_partitioned__day - , DATE_TRUNC(bookings_source_src_28000.ds_partitioned, isoweek) AS booking__ds_partitioned__week - , DATE_TRUNC(bookings_source_src_28000.ds_partitioned, month) AS booking__ds_partitioned__month - , DATE_TRUNC(bookings_source_src_28000.ds_partitioned, quarter) AS booking__ds_partitioned__quarter - , DATE_TRUNC(bookings_source_src_28000.ds_partitioned, year) AS booking__ds_partitioned__year + , DATETIME_TRUNC(bookings_source_src_28000.ds_partitioned, day) AS booking__ds_partitioned__day + , DATETIME_TRUNC(bookings_source_src_28000.ds_partitioned, isoweek) AS booking__ds_partitioned__week + , DATETIME_TRUNC(bookings_source_src_28000.ds_partitioned, month) AS booking__ds_partitioned__month + , DATETIME_TRUNC(bookings_source_src_28000.ds_partitioned, quarter) AS booking__ds_partitioned__quarter + , DATETIME_TRUNC(bookings_source_src_28000.ds_partitioned, year) AS booking__ds_partitioned__year , EXTRACT(year FROM bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__extract_year , EXTRACT(quarter FROM bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__extract_quarter , EXTRACT(month FROM bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__extract_month , EXTRACT(day FROM bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__extract_day , IF(EXTRACT(dayofweek FROM bookings_source_src_28000.ds_partitioned) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_28000.ds_partitioned) - 1) AS booking__ds_partitioned__extract_dow , EXTRACT(dayofyear FROM bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__extract_doy - , DATE_TRUNC(bookings_source_src_28000.paid_at, day) AS booking__paid_at__day - , DATE_TRUNC(bookings_source_src_28000.paid_at, isoweek) AS booking__paid_at__week - , DATE_TRUNC(bookings_source_src_28000.paid_at, month) AS booking__paid_at__month - , DATE_TRUNC(bookings_source_src_28000.paid_at, quarter) AS booking__paid_at__quarter - , DATE_TRUNC(bookings_source_src_28000.paid_at, year) AS booking__paid_at__year + , DATETIME_TRUNC(bookings_source_src_28000.paid_at, day) AS booking__paid_at__day + , DATETIME_TRUNC(bookings_source_src_28000.paid_at, isoweek) AS booking__paid_at__week + , DATETIME_TRUNC(bookings_source_src_28000.paid_at, month) AS booking__paid_at__month + , DATETIME_TRUNC(bookings_source_src_28000.paid_at, quarter) AS booking__paid_at__quarter + , DATETIME_TRUNC(bookings_source_src_28000.paid_at, year) AS booking__paid_at__year , EXTRACT(year FROM bookings_source_src_28000.paid_at) AS booking__paid_at__extract_year , EXTRACT(quarter FROM bookings_source_src_28000.paid_at) AS booking__paid_at__extract_quarter , EXTRACT(month FROM bookings_source_src_28000.paid_at) AS booking__paid_at__extract_month diff --git a/tests_metricflow/snapshots/test_fill_nulls_with_rendering.py/SqlQueryPlan/BigQuery/test_cumulative_fill_nulls__plan0_optimized.sql b/tests_metricflow/snapshots/test_fill_nulls_with_rendering.py/SqlQueryPlan/BigQuery/test_cumulative_fill_nulls__plan0_optimized.sql index e7c0532a7b..9f1f38bb1e 100644 --- a/tests_metricflow/snapshots/test_fill_nulls_with_rendering.py/SqlQueryPlan/BigQuery/test_cumulative_fill_nulls__plan0_optimized.sql +++ b/tests_metricflow/snapshots/test_fill_nulls_with_rendering.py/SqlQueryPlan/BigQuery/test_cumulative_fill_nulls__plan0_optimized.sql @@ -20,9 +20,9 @@ FROM ( ***************************.fct_bookings bookings_source_src_28000 ON ( - DATE_TRUNC(bookings_source_src_28000.ds, day) <= subq_13.ds + DATETIME_TRUNC(bookings_source_src_28000.ds, day) <= subq_13.ds ) AND ( - DATE_TRUNC(bookings_source_src_28000.ds, day) > DATE_SUB(CAST(subq_13.ds AS DATETIME), INTERVAL 2 day) + DATETIME_TRUNC(bookings_source_src_28000.ds, day) > DATE_SUB(CAST(subq_13.ds AS DATETIME), INTERVAL 2 day) ) GROUP BY metric_time__day diff --git a/tests_metricflow/snapshots/test_fill_nulls_with_rendering.py/SqlQueryPlan/BigQuery/test_derived_fill_nulls_for_one_input_metric__plan0.sql b/tests_metricflow/snapshots/test_fill_nulls_with_rendering.py/SqlQueryPlan/BigQuery/test_derived_fill_nulls_for_one_input_metric__plan0.sql index b217d55a19..984a4b8ae0 100644 --- a/tests_metricflow/snapshots/test_fill_nulls_with_rendering.py/SqlQueryPlan/BigQuery/test_derived_fill_nulls_for_one_input_metric__plan0.sql +++ b/tests_metricflow/snapshots/test_fill_nulls_with_rendering.py/SqlQueryPlan/BigQuery/test_derived_fill_nulls_for_one_input_metric__plan0.sql @@ -153,33 +153,33 @@ FROM ( , bookings_source_src_28000.booking_value AS approximate_continuous_booking_value_p99 , bookings_source_src_28000.booking_value AS approximate_discrete_booking_value_p99 , bookings_source_src_28000.is_instant - , DATE_TRUNC(bookings_source_src_28000.ds, day) AS ds__day - , DATE_TRUNC(bookings_source_src_28000.ds, isoweek) AS ds__week - , DATE_TRUNC(bookings_source_src_28000.ds, month) AS ds__month - , DATE_TRUNC(bookings_source_src_28000.ds, quarter) AS ds__quarter - , DATE_TRUNC(bookings_source_src_28000.ds, year) AS ds__year + , DATETIME_TRUNC(bookings_source_src_28000.ds, day) AS ds__day + , DATETIME_TRUNC(bookings_source_src_28000.ds, isoweek) AS ds__week + , DATETIME_TRUNC(bookings_source_src_28000.ds, month) AS ds__month + , DATETIME_TRUNC(bookings_source_src_28000.ds, quarter) AS ds__quarter + , DATETIME_TRUNC(bookings_source_src_28000.ds, year) AS ds__year , EXTRACT(year FROM bookings_source_src_28000.ds) AS ds__extract_year , EXTRACT(quarter FROM bookings_source_src_28000.ds) AS ds__extract_quarter , EXTRACT(month FROM bookings_source_src_28000.ds) AS ds__extract_month , EXTRACT(day FROM bookings_source_src_28000.ds) AS ds__extract_day , IF(EXTRACT(dayofweek FROM bookings_source_src_28000.ds) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_28000.ds) - 1) AS ds__extract_dow , EXTRACT(dayofyear FROM bookings_source_src_28000.ds) AS ds__extract_doy - , DATE_TRUNC(bookings_source_src_28000.ds_partitioned, day) AS ds_partitioned__day - , DATE_TRUNC(bookings_source_src_28000.ds_partitioned, isoweek) AS ds_partitioned__week - , DATE_TRUNC(bookings_source_src_28000.ds_partitioned, month) AS ds_partitioned__month - , DATE_TRUNC(bookings_source_src_28000.ds_partitioned, quarter) AS ds_partitioned__quarter - , DATE_TRUNC(bookings_source_src_28000.ds_partitioned, year) AS ds_partitioned__year + , DATETIME_TRUNC(bookings_source_src_28000.ds_partitioned, day) AS ds_partitioned__day + , DATETIME_TRUNC(bookings_source_src_28000.ds_partitioned, isoweek) AS ds_partitioned__week + , DATETIME_TRUNC(bookings_source_src_28000.ds_partitioned, month) AS ds_partitioned__month + , DATETIME_TRUNC(bookings_source_src_28000.ds_partitioned, quarter) AS ds_partitioned__quarter + , DATETIME_TRUNC(bookings_source_src_28000.ds_partitioned, year) AS ds_partitioned__year , EXTRACT(year FROM bookings_source_src_28000.ds_partitioned) AS ds_partitioned__extract_year , EXTRACT(quarter FROM bookings_source_src_28000.ds_partitioned) AS ds_partitioned__extract_quarter , EXTRACT(month FROM bookings_source_src_28000.ds_partitioned) AS ds_partitioned__extract_month , EXTRACT(day FROM bookings_source_src_28000.ds_partitioned) AS ds_partitioned__extract_day , IF(EXTRACT(dayofweek FROM bookings_source_src_28000.ds_partitioned) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_28000.ds_partitioned) - 1) AS ds_partitioned__extract_dow , EXTRACT(dayofyear FROM bookings_source_src_28000.ds_partitioned) AS ds_partitioned__extract_doy - , DATE_TRUNC(bookings_source_src_28000.paid_at, day) AS paid_at__day - , DATE_TRUNC(bookings_source_src_28000.paid_at, isoweek) AS paid_at__week - , DATE_TRUNC(bookings_source_src_28000.paid_at, month) AS paid_at__month - , DATE_TRUNC(bookings_source_src_28000.paid_at, quarter) AS paid_at__quarter - , DATE_TRUNC(bookings_source_src_28000.paid_at, year) AS paid_at__year + , DATETIME_TRUNC(bookings_source_src_28000.paid_at, day) AS paid_at__day + , DATETIME_TRUNC(bookings_source_src_28000.paid_at, isoweek) AS paid_at__week + , DATETIME_TRUNC(bookings_source_src_28000.paid_at, month) AS paid_at__month + , DATETIME_TRUNC(bookings_source_src_28000.paid_at, quarter) AS paid_at__quarter + , DATETIME_TRUNC(bookings_source_src_28000.paid_at, year) AS paid_at__year , EXTRACT(year FROM bookings_source_src_28000.paid_at) AS paid_at__extract_year , EXTRACT(quarter FROM bookings_source_src_28000.paid_at) AS paid_at__extract_quarter , EXTRACT(month FROM bookings_source_src_28000.paid_at) AS paid_at__extract_month @@ -187,33 +187,33 @@ FROM ( , IF(EXTRACT(dayofweek FROM bookings_source_src_28000.paid_at) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_28000.paid_at) - 1) AS paid_at__extract_dow , EXTRACT(dayofyear FROM bookings_source_src_28000.paid_at) AS paid_at__extract_doy , bookings_source_src_28000.is_instant AS booking__is_instant - , DATE_TRUNC(bookings_source_src_28000.ds, day) AS booking__ds__day - , DATE_TRUNC(bookings_source_src_28000.ds, isoweek) AS booking__ds__week - , DATE_TRUNC(bookings_source_src_28000.ds, month) AS booking__ds__month - , DATE_TRUNC(bookings_source_src_28000.ds, quarter) AS booking__ds__quarter - , DATE_TRUNC(bookings_source_src_28000.ds, year) AS booking__ds__year + , DATETIME_TRUNC(bookings_source_src_28000.ds, day) AS booking__ds__day + , DATETIME_TRUNC(bookings_source_src_28000.ds, isoweek) AS booking__ds__week + , DATETIME_TRUNC(bookings_source_src_28000.ds, month) AS booking__ds__month + , DATETIME_TRUNC(bookings_source_src_28000.ds, quarter) AS booking__ds__quarter + , DATETIME_TRUNC(bookings_source_src_28000.ds, year) AS booking__ds__year , EXTRACT(year FROM bookings_source_src_28000.ds) AS booking__ds__extract_year , EXTRACT(quarter FROM bookings_source_src_28000.ds) AS booking__ds__extract_quarter , EXTRACT(month FROM bookings_source_src_28000.ds) AS booking__ds__extract_month , EXTRACT(day FROM bookings_source_src_28000.ds) AS booking__ds__extract_day , IF(EXTRACT(dayofweek FROM bookings_source_src_28000.ds) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_28000.ds) - 1) AS booking__ds__extract_dow , EXTRACT(dayofyear FROM bookings_source_src_28000.ds) AS booking__ds__extract_doy - , DATE_TRUNC(bookings_source_src_28000.ds_partitioned, day) AS booking__ds_partitioned__day - , DATE_TRUNC(bookings_source_src_28000.ds_partitioned, isoweek) AS booking__ds_partitioned__week - , DATE_TRUNC(bookings_source_src_28000.ds_partitioned, month) AS booking__ds_partitioned__month - , DATE_TRUNC(bookings_source_src_28000.ds_partitioned, quarter) AS booking__ds_partitioned__quarter - , DATE_TRUNC(bookings_source_src_28000.ds_partitioned, year) AS booking__ds_partitioned__year + , DATETIME_TRUNC(bookings_source_src_28000.ds_partitioned, day) AS booking__ds_partitioned__day + , DATETIME_TRUNC(bookings_source_src_28000.ds_partitioned, isoweek) AS booking__ds_partitioned__week + , DATETIME_TRUNC(bookings_source_src_28000.ds_partitioned, month) AS booking__ds_partitioned__month + , DATETIME_TRUNC(bookings_source_src_28000.ds_partitioned, quarter) AS booking__ds_partitioned__quarter + , DATETIME_TRUNC(bookings_source_src_28000.ds_partitioned, year) AS booking__ds_partitioned__year , EXTRACT(year FROM bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__extract_year , EXTRACT(quarter FROM bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__extract_quarter , EXTRACT(month FROM bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__extract_month , EXTRACT(day FROM bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__extract_day , IF(EXTRACT(dayofweek FROM bookings_source_src_28000.ds_partitioned) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_28000.ds_partitioned) - 1) AS booking__ds_partitioned__extract_dow , EXTRACT(dayofyear FROM bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__extract_doy - , DATE_TRUNC(bookings_source_src_28000.paid_at, day) AS booking__paid_at__day - , DATE_TRUNC(bookings_source_src_28000.paid_at, isoweek) AS booking__paid_at__week - , DATE_TRUNC(bookings_source_src_28000.paid_at, month) AS booking__paid_at__month - , DATE_TRUNC(bookings_source_src_28000.paid_at, quarter) AS booking__paid_at__quarter - , DATE_TRUNC(bookings_source_src_28000.paid_at, year) AS booking__paid_at__year + , DATETIME_TRUNC(bookings_source_src_28000.paid_at, day) AS booking__paid_at__day + , DATETIME_TRUNC(bookings_source_src_28000.paid_at, isoweek) AS booking__paid_at__week + , DATETIME_TRUNC(bookings_source_src_28000.paid_at, month) AS booking__paid_at__month + , DATETIME_TRUNC(bookings_source_src_28000.paid_at, quarter) AS booking__paid_at__quarter + , DATETIME_TRUNC(bookings_source_src_28000.paid_at, year) AS booking__paid_at__year , EXTRACT(year FROM bookings_source_src_28000.paid_at) AS booking__paid_at__extract_year , EXTRACT(quarter FROM bookings_source_src_28000.paid_at) AS booking__paid_at__extract_quarter , EXTRACT(month FROM bookings_source_src_28000.paid_at) AS booking__paid_at__extract_month @@ -256,10 +256,10 @@ FROM ( -- Join to Time Spine Dataset SELECT subq_10.metric_time__day AS metric_time__day - , DATE_TRUNC(subq_10.metric_time__day, isoweek) AS metric_time__week - , DATE_TRUNC(subq_10.metric_time__day, month) AS metric_time__month - , DATE_TRUNC(subq_10.metric_time__day, quarter) AS metric_time__quarter - , DATE_TRUNC(subq_10.metric_time__day, year) AS metric_time__year + , DATETIME_TRUNC(subq_10.metric_time__day, isoweek) AS metric_time__week + , DATETIME_TRUNC(subq_10.metric_time__day, month) AS metric_time__month + , DATETIME_TRUNC(subq_10.metric_time__day, quarter) AS metric_time__quarter + , DATETIME_TRUNC(subq_10.metric_time__day, year) AS metric_time__year , EXTRACT(year FROM subq_10.metric_time__day) AS metric_time__extract_year , EXTRACT(quarter FROM subq_10.metric_time__day) AS metric_time__extract_quarter , EXTRACT(month FROM subq_10.metric_time__day) AS metric_time__extract_month @@ -478,33 +478,33 @@ FROM ( , bookings_source_src_28000.booking_value AS approximate_continuous_booking_value_p99 , bookings_source_src_28000.booking_value AS approximate_discrete_booking_value_p99 , bookings_source_src_28000.is_instant - , DATE_TRUNC(bookings_source_src_28000.ds, day) AS ds__day - , DATE_TRUNC(bookings_source_src_28000.ds, isoweek) AS ds__week - , DATE_TRUNC(bookings_source_src_28000.ds, month) AS ds__month - , DATE_TRUNC(bookings_source_src_28000.ds, quarter) AS ds__quarter - , DATE_TRUNC(bookings_source_src_28000.ds, year) AS ds__year + , DATETIME_TRUNC(bookings_source_src_28000.ds, day) AS ds__day + , DATETIME_TRUNC(bookings_source_src_28000.ds, isoweek) AS ds__week + , DATETIME_TRUNC(bookings_source_src_28000.ds, month) AS ds__month + , DATETIME_TRUNC(bookings_source_src_28000.ds, quarter) AS ds__quarter + , DATETIME_TRUNC(bookings_source_src_28000.ds, year) AS ds__year , EXTRACT(year FROM bookings_source_src_28000.ds) AS ds__extract_year , EXTRACT(quarter FROM bookings_source_src_28000.ds) AS ds__extract_quarter , EXTRACT(month FROM bookings_source_src_28000.ds) AS ds__extract_month , EXTRACT(day FROM bookings_source_src_28000.ds) AS ds__extract_day , IF(EXTRACT(dayofweek FROM bookings_source_src_28000.ds) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_28000.ds) - 1) AS ds__extract_dow , EXTRACT(dayofyear FROM bookings_source_src_28000.ds) AS ds__extract_doy - , DATE_TRUNC(bookings_source_src_28000.ds_partitioned, day) AS ds_partitioned__day - , DATE_TRUNC(bookings_source_src_28000.ds_partitioned, isoweek) AS ds_partitioned__week - , DATE_TRUNC(bookings_source_src_28000.ds_partitioned, month) AS ds_partitioned__month - , DATE_TRUNC(bookings_source_src_28000.ds_partitioned, quarter) AS ds_partitioned__quarter - , DATE_TRUNC(bookings_source_src_28000.ds_partitioned, year) AS ds_partitioned__year + , DATETIME_TRUNC(bookings_source_src_28000.ds_partitioned, day) AS ds_partitioned__day + , DATETIME_TRUNC(bookings_source_src_28000.ds_partitioned, isoweek) AS ds_partitioned__week + , DATETIME_TRUNC(bookings_source_src_28000.ds_partitioned, month) AS ds_partitioned__month + , DATETIME_TRUNC(bookings_source_src_28000.ds_partitioned, quarter) AS ds_partitioned__quarter + , DATETIME_TRUNC(bookings_source_src_28000.ds_partitioned, year) AS ds_partitioned__year , EXTRACT(year FROM bookings_source_src_28000.ds_partitioned) AS ds_partitioned__extract_year , EXTRACT(quarter FROM bookings_source_src_28000.ds_partitioned) AS ds_partitioned__extract_quarter , EXTRACT(month FROM bookings_source_src_28000.ds_partitioned) AS ds_partitioned__extract_month , EXTRACT(day FROM bookings_source_src_28000.ds_partitioned) AS ds_partitioned__extract_day , IF(EXTRACT(dayofweek FROM bookings_source_src_28000.ds_partitioned) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_28000.ds_partitioned) - 1) AS ds_partitioned__extract_dow , EXTRACT(dayofyear FROM bookings_source_src_28000.ds_partitioned) AS ds_partitioned__extract_doy - , DATE_TRUNC(bookings_source_src_28000.paid_at, day) AS paid_at__day - , DATE_TRUNC(bookings_source_src_28000.paid_at, isoweek) AS paid_at__week - , DATE_TRUNC(bookings_source_src_28000.paid_at, month) AS paid_at__month - , DATE_TRUNC(bookings_source_src_28000.paid_at, quarter) AS paid_at__quarter - , DATE_TRUNC(bookings_source_src_28000.paid_at, year) AS paid_at__year + , DATETIME_TRUNC(bookings_source_src_28000.paid_at, day) AS paid_at__day + , DATETIME_TRUNC(bookings_source_src_28000.paid_at, isoweek) AS paid_at__week + , DATETIME_TRUNC(bookings_source_src_28000.paid_at, month) AS paid_at__month + , DATETIME_TRUNC(bookings_source_src_28000.paid_at, quarter) AS paid_at__quarter + , DATETIME_TRUNC(bookings_source_src_28000.paid_at, year) AS paid_at__year , EXTRACT(year FROM bookings_source_src_28000.paid_at) AS paid_at__extract_year , EXTRACT(quarter FROM bookings_source_src_28000.paid_at) AS paid_at__extract_quarter , EXTRACT(month FROM bookings_source_src_28000.paid_at) AS paid_at__extract_month @@ -512,33 +512,33 @@ FROM ( , IF(EXTRACT(dayofweek FROM bookings_source_src_28000.paid_at) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_28000.paid_at) - 1) AS paid_at__extract_dow , EXTRACT(dayofyear FROM bookings_source_src_28000.paid_at) AS paid_at__extract_doy , bookings_source_src_28000.is_instant AS booking__is_instant - , DATE_TRUNC(bookings_source_src_28000.ds, day) AS booking__ds__day - , DATE_TRUNC(bookings_source_src_28000.ds, isoweek) AS booking__ds__week - , DATE_TRUNC(bookings_source_src_28000.ds, month) AS booking__ds__month - , DATE_TRUNC(bookings_source_src_28000.ds, quarter) AS booking__ds__quarter - , DATE_TRUNC(bookings_source_src_28000.ds, year) AS booking__ds__year + , DATETIME_TRUNC(bookings_source_src_28000.ds, day) AS booking__ds__day + , DATETIME_TRUNC(bookings_source_src_28000.ds, isoweek) AS booking__ds__week + , DATETIME_TRUNC(bookings_source_src_28000.ds, month) AS booking__ds__month + , DATETIME_TRUNC(bookings_source_src_28000.ds, quarter) AS booking__ds__quarter + , DATETIME_TRUNC(bookings_source_src_28000.ds, year) AS booking__ds__year , EXTRACT(year FROM bookings_source_src_28000.ds) AS booking__ds__extract_year , EXTRACT(quarter FROM bookings_source_src_28000.ds) AS booking__ds__extract_quarter , EXTRACT(month FROM bookings_source_src_28000.ds) AS booking__ds__extract_month , EXTRACT(day FROM bookings_source_src_28000.ds) AS booking__ds__extract_day , IF(EXTRACT(dayofweek FROM bookings_source_src_28000.ds) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_28000.ds) - 1) AS booking__ds__extract_dow , EXTRACT(dayofyear FROM bookings_source_src_28000.ds) AS booking__ds__extract_doy - , DATE_TRUNC(bookings_source_src_28000.ds_partitioned, day) AS booking__ds_partitioned__day - , DATE_TRUNC(bookings_source_src_28000.ds_partitioned, isoweek) AS booking__ds_partitioned__week - , DATE_TRUNC(bookings_source_src_28000.ds_partitioned, month) AS booking__ds_partitioned__month - , DATE_TRUNC(bookings_source_src_28000.ds_partitioned, quarter) AS booking__ds_partitioned__quarter - , DATE_TRUNC(bookings_source_src_28000.ds_partitioned, year) AS booking__ds_partitioned__year + , DATETIME_TRUNC(bookings_source_src_28000.ds_partitioned, day) AS booking__ds_partitioned__day + , DATETIME_TRUNC(bookings_source_src_28000.ds_partitioned, isoweek) AS booking__ds_partitioned__week + , DATETIME_TRUNC(bookings_source_src_28000.ds_partitioned, month) AS booking__ds_partitioned__month + , DATETIME_TRUNC(bookings_source_src_28000.ds_partitioned, quarter) AS booking__ds_partitioned__quarter + , DATETIME_TRUNC(bookings_source_src_28000.ds_partitioned, year) AS booking__ds_partitioned__year , EXTRACT(year FROM bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__extract_year , EXTRACT(quarter FROM bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__extract_quarter , EXTRACT(month FROM bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__extract_month , EXTRACT(day FROM bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__extract_day , IF(EXTRACT(dayofweek FROM bookings_source_src_28000.ds_partitioned) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_28000.ds_partitioned) - 1) AS booking__ds_partitioned__extract_dow , EXTRACT(dayofyear FROM bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__extract_doy - , DATE_TRUNC(bookings_source_src_28000.paid_at, day) AS booking__paid_at__day - , DATE_TRUNC(bookings_source_src_28000.paid_at, isoweek) AS booking__paid_at__week - , DATE_TRUNC(bookings_source_src_28000.paid_at, month) AS booking__paid_at__month - , DATE_TRUNC(bookings_source_src_28000.paid_at, quarter) AS booking__paid_at__quarter - , DATE_TRUNC(bookings_source_src_28000.paid_at, year) AS booking__paid_at__year + , DATETIME_TRUNC(bookings_source_src_28000.paid_at, day) AS booking__paid_at__day + , DATETIME_TRUNC(bookings_source_src_28000.paid_at, isoweek) AS booking__paid_at__week + , DATETIME_TRUNC(bookings_source_src_28000.paid_at, month) AS booking__paid_at__month + , DATETIME_TRUNC(bookings_source_src_28000.paid_at, quarter) AS booking__paid_at__quarter + , DATETIME_TRUNC(bookings_source_src_28000.paid_at, year) AS booking__paid_at__year , EXTRACT(year FROM bookings_source_src_28000.paid_at) AS booking__paid_at__extract_year , EXTRACT(quarter FROM bookings_source_src_28000.paid_at) AS booking__paid_at__extract_quarter , EXTRACT(month FROM bookings_source_src_28000.paid_at) AS booking__paid_at__extract_month diff --git a/tests_metricflow/snapshots/test_fill_nulls_with_rendering.py/SqlQueryPlan/BigQuery/test_derived_fill_nulls_for_one_input_metric__plan0_optimized.sql b/tests_metricflow/snapshots/test_fill_nulls_with_rendering.py/SqlQueryPlan/BigQuery/test_derived_fill_nulls_for_one_input_metric__plan0_optimized.sql index c2eece1b7d..87d53fcbb9 100644 --- a/tests_metricflow/snapshots/test_fill_nulls_with_rendering.py/SqlQueryPlan/BigQuery/test_derived_fill_nulls_for_one_input_metric__plan0_optimized.sql +++ b/tests_metricflow/snapshots/test_fill_nulls_with_rendering.py/SqlQueryPlan/BigQuery/test_derived_fill_nulls_for_one_input_metric__plan0_optimized.sql @@ -29,7 +29,7 @@ FROM ( -- Metric Time Dimension 'ds' -- Pass Only Elements: ['bookings', 'metric_time__day'] SELECT - DATE_TRUNC(ds, day) AS metric_time__day + DATETIME_TRUNC(ds, day) AS metric_time__day , 1 AS bookings FROM ***************************.fct_bookings bookings_source_src_28000 ) subq_19 @@ -53,7 +53,7 @@ FROM ( -- Read Elements From Semantic Model 'bookings_source' -- Metric Time Dimension 'ds' SELECT - DATE_TRUNC(ds, day) AS metric_time__day + DATETIME_TRUNC(ds, day) AS metric_time__day , 1 AS bookings FROM ***************************.fct_bookings bookings_source_src_28000 ) subq_26 diff --git a/tests_metricflow/snapshots/test_fill_nulls_with_rendering.py/SqlQueryPlan/BigQuery/test_join_to_time_spine_with_filters__plan0.sql b/tests_metricflow/snapshots/test_fill_nulls_with_rendering.py/SqlQueryPlan/BigQuery/test_join_to_time_spine_with_filters__plan0.sql index 89282f2956..5a0a13a43b 100644 --- a/tests_metricflow/snapshots/test_fill_nulls_with_rendering.py/SqlQueryPlan/BigQuery/test_join_to_time_spine_with_filters__plan0.sql +++ b/tests_metricflow/snapshots/test_fill_nulls_with_rendering.py/SqlQueryPlan/BigQuery/test_join_to_time_spine_with_filters__plan0.sql @@ -259,33 +259,33 @@ FROM ( , bookings_source_src_28000.booking_value AS approximate_continuous_booking_value_p99 , bookings_source_src_28000.booking_value AS approximate_discrete_booking_value_p99 , bookings_source_src_28000.is_instant - , DATE_TRUNC(bookings_source_src_28000.ds, day) AS ds__day - , DATE_TRUNC(bookings_source_src_28000.ds, isoweek) AS ds__week - , DATE_TRUNC(bookings_source_src_28000.ds, month) AS ds__month - , DATE_TRUNC(bookings_source_src_28000.ds, quarter) AS ds__quarter - , DATE_TRUNC(bookings_source_src_28000.ds, year) AS ds__year + , DATETIME_TRUNC(bookings_source_src_28000.ds, day) AS ds__day + , DATETIME_TRUNC(bookings_source_src_28000.ds, isoweek) AS ds__week + , DATETIME_TRUNC(bookings_source_src_28000.ds, month) AS ds__month + , DATETIME_TRUNC(bookings_source_src_28000.ds, quarter) AS ds__quarter + , DATETIME_TRUNC(bookings_source_src_28000.ds, year) AS ds__year , EXTRACT(year FROM bookings_source_src_28000.ds) AS ds__extract_year , EXTRACT(quarter FROM bookings_source_src_28000.ds) AS ds__extract_quarter , EXTRACT(month FROM bookings_source_src_28000.ds) AS ds__extract_month , EXTRACT(day FROM bookings_source_src_28000.ds) AS ds__extract_day , IF(EXTRACT(dayofweek FROM bookings_source_src_28000.ds) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_28000.ds) - 1) AS ds__extract_dow , EXTRACT(dayofyear FROM bookings_source_src_28000.ds) AS ds__extract_doy - , DATE_TRUNC(bookings_source_src_28000.ds_partitioned, day) AS ds_partitioned__day - , DATE_TRUNC(bookings_source_src_28000.ds_partitioned, isoweek) AS ds_partitioned__week - , DATE_TRUNC(bookings_source_src_28000.ds_partitioned, month) AS ds_partitioned__month - , DATE_TRUNC(bookings_source_src_28000.ds_partitioned, quarter) AS ds_partitioned__quarter - , DATE_TRUNC(bookings_source_src_28000.ds_partitioned, year) AS ds_partitioned__year + , DATETIME_TRUNC(bookings_source_src_28000.ds_partitioned, day) AS ds_partitioned__day + , DATETIME_TRUNC(bookings_source_src_28000.ds_partitioned, isoweek) AS ds_partitioned__week + , DATETIME_TRUNC(bookings_source_src_28000.ds_partitioned, month) AS ds_partitioned__month + , DATETIME_TRUNC(bookings_source_src_28000.ds_partitioned, quarter) AS ds_partitioned__quarter + , DATETIME_TRUNC(bookings_source_src_28000.ds_partitioned, year) AS ds_partitioned__year , EXTRACT(year FROM bookings_source_src_28000.ds_partitioned) AS ds_partitioned__extract_year , EXTRACT(quarter FROM bookings_source_src_28000.ds_partitioned) AS ds_partitioned__extract_quarter , EXTRACT(month FROM bookings_source_src_28000.ds_partitioned) AS ds_partitioned__extract_month , EXTRACT(day FROM bookings_source_src_28000.ds_partitioned) AS ds_partitioned__extract_day , IF(EXTRACT(dayofweek FROM bookings_source_src_28000.ds_partitioned) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_28000.ds_partitioned) - 1) AS ds_partitioned__extract_dow , EXTRACT(dayofyear FROM bookings_source_src_28000.ds_partitioned) AS ds_partitioned__extract_doy - , DATE_TRUNC(bookings_source_src_28000.paid_at, day) AS paid_at__day - , DATE_TRUNC(bookings_source_src_28000.paid_at, isoweek) AS paid_at__week - , DATE_TRUNC(bookings_source_src_28000.paid_at, month) AS paid_at__month - , DATE_TRUNC(bookings_source_src_28000.paid_at, quarter) AS paid_at__quarter - , DATE_TRUNC(bookings_source_src_28000.paid_at, year) AS paid_at__year + , DATETIME_TRUNC(bookings_source_src_28000.paid_at, day) AS paid_at__day + , DATETIME_TRUNC(bookings_source_src_28000.paid_at, isoweek) AS paid_at__week + , DATETIME_TRUNC(bookings_source_src_28000.paid_at, month) AS paid_at__month + , DATETIME_TRUNC(bookings_source_src_28000.paid_at, quarter) AS paid_at__quarter + , DATETIME_TRUNC(bookings_source_src_28000.paid_at, year) AS paid_at__year , EXTRACT(year FROM bookings_source_src_28000.paid_at) AS paid_at__extract_year , EXTRACT(quarter FROM bookings_source_src_28000.paid_at) AS paid_at__extract_quarter , EXTRACT(month FROM bookings_source_src_28000.paid_at) AS paid_at__extract_month @@ -293,33 +293,33 @@ FROM ( , IF(EXTRACT(dayofweek FROM bookings_source_src_28000.paid_at) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_28000.paid_at) - 1) AS paid_at__extract_dow , EXTRACT(dayofyear FROM bookings_source_src_28000.paid_at) AS paid_at__extract_doy , bookings_source_src_28000.is_instant AS booking__is_instant - , DATE_TRUNC(bookings_source_src_28000.ds, day) AS booking__ds__day - , DATE_TRUNC(bookings_source_src_28000.ds, isoweek) AS booking__ds__week - , DATE_TRUNC(bookings_source_src_28000.ds, month) AS booking__ds__month - , DATE_TRUNC(bookings_source_src_28000.ds, quarter) AS booking__ds__quarter - , DATE_TRUNC(bookings_source_src_28000.ds, year) AS booking__ds__year + , DATETIME_TRUNC(bookings_source_src_28000.ds, day) AS booking__ds__day + , DATETIME_TRUNC(bookings_source_src_28000.ds, isoweek) AS booking__ds__week + , DATETIME_TRUNC(bookings_source_src_28000.ds, month) AS booking__ds__month + , DATETIME_TRUNC(bookings_source_src_28000.ds, quarter) AS booking__ds__quarter + , DATETIME_TRUNC(bookings_source_src_28000.ds, year) AS booking__ds__year , EXTRACT(year FROM bookings_source_src_28000.ds) AS booking__ds__extract_year , EXTRACT(quarter FROM bookings_source_src_28000.ds) AS booking__ds__extract_quarter , EXTRACT(month FROM bookings_source_src_28000.ds) AS booking__ds__extract_month , EXTRACT(day FROM bookings_source_src_28000.ds) AS booking__ds__extract_day , IF(EXTRACT(dayofweek FROM bookings_source_src_28000.ds) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_28000.ds) - 1) AS booking__ds__extract_dow , EXTRACT(dayofyear FROM bookings_source_src_28000.ds) AS booking__ds__extract_doy - , DATE_TRUNC(bookings_source_src_28000.ds_partitioned, day) AS booking__ds_partitioned__day - , DATE_TRUNC(bookings_source_src_28000.ds_partitioned, isoweek) AS booking__ds_partitioned__week - , DATE_TRUNC(bookings_source_src_28000.ds_partitioned, month) AS booking__ds_partitioned__month - , DATE_TRUNC(bookings_source_src_28000.ds_partitioned, quarter) AS booking__ds_partitioned__quarter - , DATE_TRUNC(bookings_source_src_28000.ds_partitioned, year) AS booking__ds_partitioned__year + , DATETIME_TRUNC(bookings_source_src_28000.ds_partitioned, day) AS booking__ds_partitioned__day + , DATETIME_TRUNC(bookings_source_src_28000.ds_partitioned, isoweek) AS booking__ds_partitioned__week + , DATETIME_TRUNC(bookings_source_src_28000.ds_partitioned, month) AS booking__ds_partitioned__month + , DATETIME_TRUNC(bookings_source_src_28000.ds_partitioned, quarter) AS booking__ds_partitioned__quarter + , DATETIME_TRUNC(bookings_source_src_28000.ds_partitioned, year) AS booking__ds_partitioned__year , EXTRACT(year FROM bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__extract_year , EXTRACT(quarter FROM bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__extract_quarter , EXTRACT(month FROM bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__extract_month , EXTRACT(day FROM bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__extract_day , IF(EXTRACT(dayofweek FROM bookings_source_src_28000.ds_partitioned) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_28000.ds_partitioned) - 1) AS booking__ds_partitioned__extract_dow , EXTRACT(dayofyear FROM bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__extract_doy - , DATE_TRUNC(bookings_source_src_28000.paid_at, day) AS booking__paid_at__day - , DATE_TRUNC(bookings_source_src_28000.paid_at, isoweek) AS booking__paid_at__week - , DATE_TRUNC(bookings_source_src_28000.paid_at, month) AS booking__paid_at__month - , DATE_TRUNC(bookings_source_src_28000.paid_at, quarter) AS booking__paid_at__quarter - , DATE_TRUNC(bookings_source_src_28000.paid_at, year) AS booking__paid_at__year + , DATETIME_TRUNC(bookings_source_src_28000.paid_at, day) AS booking__paid_at__day + , DATETIME_TRUNC(bookings_source_src_28000.paid_at, isoweek) AS booking__paid_at__week + , DATETIME_TRUNC(bookings_source_src_28000.paid_at, month) AS booking__paid_at__month + , DATETIME_TRUNC(bookings_source_src_28000.paid_at, quarter) AS booking__paid_at__quarter + , DATETIME_TRUNC(bookings_source_src_28000.paid_at, year) AS booking__paid_at__year , EXTRACT(year FROM bookings_source_src_28000.paid_at) AS booking__paid_at__extract_year , EXTRACT(quarter FROM bookings_source_src_28000.paid_at) AS booking__paid_at__extract_quarter , EXTRACT(month FROM bookings_source_src_28000.paid_at) AS booking__paid_at__extract_month diff --git a/tests_metricflow/snapshots/test_fill_nulls_with_rendering.py/SqlQueryPlan/BigQuery/test_join_to_time_spine_with_filters__plan0_optimized.sql b/tests_metricflow/snapshots/test_fill_nulls_with_rendering.py/SqlQueryPlan/BigQuery/test_join_to_time_spine_with_filters__plan0_optimized.sql index e53da43de2..6b969a08b6 100644 --- a/tests_metricflow/snapshots/test_fill_nulls_with_rendering.py/SqlQueryPlan/BigQuery/test_join_to_time_spine_with_filters__plan0_optimized.sql +++ b/tests_metricflow/snapshots/test_fill_nulls_with_rendering.py/SqlQueryPlan/BigQuery/test_join_to_time_spine_with_filters__plan0_optimized.sql @@ -32,10 +32,10 @@ FROM ( -- Constrain Time Range to [2020-01-03T00:00:00, 2020-01-05T00:00:00] -- Pass Only Elements: ['bookings', 'metric_time__day'] SELECT - DATE_TRUNC(ds, day) AS metric_time__day + DATETIME_TRUNC(ds, day) AS metric_time__day , 1 AS bookings FROM ***************************.fct_bookings bookings_source_src_28000 - WHERE DATE_TRUNC(ds, day) BETWEEN '2020-01-03' AND '2020-01-05' + WHERE DATETIME_TRUNC(ds, day) BETWEEN '2020-01-03' AND '2020-01-05' ) subq_16 WHERE metric_time__day > '2020-01-01' GROUP BY diff --git a/tests_metricflow/snapshots/test_fill_nulls_with_rendering.py/SqlQueryPlan/BigQuery/test_simple_fill_nulls_with_0_metric_time__plan0.sql b/tests_metricflow/snapshots/test_fill_nulls_with_rendering.py/SqlQueryPlan/BigQuery/test_simple_fill_nulls_with_0_metric_time__plan0.sql index 0c2d302ed4..5812cc2483 100644 --- a/tests_metricflow/snapshots/test_fill_nulls_with_rendering.py/SqlQueryPlan/BigQuery/test_simple_fill_nulls_with_0_metric_time__plan0.sql +++ b/tests_metricflow/snapshots/test_fill_nulls_with_rendering.py/SqlQueryPlan/BigQuery/test_simple_fill_nulls_with_0_metric_time__plan0.sql @@ -142,33 +142,33 @@ FROM ( , bookings_source_src_28000.booking_value AS approximate_continuous_booking_value_p99 , bookings_source_src_28000.booking_value AS approximate_discrete_booking_value_p99 , bookings_source_src_28000.is_instant - , DATE_TRUNC(bookings_source_src_28000.ds, day) AS ds__day - , DATE_TRUNC(bookings_source_src_28000.ds, isoweek) AS ds__week - , DATE_TRUNC(bookings_source_src_28000.ds, month) AS ds__month - , DATE_TRUNC(bookings_source_src_28000.ds, quarter) AS ds__quarter - , DATE_TRUNC(bookings_source_src_28000.ds, year) AS ds__year + , DATETIME_TRUNC(bookings_source_src_28000.ds, day) AS ds__day + , DATETIME_TRUNC(bookings_source_src_28000.ds, isoweek) AS ds__week + , DATETIME_TRUNC(bookings_source_src_28000.ds, month) AS ds__month + , DATETIME_TRUNC(bookings_source_src_28000.ds, quarter) AS ds__quarter + , DATETIME_TRUNC(bookings_source_src_28000.ds, year) AS ds__year , EXTRACT(year FROM bookings_source_src_28000.ds) AS ds__extract_year , EXTRACT(quarter FROM bookings_source_src_28000.ds) AS ds__extract_quarter , EXTRACT(month FROM bookings_source_src_28000.ds) AS ds__extract_month , EXTRACT(day FROM bookings_source_src_28000.ds) AS ds__extract_day , IF(EXTRACT(dayofweek FROM bookings_source_src_28000.ds) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_28000.ds) - 1) AS ds__extract_dow , EXTRACT(dayofyear FROM bookings_source_src_28000.ds) AS ds__extract_doy - , DATE_TRUNC(bookings_source_src_28000.ds_partitioned, day) AS ds_partitioned__day - , DATE_TRUNC(bookings_source_src_28000.ds_partitioned, isoweek) AS ds_partitioned__week - , DATE_TRUNC(bookings_source_src_28000.ds_partitioned, month) AS ds_partitioned__month - , DATE_TRUNC(bookings_source_src_28000.ds_partitioned, quarter) AS ds_partitioned__quarter - , DATE_TRUNC(bookings_source_src_28000.ds_partitioned, year) AS ds_partitioned__year + , DATETIME_TRUNC(bookings_source_src_28000.ds_partitioned, day) AS ds_partitioned__day + , DATETIME_TRUNC(bookings_source_src_28000.ds_partitioned, isoweek) AS ds_partitioned__week + , DATETIME_TRUNC(bookings_source_src_28000.ds_partitioned, month) AS ds_partitioned__month + , DATETIME_TRUNC(bookings_source_src_28000.ds_partitioned, quarter) AS ds_partitioned__quarter + , DATETIME_TRUNC(bookings_source_src_28000.ds_partitioned, year) AS ds_partitioned__year , EXTRACT(year FROM bookings_source_src_28000.ds_partitioned) AS ds_partitioned__extract_year , EXTRACT(quarter FROM bookings_source_src_28000.ds_partitioned) AS ds_partitioned__extract_quarter , EXTRACT(month FROM bookings_source_src_28000.ds_partitioned) AS ds_partitioned__extract_month , EXTRACT(day FROM bookings_source_src_28000.ds_partitioned) AS ds_partitioned__extract_day , IF(EXTRACT(dayofweek FROM bookings_source_src_28000.ds_partitioned) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_28000.ds_partitioned) - 1) AS ds_partitioned__extract_dow , EXTRACT(dayofyear FROM bookings_source_src_28000.ds_partitioned) AS ds_partitioned__extract_doy - , DATE_TRUNC(bookings_source_src_28000.paid_at, day) AS paid_at__day - , DATE_TRUNC(bookings_source_src_28000.paid_at, isoweek) AS paid_at__week - , DATE_TRUNC(bookings_source_src_28000.paid_at, month) AS paid_at__month - , DATE_TRUNC(bookings_source_src_28000.paid_at, quarter) AS paid_at__quarter - , DATE_TRUNC(bookings_source_src_28000.paid_at, year) AS paid_at__year + , DATETIME_TRUNC(bookings_source_src_28000.paid_at, day) AS paid_at__day + , DATETIME_TRUNC(bookings_source_src_28000.paid_at, isoweek) AS paid_at__week + , DATETIME_TRUNC(bookings_source_src_28000.paid_at, month) AS paid_at__month + , DATETIME_TRUNC(bookings_source_src_28000.paid_at, quarter) AS paid_at__quarter + , DATETIME_TRUNC(bookings_source_src_28000.paid_at, year) AS paid_at__year , EXTRACT(year FROM bookings_source_src_28000.paid_at) AS paid_at__extract_year , EXTRACT(quarter FROM bookings_source_src_28000.paid_at) AS paid_at__extract_quarter , EXTRACT(month FROM bookings_source_src_28000.paid_at) AS paid_at__extract_month @@ -176,33 +176,33 @@ FROM ( , IF(EXTRACT(dayofweek FROM bookings_source_src_28000.paid_at) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_28000.paid_at) - 1) AS paid_at__extract_dow , EXTRACT(dayofyear FROM bookings_source_src_28000.paid_at) AS paid_at__extract_doy , bookings_source_src_28000.is_instant AS booking__is_instant - , DATE_TRUNC(bookings_source_src_28000.ds, day) AS booking__ds__day - , DATE_TRUNC(bookings_source_src_28000.ds, isoweek) AS booking__ds__week - , DATE_TRUNC(bookings_source_src_28000.ds, month) AS booking__ds__month - , DATE_TRUNC(bookings_source_src_28000.ds, quarter) AS booking__ds__quarter - , DATE_TRUNC(bookings_source_src_28000.ds, year) AS booking__ds__year + , DATETIME_TRUNC(bookings_source_src_28000.ds, day) AS booking__ds__day + , DATETIME_TRUNC(bookings_source_src_28000.ds, isoweek) AS booking__ds__week + , DATETIME_TRUNC(bookings_source_src_28000.ds, month) AS booking__ds__month + , DATETIME_TRUNC(bookings_source_src_28000.ds, quarter) AS booking__ds__quarter + , DATETIME_TRUNC(bookings_source_src_28000.ds, year) AS booking__ds__year , EXTRACT(year FROM bookings_source_src_28000.ds) AS booking__ds__extract_year , EXTRACT(quarter FROM bookings_source_src_28000.ds) AS booking__ds__extract_quarter , EXTRACT(month FROM bookings_source_src_28000.ds) AS booking__ds__extract_month , EXTRACT(day FROM bookings_source_src_28000.ds) AS booking__ds__extract_day , IF(EXTRACT(dayofweek FROM bookings_source_src_28000.ds) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_28000.ds) - 1) AS booking__ds__extract_dow , EXTRACT(dayofyear FROM bookings_source_src_28000.ds) AS booking__ds__extract_doy - , DATE_TRUNC(bookings_source_src_28000.ds_partitioned, day) AS booking__ds_partitioned__day - , DATE_TRUNC(bookings_source_src_28000.ds_partitioned, isoweek) AS booking__ds_partitioned__week - , DATE_TRUNC(bookings_source_src_28000.ds_partitioned, month) AS booking__ds_partitioned__month - , DATE_TRUNC(bookings_source_src_28000.ds_partitioned, quarter) AS booking__ds_partitioned__quarter - , DATE_TRUNC(bookings_source_src_28000.ds_partitioned, year) AS booking__ds_partitioned__year + , DATETIME_TRUNC(bookings_source_src_28000.ds_partitioned, day) AS booking__ds_partitioned__day + , DATETIME_TRUNC(bookings_source_src_28000.ds_partitioned, isoweek) AS booking__ds_partitioned__week + , DATETIME_TRUNC(bookings_source_src_28000.ds_partitioned, month) AS booking__ds_partitioned__month + , DATETIME_TRUNC(bookings_source_src_28000.ds_partitioned, quarter) AS booking__ds_partitioned__quarter + , DATETIME_TRUNC(bookings_source_src_28000.ds_partitioned, year) AS booking__ds_partitioned__year , EXTRACT(year FROM bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__extract_year , EXTRACT(quarter FROM bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__extract_quarter , EXTRACT(month FROM bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__extract_month , EXTRACT(day FROM bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__extract_day , IF(EXTRACT(dayofweek FROM bookings_source_src_28000.ds_partitioned) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_28000.ds_partitioned) - 1) AS booking__ds_partitioned__extract_dow , EXTRACT(dayofyear FROM bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__extract_doy - , DATE_TRUNC(bookings_source_src_28000.paid_at, day) AS booking__paid_at__day - , DATE_TRUNC(bookings_source_src_28000.paid_at, isoweek) AS booking__paid_at__week - , DATE_TRUNC(bookings_source_src_28000.paid_at, month) AS booking__paid_at__month - , DATE_TRUNC(bookings_source_src_28000.paid_at, quarter) AS booking__paid_at__quarter - , DATE_TRUNC(bookings_source_src_28000.paid_at, year) AS booking__paid_at__year + , DATETIME_TRUNC(bookings_source_src_28000.paid_at, day) AS booking__paid_at__day + , DATETIME_TRUNC(bookings_source_src_28000.paid_at, isoweek) AS booking__paid_at__week + , DATETIME_TRUNC(bookings_source_src_28000.paid_at, month) AS booking__paid_at__month + , DATETIME_TRUNC(bookings_source_src_28000.paid_at, quarter) AS booking__paid_at__quarter + , DATETIME_TRUNC(bookings_source_src_28000.paid_at, year) AS booking__paid_at__year , EXTRACT(year FROM bookings_source_src_28000.paid_at) AS booking__paid_at__extract_year , EXTRACT(quarter FROM bookings_source_src_28000.paid_at) AS booking__paid_at__extract_quarter , EXTRACT(month FROM bookings_source_src_28000.paid_at) AS booking__paid_at__extract_month diff --git a/tests_metricflow/snapshots/test_fill_nulls_with_rendering.py/SqlQueryPlan/BigQuery/test_simple_fill_nulls_with_0_metric_time__plan0_optimized.sql b/tests_metricflow/snapshots/test_fill_nulls_with_rendering.py/SqlQueryPlan/BigQuery/test_simple_fill_nulls_with_0_metric_time__plan0_optimized.sql index 2b15cc3a8f..9d4fa355d8 100644 --- a/tests_metricflow/snapshots/test_fill_nulls_with_rendering.py/SqlQueryPlan/BigQuery/test_simple_fill_nulls_with_0_metric_time__plan0_optimized.sql +++ b/tests_metricflow/snapshots/test_fill_nulls_with_rendering.py/SqlQueryPlan/BigQuery/test_simple_fill_nulls_with_0_metric_time__plan0_optimized.sql @@ -18,7 +18,7 @@ FROM ( -- Metric Time Dimension 'ds' -- Pass Only Elements: ['bookings', 'metric_time__day'] SELECT - DATE_TRUNC(ds, day) AS metric_time__day + DATETIME_TRUNC(ds, day) AS metric_time__day , 1 AS bookings FROM ***************************.fct_bookings bookings_source_src_28000 ) subq_9 diff --git a/tests_metricflow/snapshots/test_fill_nulls_with_rendering.py/SqlQueryPlan/BigQuery/test_simple_fill_nulls_with_0_month__plan0.sql b/tests_metricflow/snapshots/test_fill_nulls_with_rendering.py/SqlQueryPlan/BigQuery/test_simple_fill_nulls_with_0_month__plan0.sql index 1f17469c5b..2de3ded076 100644 --- a/tests_metricflow/snapshots/test_fill_nulls_with_rendering.py/SqlQueryPlan/BigQuery/test_simple_fill_nulls_with_0_month__plan0.sql +++ b/tests_metricflow/snapshots/test_fill_nulls_with_rendering.py/SqlQueryPlan/BigQuery/test_simple_fill_nulls_with_0_month__plan0.sql @@ -10,7 +10,7 @@ FROM ( FROM ( -- Time Spine SELECT - DATE_TRUNC(subq_5.ds, month) AS metric_time__month + DATETIME_TRUNC(subq_5.ds, month) AS metric_time__month FROM ***************************.mf_time_spine subq_5 GROUP BY metric_time__month @@ -144,33 +144,33 @@ FROM ( , bookings_source_src_28000.booking_value AS approximate_continuous_booking_value_p99 , bookings_source_src_28000.booking_value AS approximate_discrete_booking_value_p99 , bookings_source_src_28000.is_instant - , DATE_TRUNC(bookings_source_src_28000.ds, day) AS ds__day - , DATE_TRUNC(bookings_source_src_28000.ds, isoweek) AS ds__week - , DATE_TRUNC(bookings_source_src_28000.ds, month) AS ds__month - , DATE_TRUNC(bookings_source_src_28000.ds, quarter) AS ds__quarter - , DATE_TRUNC(bookings_source_src_28000.ds, year) AS ds__year + , DATETIME_TRUNC(bookings_source_src_28000.ds, day) AS ds__day + , DATETIME_TRUNC(bookings_source_src_28000.ds, isoweek) AS ds__week + , DATETIME_TRUNC(bookings_source_src_28000.ds, month) AS ds__month + , DATETIME_TRUNC(bookings_source_src_28000.ds, quarter) AS ds__quarter + , DATETIME_TRUNC(bookings_source_src_28000.ds, year) AS ds__year , EXTRACT(year FROM bookings_source_src_28000.ds) AS ds__extract_year , EXTRACT(quarter FROM bookings_source_src_28000.ds) AS ds__extract_quarter , EXTRACT(month FROM bookings_source_src_28000.ds) AS ds__extract_month , EXTRACT(day FROM bookings_source_src_28000.ds) AS ds__extract_day , IF(EXTRACT(dayofweek FROM bookings_source_src_28000.ds) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_28000.ds) - 1) AS ds__extract_dow , EXTRACT(dayofyear FROM bookings_source_src_28000.ds) AS ds__extract_doy - , DATE_TRUNC(bookings_source_src_28000.ds_partitioned, day) AS ds_partitioned__day - , DATE_TRUNC(bookings_source_src_28000.ds_partitioned, isoweek) AS ds_partitioned__week - , DATE_TRUNC(bookings_source_src_28000.ds_partitioned, month) AS ds_partitioned__month - , DATE_TRUNC(bookings_source_src_28000.ds_partitioned, quarter) AS ds_partitioned__quarter - , DATE_TRUNC(bookings_source_src_28000.ds_partitioned, year) AS ds_partitioned__year + , DATETIME_TRUNC(bookings_source_src_28000.ds_partitioned, day) AS ds_partitioned__day + , DATETIME_TRUNC(bookings_source_src_28000.ds_partitioned, isoweek) AS ds_partitioned__week + , DATETIME_TRUNC(bookings_source_src_28000.ds_partitioned, month) AS ds_partitioned__month + , DATETIME_TRUNC(bookings_source_src_28000.ds_partitioned, quarter) AS ds_partitioned__quarter + , DATETIME_TRUNC(bookings_source_src_28000.ds_partitioned, year) AS ds_partitioned__year , EXTRACT(year FROM bookings_source_src_28000.ds_partitioned) AS ds_partitioned__extract_year , EXTRACT(quarter FROM bookings_source_src_28000.ds_partitioned) AS ds_partitioned__extract_quarter , EXTRACT(month FROM bookings_source_src_28000.ds_partitioned) AS ds_partitioned__extract_month , EXTRACT(day FROM bookings_source_src_28000.ds_partitioned) AS ds_partitioned__extract_day , IF(EXTRACT(dayofweek FROM bookings_source_src_28000.ds_partitioned) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_28000.ds_partitioned) - 1) AS ds_partitioned__extract_dow , EXTRACT(dayofyear FROM bookings_source_src_28000.ds_partitioned) AS ds_partitioned__extract_doy - , DATE_TRUNC(bookings_source_src_28000.paid_at, day) AS paid_at__day - , DATE_TRUNC(bookings_source_src_28000.paid_at, isoweek) AS paid_at__week - , DATE_TRUNC(bookings_source_src_28000.paid_at, month) AS paid_at__month - , DATE_TRUNC(bookings_source_src_28000.paid_at, quarter) AS paid_at__quarter - , DATE_TRUNC(bookings_source_src_28000.paid_at, year) AS paid_at__year + , DATETIME_TRUNC(bookings_source_src_28000.paid_at, day) AS paid_at__day + , DATETIME_TRUNC(bookings_source_src_28000.paid_at, isoweek) AS paid_at__week + , DATETIME_TRUNC(bookings_source_src_28000.paid_at, month) AS paid_at__month + , DATETIME_TRUNC(bookings_source_src_28000.paid_at, quarter) AS paid_at__quarter + , DATETIME_TRUNC(bookings_source_src_28000.paid_at, year) AS paid_at__year , EXTRACT(year FROM bookings_source_src_28000.paid_at) AS paid_at__extract_year , EXTRACT(quarter FROM bookings_source_src_28000.paid_at) AS paid_at__extract_quarter , EXTRACT(month FROM bookings_source_src_28000.paid_at) AS paid_at__extract_month @@ -178,33 +178,33 @@ FROM ( , IF(EXTRACT(dayofweek FROM bookings_source_src_28000.paid_at) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_28000.paid_at) - 1) AS paid_at__extract_dow , EXTRACT(dayofyear FROM bookings_source_src_28000.paid_at) AS paid_at__extract_doy , bookings_source_src_28000.is_instant AS booking__is_instant - , DATE_TRUNC(bookings_source_src_28000.ds, day) AS booking__ds__day - , DATE_TRUNC(bookings_source_src_28000.ds, isoweek) AS booking__ds__week - , DATE_TRUNC(bookings_source_src_28000.ds, month) AS booking__ds__month - , DATE_TRUNC(bookings_source_src_28000.ds, quarter) AS booking__ds__quarter - , DATE_TRUNC(bookings_source_src_28000.ds, year) AS booking__ds__year + , DATETIME_TRUNC(bookings_source_src_28000.ds, day) AS booking__ds__day + , DATETIME_TRUNC(bookings_source_src_28000.ds, isoweek) AS booking__ds__week + , DATETIME_TRUNC(bookings_source_src_28000.ds, month) AS booking__ds__month + , DATETIME_TRUNC(bookings_source_src_28000.ds, quarter) AS booking__ds__quarter + , DATETIME_TRUNC(bookings_source_src_28000.ds, year) AS booking__ds__year , EXTRACT(year FROM bookings_source_src_28000.ds) AS booking__ds__extract_year , EXTRACT(quarter FROM bookings_source_src_28000.ds) AS booking__ds__extract_quarter , EXTRACT(month FROM bookings_source_src_28000.ds) AS booking__ds__extract_month , EXTRACT(day FROM bookings_source_src_28000.ds) AS booking__ds__extract_day , IF(EXTRACT(dayofweek FROM bookings_source_src_28000.ds) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_28000.ds) - 1) AS booking__ds__extract_dow , EXTRACT(dayofyear FROM bookings_source_src_28000.ds) AS booking__ds__extract_doy - , DATE_TRUNC(bookings_source_src_28000.ds_partitioned, day) AS booking__ds_partitioned__day - , DATE_TRUNC(bookings_source_src_28000.ds_partitioned, isoweek) AS booking__ds_partitioned__week - , DATE_TRUNC(bookings_source_src_28000.ds_partitioned, month) AS booking__ds_partitioned__month - , DATE_TRUNC(bookings_source_src_28000.ds_partitioned, quarter) AS booking__ds_partitioned__quarter - , DATE_TRUNC(bookings_source_src_28000.ds_partitioned, year) AS booking__ds_partitioned__year + , DATETIME_TRUNC(bookings_source_src_28000.ds_partitioned, day) AS booking__ds_partitioned__day + , DATETIME_TRUNC(bookings_source_src_28000.ds_partitioned, isoweek) AS booking__ds_partitioned__week + , DATETIME_TRUNC(bookings_source_src_28000.ds_partitioned, month) AS booking__ds_partitioned__month + , DATETIME_TRUNC(bookings_source_src_28000.ds_partitioned, quarter) AS booking__ds_partitioned__quarter + , DATETIME_TRUNC(bookings_source_src_28000.ds_partitioned, year) AS booking__ds_partitioned__year , EXTRACT(year FROM bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__extract_year , EXTRACT(quarter FROM bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__extract_quarter , EXTRACT(month FROM bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__extract_month , EXTRACT(day FROM bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__extract_day , IF(EXTRACT(dayofweek FROM bookings_source_src_28000.ds_partitioned) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_28000.ds_partitioned) - 1) AS booking__ds_partitioned__extract_dow , EXTRACT(dayofyear FROM bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__extract_doy - , DATE_TRUNC(bookings_source_src_28000.paid_at, day) AS booking__paid_at__day - , DATE_TRUNC(bookings_source_src_28000.paid_at, isoweek) AS booking__paid_at__week - , DATE_TRUNC(bookings_source_src_28000.paid_at, month) AS booking__paid_at__month - , DATE_TRUNC(bookings_source_src_28000.paid_at, quarter) AS booking__paid_at__quarter - , DATE_TRUNC(bookings_source_src_28000.paid_at, year) AS booking__paid_at__year + , DATETIME_TRUNC(bookings_source_src_28000.paid_at, day) AS booking__paid_at__day + , DATETIME_TRUNC(bookings_source_src_28000.paid_at, isoweek) AS booking__paid_at__week + , DATETIME_TRUNC(bookings_source_src_28000.paid_at, month) AS booking__paid_at__month + , DATETIME_TRUNC(bookings_source_src_28000.paid_at, quarter) AS booking__paid_at__quarter + , DATETIME_TRUNC(bookings_source_src_28000.paid_at, year) AS booking__paid_at__year , EXTRACT(year FROM bookings_source_src_28000.paid_at) AS booking__paid_at__extract_year , EXTRACT(quarter FROM bookings_source_src_28000.paid_at) AS booking__paid_at__extract_quarter , EXTRACT(month FROM bookings_source_src_28000.paid_at) AS booking__paid_at__extract_month diff --git a/tests_metricflow/snapshots/test_fill_nulls_with_rendering.py/SqlQueryPlan/BigQuery/test_simple_fill_nulls_with_0_month__plan0_optimized.sql b/tests_metricflow/snapshots/test_fill_nulls_with_rendering.py/SqlQueryPlan/BigQuery/test_simple_fill_nulls_with_0_month__plan0_optimized.sql index 121a74fb9b..ee423ff186 100644 --- a/tests_metricflow/snapshots/test_fill_nulls_with_rendering.py/SqlQueryPlan/BigQuery/test_simple_fill_nulls_with_0_month__plan0_optimized.sql +++ b/tests_metricflow/snapshots/test_fill_nulls_with_rendering.py/SqlQueryPlan/BigQuery/test_simple_fill_nulls_with_0_month__plan0_optimized.sql @@ -10,7 +10,7 @@ FROM ( FROM ( -- Time Spine SELECT - DATE_TRUNC(ds, month) AS metric_time__month + DATETIME_TRUNC(ds, month) AS metric_time__month FROM ***************************.mf_time_spine subq_12 GROUP BY metric_time__month @@ -25,7 +25,7 @@ FROM ( -- Metric Time Dimension 'ds' -- Pass Only Elements: ['bookings', 'metric_time__month'] SELECT - DATE_TRUNC(ds, month) AS metric_time__month + DATETIME_TRUNC(ds, month) AS metric_time__month , 1 AS bookings FROM ***************************.fct_bookings bookings_source_src_28000 ) subq_9 diff --git a/tests_metricflow/snapshots/test_fill_nulls_with_rendering.py/SqlQueryPlan/BigQuery/test_simple_fill_nulls_with_0_with_categorical_dimension__plan0.sql b/tests_metricflow/snapshots/test_fill_nulls_with_rendering.py/SqlQueryPlan/BigQuery/test_simple_fill_nulls_with_0_with_categorical_dimension__plan0.sql index c6281292be..809a099a28 100644 --- a/tests_metricflow/snapshots/test_fill_nulls_with_rendering.py/SqlQueryPlan/BigQuery/test_simple_fill_nulls_with_0_with_categorical_dimension__plan0.sql +++ b/tests_metricflow/snapshots/test_fill_nulls_with_rendering.py/SqlQueryPlan/BigQuery/test_simple_fill_nulls_with_0_with_categorical_dimension__plan0.sql @@ -131,33 +131,33 @@ FROM ( , bookings_source_src_28000.booking_value AS approximate_continuous_booking_value_p99 , bookings_source_src_28000.booking_value AS approximate_discrete_booking_value_p99 , bookings_source_src_28000.is_instant - , DATE_TRUNC(bookings_source_src_28000.ds, day) AS ds__day - , DATE_TRUNC(bookings_source_src_28000.ds, isoweek) AS ds__week - , DATE_TRUNC(bookings_source_src_28000.ds, month) AS ds__month - , DATE_TRUNC(bookings_source_src_28000.ds, quarter) AS ds__quarter - , DATE_TRUNC(bookings_source_src_28000.ds, year) AS ds__year + , DATETIME_TRUNC(bookings_source_src_28000.ds, day) AS ds__day + , DATETIME_TRUNC(bookings_source_src_28000.ds, isoweek) AS ds__week + , DATETIME_TRUNC(bookings_source_src_28000.ds, month) AS ds__month + , DATETIME_TRUNC(bookings_source_src_28000.ds, quarter) AS ds__quarter + , DATETIME_TRUNC(bookings_source_src_28000.ds, year) AS ds__year , EXTRACT(year FROM bookings_source_src_28000.ds) AS ds__extract_year , EXTRACT(quarter FROM bookings_source_src_28000.ds) AS ds__extract_quarter , EXTRACT(month FROM bookings_source_src_28000.ds) AS ds__extract_month , EXTRACT(day FROM bookings_source_src_28000.ds) AS ds__extract_day , IF(EXTRACT(dayofweek FROM bookings_source_src_28000.ds) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_28000.ds) - 1) AS ds__extract_dow , EXTRACT(dayofyear FROM bookings_source_src_28000.ds) AS ds__extract_doy - , DATE_TRUNC(bookings_source_src_28000.ds_partitioned, day) AS ds_partitioned__day - , DATE_TRUNC(bookings_source_src_28000.ds_partitioned, isoweek) AS ds_partitioned__week - , DATE_TRUNC(bookings_source_src_28000.ds_partitioned, month) AS ds_partitioned__month - , DATE_TRUNC(bookings_source_src_28000.ds_partitioned, quarter) AS ds_partitioned__quarter - , DATE_TRUNC(bookings_source_src_28000.ds_partitioned, year) AS ds_partitioned__year + , DATETIME_TRUNC(bookings_source_src_28000.ds_partitioned, day) AS ds_partitioned__day + , DATETIME_TRUNC(bookings_source_src_28000.ds_partitioned, isoweek) AS ds_partitioned__week + , DATETIME_TRUNC(bookings_source_src_28000.ds_partitioned, month) AS ds_partitioned__month + , DATETIME_TRUNC(bookings_source_src_28000.ds_partitioned, quarter) AS ds_partitioned__quarter + , DATETIME_TRUNC(bookings_source_src_28000.ds_partitioned, year) AS ds_partitioned__year , EXTRACT(year FROM bookings_source_src_28000.ds_partitioned) AS ds_partitioned__extract_year , EXTRACT(quarter FROM bookings_source_src_28000.ds_partitioned) AS ds_partitioned__extract_quarter , EXTRACT(month FROM bookings_source_src_28000.ds_partitioned) AS ds_partitioned__extract_month , EXTRACT(day FROM bookings_source_src_28000.ds_partitioned) AS ds_partitioned__extract_day , IF(EXTRACT(dayofweek FROM bookings_source_src_28000.ds_partitioned) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_28000.ds_partitioned) - 1) AS ds_partitioned__extract_dow , EXTRACT(dayofyear FROM bookings_source_src_28000.ds_partitioned) AS ds_partitioned__extract_doy - , DATE_TRUNC(bookings_source_src_28000.paid_at, day) AS paid_at__day - , DATE_TRUNC(bookings_source_src_28000.paid_at, isoweek) AS paid_at__week - , DATE_TRUNC(bookings_source_src_28000.paid_at, month) AS paid_at__month - , DATE_TRUNC(bookings_source_src_28000.paid_at, quarter) AS paid_at__quarter - , DATE_TRUNC(bookings_source_src_28000.paid_at, year) AS paid_at__year + , DATETIME_TRUNC(bookings_source_src_28000.paid_at, day) AS paid_at__day + , DATETIME_TRUNC(bookings_source_src_28000.paid_at, isoweek) AS paid_at__week + , DATETIME_TRUNC(bookings_source_src_28000.paid_at, month) AS paid_at__month + , DATETIME_TRUNC(bookings_source_src_28000.paid_at, quarter) AS paid_at__quarter + , DATETIME_TRUNC(bookings_source_src_28000.paid_at, year) AS paid_at__year , EXTRACT(year FROM bookings_source_src_28000.paid_at) AS paid_at__extract_year , EXTRACT(quarter FROM bookings_source_src_28000.paid_at) AS paid_at__extract_quarter , EXTRACT(month FROM bookings_source_src_28000.paid_at) AS paid_at__extract_month @@ -165,33 +165,33 @@ FROM ( , IF(EXTRACT(dayofweek FROM bookings_source_src_28000.paid_at) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_28000.paid_at) - 1) AS paid_at__extract_dow , EXTRACT(dayofyear FROM bookings_source_src_28000.paid_at) AS paid_at__extract_doy , bookings_source_src_28000.is_instant AS booking__is_instant - , DATE_TRUNC(bookings_source_src_28000.ds, day) AS booking__ds__day - , DATE_TRUNC(bookings_source_src_28000.ds, isoweek) AS booking__ds__week - , DATE_TRUNC(bookings_source_src_28000.ds, month) AS booking__ds__month - , DATE_TRUNC(bookings_source_src_28000.ds, quarter) AS booking__ds__quarter - , DATE_TRUNC(bookings_source_src_28000.ds, year) AS booking__ds__year + , DATETIME_TRUNC(bookings_source_src_28000.ds, day) AS booking__ds__day + , DATETIME_TRUNC(bookings_source_src_28000.ds, isoweek) AS booking__ds__week + , DATETIME_TRUNC(bookings_source_src_28000.ds, month) AS booking__ds__month + , DATETIME_TRUNC(bookings_source_src_28000.ds, quarter) AS booking__ds__quarter + , DATETIME_TRUNC(bookings_source_src_28000.ds, year) AS booking__ds__year , EXTRACT(year FROM bookings_source_src_28000.ds) AS booking__ds__extract_year , EXTRACT(quarter FROM bookings_source_src_28000.ds) AS booking__ds__extract_quarter , EXTRACT(month FROM bookings_source_src_28000.ds) AS booking__ds__extract_month , EXTRACT(day FROM bookings_source_src_28000.ds) AS booking__ds__extract_day , IF(EXTRACT(dayofweek FROM bookings_source_src_28000.ds) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_28000.ds) - 1) AS booking__ds__extract_dow , EXTRACT(dayofyear FROM bookings_source_src_28000.ds) AS booking__ds__extract_doy - , DATE_TRUNC(bookings_source_src_28000.ds_partitioned, day) AS booking__ds_partitioned__day - , DATE_TRUNC(bookings_source_src_28000.ds_partitioned, isoweek) AS booking__ds_partitioned__week - , DATE_TRUNC(bookings_source_src_28000.ds_partitioned, month) AS booking__ds_partitioned__month - , DATE_TRUNC(bookings_source_src_28000.ds_partitioned, quarter) AS booking__ds_partitioned__quarter - , DATE_TRUNC(bookings_source_src_28000.ds_partitioned, year) AS booking__ds_partitioned__year + , DATETIME_TRUNC(bookings_source_src_28000.ds_partitioned, day) AS booking__ds_partitioned__day + , DATETIME_TRUNC(bookings_source_src_28000.ds_partitioned, isoweek) AS booking__ds_partitioned__week + , DATETIME_TRUNC(bookings_source_src_28000.ds_partitioned, month) AS booking__ds_partitioned__month + , DATETIME_TRUNC(bookings_source_src_28000.ds_partitioned, quarter) AS booking__ds_partitioned__quarter + , DATETIME_TRUNC(bookings_source_src_28000.ds_partitioned, year) AS booking__ds_partitioned__year , EXTRACT(year FROM bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__extract_year , EXTRACT(quarter FROM bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__extract_quarter , EXTRACT(month FROM bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__extract_month , EXTRACT(day FROM bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__extract_day , IF(EXTRACT(dayofweek FROM bookings_source_src_28000.ds_partitioned) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_28000.ds_partitioned) - 1) AS booking__ds_partitioned__extract_dow , EXTRACT(dayofyear FROM bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__extract_doy - , DATE_TRUNC(bookings_source_src_28000.paid_at, day) AS booking__paid_at__day - , DATE_TRUNC(bookings_source_src_28000.paid_at, isoweek) AS booking__paid_at__week - , DATE_TRUNC(bookings_source_src_28000.paid_at, month) AS booking__paid_at__month - , DATE_TRUNC(bookings_source_src_28000.paid_at, quarter) AS booking__paid_at__quarter - , DATE_TRUNC(bookings_source_src_28000.paid_at, year) AS booking__paid_at__year + , DATETIME_TRUNC(bookings_source_src_28000.paid_at, day) AS booking__paid_at__day + , DATETIME_TRUNC(bookings_source_src_28000.paid_at, isoweek) AS booking__paid_at__week + , DATETIME_TRUNC(bookings_source_src_28000.paid_at, month) AS booking__paid_at__month + , DATETIME_TRUNC(bookings_source_src_28000.paid_at, quarter) AS booking__paid_at__quarter + , DATETIME_TRUNC(bookings_source_src_28000.paid_at, year) AS booking__paid_at__year , EXTRACT(year FROM bookings_source_src_28000.paid_at) AS booking__paid_at__extract_year , EXTRACT(quarter FROM bookings_source_src_28000.paid_at) AS booking__paid_at__extract_quarter , EXTRACT(month FROM bookings_source_src_28000.paid_at) AS booking__paid_at__extract_month diff --git a/tests_metricflow/snapshots/test_fill_nulls_with_rendering.py/SqlQueryPlan/BigQuery/test_simple_fill_nulls_with_0_with_non_metric_time__plan0.sql b/tests_metricflow/snapshots/test_fill_nulls_with_rendering.py/SqlQueryPlan/BigQuery/test_simple_fill_nulls_with_0_with_non_metric_time__plan0.sql index ae82f2883f..22aed5a4b8 100644 --- a/tests_metricflow/snapshots/test_fill_nulls_with_rendering.py/SqlQueryPlan/BigQuery/test_simple_fill_nulls_with_0_with_non_metric_time__plan0.sql +++ b/tests_metricflow/snapshots/test_fill_nulls_with_rendering.py/SqlQueryPlan/BigQuery/test_simple_fill_nulls_with_0_with_non_metric_time__plan0.sql @@ -131,33 +131,33 @@ FROM ( , bookings_source_src_28000.booking_value AS approximate_continuous_booking_value_p99 , bookings_source_src_28000.booking_value AS approximate_discrete_booking_value_p99 , bookings_source_src_28000.is_instant - , DATE_TRUNC(bookings_source_src_28000.ds, day) AS ds__day - , DATE_TRUNC(bookings_source_src_28000.ds, isoweek) AS ds__week - , DATE_TRUNC(bookings_source_src_28000.ds, month) AS ds__month - , DATE_TRUNC(bookings_source_src_28000.ds, quarter) AS ds__quarter - , DATE_TRUNC(bookings_source_src_28000.ds, year) AS ds__year + , DATETIME_TRUNC(bookings_source_src_28000.ds, day) AS ds__day + , DATETIME_TRUNC(bookings_source_src_28000.ds, isoweek) AS ds__week + , DATETIME_TRUNC(bookings_source_src_28000.ds, month) AS ds__month + , DATETIME_TRUNC(bookings_source_src_28000.ds, quarter) AS ds__quarter + , DATETIME_TRUNC(bookings_source_src_28000.ds, year) AS ds__year , EXTRACT(year FROM bookings_source_src_28000.ds) AS ds__extract_year , EXTRACT(quarter FROM bookings_source_src_28000.ds) AS ds__extract_quarter , EXTRACT(month FROM bookings_source_src_28000.ds) AS ds__extract_month , EXTRACT(day FROM bookings_source_src_28000.ds) AS ds__extract_day , IF(EXTRACT(dayofweek FROM bookings_source_src_28000.ds) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_28000.ds) - 1) AS ds__extract_dow , EXTRACT(dayofyear FROM bookings_source_src_28000.ds) AS ds__extract_doy - , DATE_TRUNC(bookings_source_src_28000.ds_partitioned, day) AS ds_partitioned__day - , DATE_TRUNC(bookings_source_src_28000.ds_partitioned, isoweek) AS ds_partitioned__week - , DATE_TRUNC(bookings_source_src_28000.ds_partitioned, month) AS ds_partitioned__month - , DATE_TRUNC(bookings_source_src_28000.ds_partitioned, quarter) AS ds_partitioned__quarter - , DATE_TRUNC(bookings_source_src_28000.ds_partitioned, year) AS ds_partitioned__year + , DATETIME_TRUNC(bookings_source_src_28000.ds_partitioned, day) AS ds_partitioned__day + , DATETIME_TRUNC(bookings_source_src_28000.ds_partitioned, isoweek) AS ds_partitioned__week + , DATETIME_TRUNC(bookings_source_src_28000.ds_partitioned, month) AS ds_partitioned__month + , DATETIME_TRUNC(bookings_source_src_28000.ds_partitioned, quarter) AS ds_partitioned__quarter + , DATETIME_TRUNC(bookings_source_src_28000.ds_partitioned, year) AS ds_partitioned__year , EXTRACT(year FROM bookings_source_src_28000.ds_partitioned) AS ds_partitioned__extract_year , EXTRACT(quarter FROM bookings_source_src_28000.ds_partitioned) AS ds_partitioned__extract_quarter , EXTRACT(month FROM bookings_source_src_28000.ds_partitioned) AS ds_partitioned__extract_month , EXTRACT(day FROM bookings_source_src_28000.ds_partitioned) AS ds_partitioned__extract_day , IF(EXTRACT(dayofweek FROM bookings_source_src_28000.ds_partitioned) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_28000.ds_partitioned) - 1) AS ds_partitioned__extract_dow , EXTRACT(dayofyear FROM bookings_source_src_28000.ds_partitioned) AS ds_partitioned__extract_doy - , DATE_TRUNC(bookings_source_src_28000.paid_at, day) AS paid_at__day - , DATE_TRUNC(bookings_source_src_28000.paid_at, isoweek) AS paid_at__week - , DATE_TRUNC(bookings_source_src_28000.paid_at, month) AS paid_at__month - , DATE_TRUNC(bookings_source_src_28000.paid_at, quarter) AS paid_at__quarter - , DATE_TRUNC(bookings_source_src_28000.paid_at, year) AS paid_at__year + , DATETIME_TRUNC(bookings_source_src_28000.paid_at, day) AS paid_at__day + , DATETIME_TRUNC(bookings_source_src_28000.paid_at, isoweek) AS paid_at__week + , DATETIME_TRUNC(bookings_source_src_28000.paid_at, month) AS paid_at__month + , DATETIME_TRUNC(bookings_source_src_28000.paid_at, quarter) AS paid_at__quarter + , DATETIME_TRUNC(bookings_source_src_28000.paid_at, year) AS paid_at__year , EXTRACT(year FROM bookings_source_src_28000.paid_at) AS paid_at__extract_year , EXTRACT(quarter FROM bookings_source_src_28000.paid_at) AS paid_at__extract_quarter , EXTRACT(month FROM bookings_source_src_28000.paid_at) AS paid_at__extract_month @@ -165,33 +165,33 @@ FROM ( , IF(EXTRACT(dayofweek FROM bookings_source_src_28000.paid_at) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_28000.paid_at) - 1) AS paid_at__extract_dow , EXTRACT(dayofyear FROM bookings_source_src_28000.paid_at) AS paid_at__extract_doy , bookings_source_src_28000.is_instant AS booking__is_instant - , DATE_TRUNC(bookings_source_src_28000.ds, day) AS booking__ds__day - , DATE_TRUNC(bookings_source_src_28000.ds, isoweek) AS booking__ds__week - , DATE_TRUNC(bookings_source_src_28000.ds, month) AS booking__ds__month - , DATE_TRUNC(bookings_source_src_28000.ds, quarter) AS booking__ds__quarter - , DATE_TRUNC(bookings_source_src_28000.ds, year) AS booking__ds__year + , DATETIME_TRUNC(bookings_source_src_28000.ds, day) AS booking__ds__day + , DATETIME_TRUNC(bookings_source_src_28000.ds, isoweek) AS booking__ds__week + , DATETIME_TRUNC(bookings_source_src_28000.ds, month) AS booking__ds__month + , DATETIME_TRUNC(bookings_source_src_28000.ds, quarter) AS booking__ds__quarter + , DATETIME_TRUNC(bookings_source_src_28000.ds, year) AS booking__ds__year , EXTRACT(year FROM bookings_source_src_28000.ds) AS booking__ds__extract_year , EXTRACT(quarter FROM bookings_source_src_28000.ds) AS booking__ds__extract_quarter , EXTRACT(month FROM bookings_source_src_28000.ds) AS booking__ds__extract_month , EXTRACT(day FROM bookings_source_src_28000.ds) AS booking__ds__extract_day , IF(EXTRACT(dayofweek FROM bookings_source_src_28000.ds) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_28000.ds) - 1) AS booking__ds__extract_dow , EXTRACT(dayofyear FROM bookings_source_src_28000.ds) AS booking__ds__extract_doy - , DATE_TRUNC(bookings_source_src_28000.ds_partitioned, day) AS booking__ds_partitioned__day - , DATE_TRUNC(bookings_source_src_28000.ds_partitioned, isoweek) AS booking__ds_partitioned__week - , DATE_TRUNC(bookings_source_src_28000.ds_partitioned, month) AS booking__ds_partitioned__month - , DATE_TRUNC(bookings_source_src_28000.ds_partitioned, quarter) AS booking__ds_partitioned__quarter - , DATE_TRUNC(bookings_source_src_28000.ds_partitioned, year) AS booking__ds_partitioned__year + , DATETIME_TRUNC(bookings_source_src_28000.ds_partitioned, day) AS booking__ds_partitioned__day + , DATETIME_TRUNC(bookings_source_src_28000.ds_partitioned, isoweek) AS booking__ds_partitioned__week + , DATETIME_TRUNC(bookings_source_src_28000.ds_partitioned, month) AS booking__ds_partitioned__month + , DATETIME_TRUNC(bookings_source_src_28000.ds_partitioned, quarter) AS booking__ds_partitioned__quarter + , DATETIME_TRUNC(bookings_source_src_28000.ds_partitioned, year) AS booking__ds_partitioned__year , EXTRACT(year FROM bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__extract_year , EXTRACT(quarter FROM bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__extract_quarter , EXTRACT(month FROM bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__extract_month , EXTRACT(day FROM bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__extract_day , IF(EXTRACT(dayofweek FROM bookings_source_src_28000.ds_partitioned) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_28000.ds_partitioned) - 1) AS booking__ds_partitioned__extract_dow , EXTRACT(dayofyear FROM bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__extract_doy - , DATE_TRUNC(bookings_source_src_28000.paid_at, day) AS booking__paid_at__day - , DATE_TRUNC(bookings_source_src_28000.paid_at, isoweek) AS booking__paid_at__week - , DATE_TRUNC(bookings_source_src_28000.paid_at, month) AS booking__paid_at__month - , DATE_TRUNC(bookings_source_src_28000.paid_at, quarter) AS booking__paid_at__quarter - , DATE_TRUNC(bookings_source_src_28000.paid_at, year) AS booking__paid_at__year + , DATETIME_TRUNC(bookings_source_src_28000.paid_at, day) AS booking__paid_at__day + , DATETIME_TRUNC(bookings_source_src_28000.paid_at, isoweek) AS booking__paid_at__week + , DATETIME_TRUNC(bookings_source_src_28000.paid_at, month) AS booking__paid_at__month + , DATETIME_TRUNC(bookings_source_src_28000.paid_at, quarter) AS booking__paid_at__quarter + , DATETIME_TRUNC(bookings_source_src_28000.paid_at, year) AS booking__paid_at__year , EXTRACT(year FROM bookings_source_src_28000.paid_at) AS booking__paid_at__extract_year , EXTRACT(quarter FROM bookings_source_src_28000.paid_at) AS booking__paid_at__extract_quarter , EXTRACT(month FROM bookings_source_src_28000.paid_at) AS booking__paid_at__extract_month diff --git a/tests_metricflow/snapshots/test_fill_nulls_with_rendering.py/SqlQueryPlan/BigQuery/test_simple_fill_nulls_with_0_with_non_metric_time__plan0_optimized.sql b/tests_metricflow/snapshots/test_fill_nulls_with_rendering.py/SqlQueryPlan/BigQuery/test_simple_fill_nulls_with_0_with_non_metric_time__plan0_optimized.sql index ad2cfca45d..b760d99d5e 100644 --- a/tests_metricflow/snapshots/test_fill_nulls_with_rendering.py/SqlQueryPlan/BigQuery/test_simple_fill_nulls_with_0_with_non_metric_time__plan0_optimized.sql +++ b/tests_metricflow/snapshots/test_fill_nulls_with_rendering.py/SqlQueryPlan/BigQuery/test_simple_fill_nulls_with_0_with_non_metric_time__plan0_optimized.sql @@ -12,7 +12,7 @@ FROM ( -- Metric Time Dimension 'ds' -- Pass Only Elements: ['bookings', 'booking__paid_at__day'] SELECT - DATE_TRUNC(paid_at, day) AS booking__paid_at__day + DATETIME_TRUNC(paid_at, day) AS booking__paid_at__day , 1 AS bookings FROM ***************************.fct_bookings bookings_source_src_28000 ) subq_6 diff --git a/tests_metricflow/snapshots/test_fill_nulls_with_rendering.py/SqlQueryPlan/BigQuery/test_simple_fill_nulls_without_time_spine__plan0.sql b/tests_metricflow/snapshots/test_fill_nulls_with_rendering.py/SqlQueryPlan/BigQuery/test_simple_fill_nulls_without_time_spine__plan0.sql index 04e98d75e0..b9b21db2f2 100644 --- a/tests_metricflow/snapshots/test_fill_nulls_with_rendering.py/SqlQueryPlan/BigQuery/test_simple_fill_nulls_without_time_spine__plan0.sql +++ b/tests_metricflow/snapshots/test_fill_nulls_with_rendering.py/SqlQueryPlan/BigQuery/test_simple_fill_nulls_without_time_spine__plan0.sql @@ -131,33 +131,33 @@ FROM ( , bookings_source_src_28000.booking_value AS approximate_continuous_booking_value_p99 , bookings_source_src_28000.booking_value AS approximate_discrete_booking_value_p99 , bookings_source_src_28000.is_instant - , DATE_TRUNC(bookings_source_src_28000.ds, day) AS ds__day - , DATE_TRUNC(bookings_source_src_28000.ds, isoweek) AS ds__week - , DATE_TRUNC(bookings_source_src_28000.ds, month) AS ds__month - , DATE_TRUNC(bookings_source_src_28000.ds, quarter) AS ds__quarter - , DATE_TRUNC(bookings_source_src_28000.ds, year) AS ds__year + , DATETIME_TRUNC(bookings_source_src_28000.ds, day) AS ds__day + , DATETIME_TRUNC(bookings_source_src_28000.ds, isoweek) AS ds__week + , DATETIME_TRUNC(bookings_source_src_28000.ds, month) AS ds__month + , DATETIME_TRUNC(bookings_source_src_28000.ds, quarter) AS ds__quarter + , DATETIME_TRUNC(bookings_source_src_28000.ds, year) AS ds__year , EXTRACT(year FROM bookings_source_src_28000.ds) AS ds__extract_year , EXTRACT(quarter FROM bookings_source_src_28000.ds) AS ds__extract_quarter , EXTRACT(month FROM bookings_source_src_28000.ds) AS ds__extract_month , EXTRACT(day FROM bookings_source_src_28000.ds) AS ds__extract_day , IF(EXTRACT(dayofweek FROM bookings_source_src_28000.ds) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_28000.ds) - 1) AS ds__extract_dow , EXTRACT(dayofyear FROM bookings_source_src_28000.ds) AS ds__extract_doy - , DATE_TRUNC(bookings_source_src_28000.ds_partitioned, day) AS ds_partitioned__day - , DATE_TRUNC(bookings_source_src_28000.ds_partitioned, isoweek) AS ds_partitioned__week - , DATE_TRUNC(bookings_source_src_28000.ds_partitioned, month) AS ds_partitioned__month - , DATE_TRUNC(bookings_source_src_28000.ds_partitioned, quarter) AS ds_partitioned__quarter - , DATE_TRUNC(bookings_source_src_28000.ds_partitioned, year) AS ds_partitioned__year + , DATETIME_TRUNC(bookings_source_src_28000.ds_partitioned, day) AS ds_partitioned__day + , DATETIME_TRUNC(bookings_source_src_28000.ds_partitioned, isoweek) AS ds_partitioned__week + , DATETIME_TRUNC(bookings_source_src_28000.ds_partitioned, month) AS ds_partitioned__month + , DATETIME_TRUNC(bookings_source_src_28000.ds_partitioned, quarter) AS ds_partitioned__quarter + , DATETIME_TRUNC(bookings_source_src_28000.ds_partitioned, year) AS ds_partitioned__year , EXTRACT(year FROM bookings_source_src_28000.ds_partitioned) AS ds_partitioned__extract_year , EXTRACT(quarter FROM bookings_source_src_28000.ds_partitioned) AS ds_partitioned__extract_quarter , EXTRACT(month FROM bookings_source_src_28000.ds_partitioned) AS ds_partitioned__extract_month , EXTRACT(day FROM bookings_source_src_28000.ds_partitioned) AS ds_partitioned__extract_day , IF(EXTRACT(dayofweek FROM bookings_source_src_28000.ds_partitioned) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_28000.ds_partitioned) - 1) AS ds_partitioned__extract_dow , EXTRACT(dayofyear FROM bookings_source_src_28000.ds_partitioned) AS ds_partitioned__extract_doy - , DATE_TRUNC(bookings_source_src_28000.paid_at, day) AS paid_at__day - , DATE_TRUNC(bookings_source_src_28000.paid_at, isoweek) AS paid_at__week - , DATE_TRUNC(bookings_source_src_28000.paid_at, month) AS paid_at__month - , DATE_TRUNC(bookings_source_src_28000.paid_at, quarter) AS paid_at__quarter - , DATE_TRUNC(bookings_source_src_28000.paid_at, year) AS paid_at__year + , DATETIME_TRUNC(bookings_source_src_28000.paid_at, day) AS paid_at__day + , DATETIME_TRUNC(bookings_source_src_28000.paid_at, isoweek) AS paid_at__week + , DATETIME_TRUNC(bookings_source_src_28000.paid_at, month) AS paid_at__month + , DATETIME_TRUNC(bookings_source_src_28000.paid_at, quarter) AS paid_at__quarter + , DATETIME_TRUNC(bookings_source_src_28000.paid_at, year) AS paid_at__year , EXTRACT(year FROM bookings_source_src_28000.paid_at) AS paid_at__extract_year , EXTRACT(quarter FROM bookings_source_src_28000.paid_at) AS paid_at__extract_quarter , EXTRACT(month FROM bookings_source_src_28000.paid_at) AS paid_at__extract_month @@ -165,33 +165,33 @@ FROM ( , IF(EXTRACT(dayofweek FROM bookings_source_src_28000.paid_at) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_28000.paid_at) - 1) AS paid_at__extract_dow , EXTRACT(dayofyear FROM bookings_source_src_28000.paid_at) AS paid_at__extract_doy , bookings_source_src_28000.is_instant AS booking__is_instant - , DATE_TRUNC(bookings_source_src_28000.ds, day) AS booking__ds__day - , DATE_TRUNC(bookings_source_src_28000.ds, isoweek) AS booking__ds__week - , DATE_TRUNC(bookings_source_src_28000.ds, month) AS booking__ds__month - , DATE_TRUNC(bookings_source_src_28000.ds, quarter) AS booking__ds__quarter - , DATE_TRUNC(bookings_source_src_28000.ds, year) AS booking__ds__year + , DATETIME_TRUNC(bookings_source_src_28000.ds, day) AS booking__ds__day + , DATETIME_TRUNC(bookings_source_src_28000.ds, isoweek) AS booking__ds__week + , DATETIME_TRUNC(bookings_source_src_28000.ds, month) AS booking__ds__month + , DATETIME_TRUNC(bookings_source_src_28000.ds, quarter) AS booking__ds__quarter + , DATETIME_TRUNC(bookings_source_src_28000.ds, year) AS booking__ds__year , EXTRACT(year FROM bookings_source_src_28000.ds) AS booking__ds__extract_year , EXTRACT(quarter FROM bookings_source_src_28000.ds) AS booking__ds__extract_quarter , EXTRACT(month FROM bookings_source_src_28000.ds) AS booking__ds__extract_month , EXTRACT(day FROM bookings_source_src_28000.ds) AS booking__ds__extract_day , IF(EXTRACT(dayofweek FROM bookings_source_src_28000.ds) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_28000.ds) - 1) AS booking__ds__extract_dow , EXTRACT(dayofyear FROM bookings_source_src_28000.ds) AS booking__ds__extract_doy - , DATE_TRUNC(bookings_source_src_28000.ds_partitioned, day) AS booking__ds_partitioned__day - , DATE_TRUNC(bookings_source_src_28000.ds_partitioned, isoweek) AS booking__ds_partitioned__week - , DATE_TRUNC(bookings_source_src_28000.ds_partitioned, month) AS booking__ds_partitioned__month - , DATE_TRUNC(bookings_source_src_28000.ds_partitioned, quarter) AS booking__ds_partitioned__quarter - , DATE_TRUNC(bookings_source_src_28000.ds_partitioned, year) AS booking__ds_partitioned__year + , DATETIME_TRUNC(bookings_source_src_28000.ds_partitioned, day) AS booking__ds_partitioned__day + , DATETIME_TRUNC(bookings_source_src_28000.ds_partitioned, isoweek) AS booking__ds_partitioned__week + , DATETIME_TRUNC(bookings_source_src_28000.ds_partitioned, month) AS booking__ds_partitioned__month + , DATETIME_TRUNC(bookings_source_src_28000.ds_partitioned, quarter) AS booking__ds_partitioned__quarter + , DATETIME_TRUNC(bookings_source_src_28000.ds_partitioned, year) AS booking__ds_partitioned__year , EXTRACT(year FROM bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__extract_year , EXTRACT(quarter FROM bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__extract_quarter , EXTRACT(month FROM bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__extract_month , EXTRACT(day FROM bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__extract_day , IF(EXTRACT(dayofweek FROM bookings_source_src_28000.ds_partitioned) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_28000.ds_partitioned) - 1) AS booking__ds_partitioned__extract_dow , EXTRACT(dayofyear FROM bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__extract_doy - , DATE_TRUNC(bookings_source_src_28000.paid_at, day) AS booking__paid_at__day - , DATE_TRUNC(bookings_source_src_28000.paid_at, isoweek) AS booking__paid_at__week - , DATE_TRUNC(bookings_source_src_28000.paid_at, month) AS booking__paid_at__month - , DATE_TRUNC(bookings_source_src_28000.paid_at, quarter) AS booking__paid_at__quarter - , DATE_TRUNC(bookings_source_src_28000.paid_at, year) AS booking__paid_at__year + , DATETIME_TRUNC(bookings_source_src_28000.paid_at, day) AS booking__paid_at__day + , DATETIME_TRUNC(bookings_source_src_28000.paid_at, isoweek) AS booking__paid_at__week + , DATETIME_TRUNC(bookings_source_src_28000.paid_at, month) AS booking__paid_at__month + , DATETIME_TRUNC(bookings_source_src_28000.paid_at, quarter) AS booking__paid_at__quarter + , DATETIME_TRUNC(bookings_source_src_28000.paid_at, year) AS booking__paid_at__year , EXTRACT(year FROM bookings_source_src_28000.paid_at) AS booking__paid_at__extract_year , EXTRACT(quarter FROM bookings_source_src_28000.paid_at) AS booking__paid_at__extract_quarter , EXTRACT(month FROM bookings_source_src_28000.paid_at) AS booking__paid_at__extract_month diff --git a/tests_metricflow/snapshots/test_fill_nulls_with_rendering.py/SqlQueryPlan/BigQuery/test_simple_fill_nulls_without_time_spine__plan0_optimized.sql b/tests_metricflow/snapshots/test_fill_nulls_with_rendering.py/SqlQueryPlan/BigQuery/test_simple_fill_nulls_without_time_spine__plan0_optimized.sql index 8afccbfa14..33c3777a3e 100644 --- a/tests_metricflow/snapshots/test_fill_nulls_with_rendering.py/SqlQueryPlan/BigQuery/test_simple_fill_nulls_without_time_spine__plan0_optimized.sql +++ b/tests_metricflow/snapshots/test_fill_nulls_with_rendering.py/SqlQueryPlan/BigQuery/test_simple_fill_nulls_without_time_spine__plan0_optimized.sql @@ -12,7 +12,7 @@ FROM ( -- Metric Time Dimension 'ds' -- Pass Only Elements: ['bookings', 'metric_time__day'] SELECT - DATE_TRUNC(ds, day) AS metric_time__day + DATETIME_TRUNC(ds, day) AS metric_time__day , 1 AS bookings FROM ***************************.fct_bookings bookings_source_src_28000 ) subq_6 diff --git a/tests_metricflow/snapshots/test_granularity_date_part_rendering.py/SqlQueryPlan/BigQuery/test_offset_window_with_date_part__plan0.sql b/tests_metricflow/snapshots/test_granularity_date_part_rendering.py/SqlQueryPlan/BigQuery/test_offset_window_with_date_part__plan0.sql index 93ca1a32ec..5885d993cc 100644 --- a/tests_metricflow/snapshots/test_granularity_date_part_rendering.py/SqlQueryPlan/BigQuery/test_offset_window_with_date_part__plan0.sql +++ b/tests_metricflow/snapshots/test_granularity_date_part_rendering.py/SqlQueryPlan/BigQuery/test_offset_window_with_date_part__plan0.sql @@ -142,33 +142,33 @@ FROM ( , bookings_source_src_28000.booking_value AS approximate_continuous_booking_value_p99 , bookings_source_src_28000.booking_value AS approximate_discrete_booking_value_p99 , bookings_source_src_28000.is_instant - , DATE_TRUNC(bookings_source_src_28000.ds, day) AS ds__day - , DATE_TRUNC(bookings_source_src_28000.ds, isoweek) AS ds__week - , DATE_TRUNC(bookings_source_src_28000.ds, month) AS ds__month - , DATE_TRUNC(bookings_source_src_28000.ds, quarter) AS ds__quarter - , DATE_TRUNC(bookings_source_src_28000.ds, year) AS ds__year + , DATETIME_TRUNC(bookings_source_src_28000.ds, day) AS ds__day + , DATETIME_TRUNC(bookings_source_src_28000.ds, isoweek) AS ds__week + , DATETIME_TRUNC(bookings_source_src_28000.ds, month) AS ds__month + , DATETIME_TRUNC(bookings_source_src_28000.ds, quarter) AS ds__quarter + , DATETIME_TRUNC(bookings_source_src_28000.ds, year) AS ds__year , EXTRACT(year FROM bookings_source_src_28000.ds) AS ds__extract_year , EXTRACT(quarter FROM bookings_source_src_28000.ds) AS ds__extract_quarter , EXTRACT(month FROM bookings_source_src_28000.ds) AS ds__extract_month , EXTRACT(day FROM bookings_source_src_28000.ds) AS ds__extract_day , IF(EXTRACT(dayofweek FROM bookings_source_src_28000.ds) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_28000.ds) - 1) AS ds__extract_dow , EXTRACT(dayofyear FROM bookings_source_src_28000.ds) AS ds__extract_doy - , DATE_TRUNC(bookings_source_src_28000.ds_partitioned, day) AS ds_partitioned__day - , DATE_TRUNC(bookings_source_src_28000.ds_partitioned, isoweek) AS ds_partitioned__week - , DATE_TRUNC(bookings_source_src_28000.ds_partitioned, month) AS ds_partitioned__month - , DATE_TRUNC(bookings_source_src_28000.ds_partitioned, quarter) AS ds_partitioned__quarter - , DATE_TRUNC(bookings_source_src_28000.ds_partitioned, year) AS ds_partitioned__year + , DATETIME_TRUNC(bookings_source_src_28000.ds_partitioned, day) AS ds_partitioned__day + , DATETIME_TRUNC(bookings_source_src_28000.ds_partitioned, isoweek) AS ds_partitioned__week + , DATETIME_TRUNC(bookings_source_src_28000.ds_partitioned, month) AS ds_partitioned__month + , DATETIME_TRUNC(bookings_source_src_28000.ds_partitioned, quarter) AS ds_partitioned__quarter + , DATETIME_TRUNC(bookings_source_src_28000.ds_partitioned, year) AS ds_partitioned__year , EXTRACT(year FROM bookings_source_src_28000.ds_partitioned) AS ds_partitioned__extract_year , EXTRACT(quarter FROM bookings_source_src_28000.ds_partitioned) AS ds_partitioned__extract_quarter , EXTRACT(month FROM bookings_source_src_28000.ds_partitioned) AS ds_partitioned__extract_month , EXTRACT(day FROM bookings_source_src_28000.ds_partitioned) AS ds_partitioned__extract_day , IF(EXTRACT(dayofweek FROM bookings_source_src_28000.ds_partitioned) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_28000.ds_partitioned) - 1) AS ds_partitioned__extract_dow , EXTRACT(dayofyear FROM bookings_source_src_28000.ds_partitioned) AS ds_partitioned__extract_doy - , DATE_TRUNC(bookings_source_src_28000.paid_at, day) AS paid_at__day - , DATE_TRUNC(bookings_source_src_28000.paid_at, isoweek) AS paid_at__week - , DATE_TRUNC(bookings_source_src_28000.paid_at, month) AS paid_at__month - , DATE_TRUNC(bookings_source_src_28000.paid_at, quarter) AS paid_at__quarter - , DATE_TRUNC(bookings_source_src_28000.paid_at, year) AS paid_at__year + , DATETIME_TRUNC(bookings_source_src_28000.paid_at, day) AS paid_at__day + , DATETIME_TRUNC(bookings_source_src_28000.paid_at, isoweek) AS paid_at__week + , DATETIME_TRUNC(bookings_source_src_28000.paid_at, month) AS paid_at__month + , DATETIME_TRUNC(bookings_source_src_28000.paid_at, quarter) AS paid_at__quarter + , DATETIME_TRUNC(bookings_source_src_28000.paid_at, year) AS paid_at__year , EXTRACT(year FROM bookings_source_src_28000.paid_at) AS paid_at__extract_year , EXTRACT(quarter FROM bookings_source_src_28000.paid_at) AS paid_at__extract_quarter , EXTRACT(month FROM bookings_source_src_28000.paid_at) AS paid_at__extract_month @@ -176,33 +176,33 @@ FROM ( , IF(EXTRACT(dayofweek FROM bookings_source_src_28000.paid_at) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_28000.paid_at) - 1) AS paid_at__extract_dow , EXTRACT(dayofyear FROM bookings_source_src_28000.paid_at) AS paid_at__extract_doy , bookings_source_src_28000.is_instant AS booking__is_instant - , DATE_TRUNC(bookings_source_src_28000.ds, day) AS booking__ds__day - , DATE_TRUNC(bookings_source_src_28000.ds, isoweek) AS booking__ds__week - , DATE_TRUNC(bookings_source_src_28000.ds, month) AS booking__ds__month - , DATE_TRUNC(bookings_source_src_28000.ds, quarter) AS booking__ds__quarter - , DATE_TRUNC(bookings_source_src_28000.ds, year) AS booking__ds__year + , DATETIME_TRUNC(bookings_source_src_28000.ds, day) AS booking__ds__day + , DATETIME_TRUNC(bookings_source_src_28000.ds, isoweek) AS booking__ds__week + , DATETIME_TRUNC(bookings_source_src_28000.ds, month) AS booking__ds__month + , DATETIME_TRUNC(bookings_source_src_28000.ds, quarter) AS booking__ds__quarter + , DATETIME_TRUNC(bookings_source_src_28000.ds, year) AS booking__ds__year , EXTRACT(year FROM bookings_source_src_28000.ds) AS booking__ds__extract_year , EXTRACT(quarter FROM bookings_source_src_28000.ds) AS booking__ds__extract_quarter , EXTRACT(month FROM bookings_source_src_28000.ds) AS booking__ds__extract_month , EXTRACT(day FROM bookings_source_src_28000.ds) AS booking__ds__extract_day , IF(EXTRACT(dayofweek FROM bookings_source_src_28000.ds) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_28000.ds) - 1) AS booking__ds__extract_dow , EXTRACT(dayofyear FROM bookings_source_src_28000.ds) AS booking__ds__extract_doy - , DATE_TRUNC(bookings_source_src_28000.ds_partitioned, day) AS booking__ds_partitioned__day - , DATE_TRUNC(bookings_source_src_28000.ds_partitioned, isoweek) AS booking__ds_partitioned__week - , DATE_TRUNC(bookings_source_src_28000.ds_partitioned, month) AS booking__ds_partitioned__month - , DATE_TRUNC(bookings_source_src_28000.ds_partitioned, quarter) AS booking__ds_partitioned__quarter - , DATE_TRUNC(bookings_source_src_28000.ds_partitioned, year) AS booking__ds_partitioned__year + , DATETIME_TRUNC(bookings_source_src_28000.ds_partitioned, day) AS booking__ds_partitioned__day + , DATETIME_TRUNC(bookings_source_src_28000.ds_partitioned, isoweek) AS booking__ds_partitioned__week + , DATETIME_TRUNC(bookings_source_src_28000.ds_partitioned, month) AS booking__ds_partitioned__month + , DATETIME_TRUNC(bookings_source_src_28000.ds_partitioned, quarter) AS booking__ds_partitioned__quarter + , DATETIME_TRUNC(bookings_source_src_28000.ds_partitioned, year) AS booking__ds_partitioned__year , EXTRACT(year FROM bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__extract_year , EXTRACT(quarter FROM bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__extract_quarter , EXTRACT(month FROM bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__extract_month , EXTRACT(day FROM bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__extract_day , IF(EXTRACT(dayofweek FROM bookings_source_src_28000.ds_partitioned) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_28000.ds_partitioned) - 1) AS booking__ds_partitioned__extract_dow , EXTRACT(dayofyear FROM bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__extract_doy - , DATE_TRUNC(bookings_source_src_28000.paid_at, day) AS booking__paid_at__day - , DATE_TRUNC(bookings_source_src_28000.paid_at, isoweek) AS booking__paid_at__week - , DATE_TRUNC(bookings_source_src_28000.paid_at, month) AS booking__paid_at__month - , DATE_TRUNC(bookings_source_src_28000.paid_at, quarter) AS booking__paid_at__quarter - , DATE_TRUNC(bookings_source_src_28000.paid_at, year) AS booking__paid_at__year + , DATETIME_TRUNC(bookings_source_src_28000.paid_at, day) AS booking__paid_at__day + , DATETIME_TRUNC(bookings_source_src_28000.paid_at, isoweek) AS booking__paid_at__week + , DATETIME_TRUNC(bookings_source_src_28000.paid_at, month) AS booking__paid_at__month + , DATETIME_TRUNC(bookings_source_src_28000.paid_at, quarter) AS booking__paid_at__quarter + , DATETIME_TRUNC(bookings_source_src_28000.paid_at, year) AS booking__paid_at__year , EXTRACT(year FROM bookings_source_src_28000.paid_at) AS booking__paid_at__extract_year , EXTRACT(quarter FROM bookings_source_src_28000.paid_at) AS booking__paid_at__extract_quarter , EXTRACT(month FROM bookings_source_src_28000.paid_at) AS booking__paid_at__extract_month @@ -242,10 +242,10 @@ FROM ( -- Join to Time Spine Dataset SELECT subq_7.metric_time__day AS metric_time__day - , DATE_TRUNC(subq_7.metric_time__day, isoweek) AS metric_time__week - , DATE_TRUNC(subq_7.metric_time__day, month) AS metric_time__month - , DATE_TRUNC(subq_7.metric_time__day, quarter) AS metric_time__quarter - , DATE_TRUNC(subq_7.metric_time__day, year) AS metric_time__year + , DATETIME_TRUNC(subq_7.metric_time__day, isoweek) AS metric_time__week + , DATETIME_TRUNC(subq_7.metric_time__day, month) AS metric_time__month + , DATETIME_TRUNC(subq_7.metric_time__day, quarter) AS metric_time__quarter + , DATETIME_TRUNC(subq_7.metric_time__day, year) AS metric_time__year , EXTRACT(year FROM subq_7.metric_time__day) AS metric_time__extract_year , EXTRACT(quarter FROM subq_7.metric_time__day) AS metric_time__extract_quarter , EXTRACT(month FROM subq_7.metric_time__day) AS metric_time__extract_month @@ -464,33 +464,33 @@ FROM ( , bookings_source_src_28000.booking_value AS approximate_continuous_booking_value_p99 , bookings_source_src_28000.booking_value AS approximate_discrete_booking_value_p99 , bookings_source_src_28000.is_instant - , DATE_TRUNC(bookings_source_src_28000.ds, day) AS ds__day - , DATE_TRUNC(bookings_source_src_28000.ds, isoweek) AS ds__week - , DATE_TRUNC(bookings_source_src_28000.ds, month) AS ds__month - , DATE_TRUNC(bookings_source_src_28000.ds, quarter) AS ds__quarter - , DATE_TRUNC(bookings_source_src_28000.ds, year) AS ds__year + , DATETIME_TRUNC(bookings_source_src_28000.ds, day) AS ds__day + , DATETIME_TRUNC(bookings_source_src_28000.ds, isoweek) AS ds__week + , DATETIME_TRUNC(bookings_source_src_28000.ds, month) AS ds__month + , DATETIME_TRUNC(bookings_source_src_28000.ds, quarter) AS ds__quarter + , DATETIME_TRUNC(bookings_source_src_28000.ds, year) AS ds__year , EXTRACT(year FROM bookings_source_src_28000.ds) AS ds__extract_year , EXTRACT(quarter FROM bookings_source_src_28000.ds) AS ds__extract_quarter , EXTRACT(month FROM bookings_source_src_28000.ds) AS ds__extract_month , EXTRACT(day FROM bookings_source_src_28000.ds) AS ds__extract_day , IF(EXTRACT(dayofweek FROM bookings_source_src_28000.ds) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_28000.ds) - 1) AS ds__extract_dow , EXTRACT(dayofyear FROM bookings_source_src_28000.ds) AS ds__extract_doy - , DATE_TRUNC(bookings_source_src_28000.ds_partitioned, day) AS ds_partitioned__day - , DATE_TRUNC(bookings_source_src_28000.ds_partitioned, isoweek) AS ds_partitioned__week - , DATE_TRUNC(bookings_source_src_28000.ds_partitioned, month) AS ds_partitioned__month - , DATE_TRUNC(bookings_source_src_28000.ds_partitioned, quarter) AS ds_partitioned__quarter - , DATE_TRUNC(bookings_source_src_28000.ds_partitioned, year) AS ds_partitioned__year + , DATETIME_TRUNC(bookings_source_src_28000.ds_partitioned, day) AS ds_partitioned__day + , DATETIME_TRUNC(bookings_source_src_28000.ds_partitioned, isoweek) AS ds_partitioned__week + , DATETIME_TRUNC(bookings_source_src_28000.ds_partitioned, month) AS ds_partitioned__month + , DATETIME_TRUNC(bookings_source_src_28000.ds_partitioned, quarter) AS ds_partitioned__quarter + , DATETIME_TRUNC(bookings_source_src_28000.ds_partitioned, year) AS ds_partitioned__year , EXTRACT(year FROM bookings_source_src_28000.ds_partitioned) AS ds_partitioned__extract_year , EXTRACT(quarter FROM bookings_source_src_28000.ds_partitioned) AS ds_partitioned__extract_quarter , EXTRACT(month FROM bookings_source_src_28000.ds_partitioned) AS ds_partitioned__extract_month , EXTRACT(day FROM bookings_source_src_28000.ds_partitioned) AS ds_partitioned__extract_day , IF(EXTRACT(dayofweek FROM bookings_source_src_28000.ds_partitioned) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_28000.ds_partitioned) - 1) AS ds_partitioned__extract_dow , EXTRACT(dayofyear FROM bookings_source_src_28000.ds_partitioned) AS ds_partitioned__extract_doy - , DATE_TRUNC(bookings_source_src_28000.paid_at, day) AS paid_at__day - , DATE_TRUNC(bookings_source_src_28000.paid_at, isoweek) AS paid_at__week - , DATE_TRUNC(bookings_source_src_28000.paid_at, month) AS paid_at__month - , DATE_TRUNC(bookings_source_src_28000.paid_at, quarter) AS paid_at__quarter - , DATE_TRUNC(bookings_source_src_28000.paid_at, year) AS paid_at__year + , DATETIME_TRUNC(bookings_source_src_28000.paid_at, day) AS paid_at__day + , DATETIME_TRUNC(bookings_source_src_28000.paid_at, isoweek) AS paid_at__week + , DATETIME_TRUNC(bookings_source_src_28000.paid_at, month) AS paid_at__month + , DATETIME_TRUNC(bookings_source_src_28000.paid_at, quarter) AS paid_at__quarter + , DATETIME_TRUNC(bookings_source_src_28000.paid_at, year) AS paid_at__year , EXTRACT(year FROM bookings_source_src_28000.paid_at) AS paid_at__extract_year , EXTRACT(quarter FROM bookings_source_src_28000.paid_at) AS paid_at__extract_quarter , EXTRACT(month FROM bookings_source_src_28000.paid_at) AS paid_at__extract_month @@ -498,33 +498,33 @@ FROM ( , IF(EXTRACT(dayofweek FROM bookings_source_src_28000.paid_at) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_28000.paid_at) - 1) AS paid_at__extract_dow , EXTRACT(dayofyear FROM bookings_source_src_28000.paid_at) AS paid_at__extract_doy , bookings_source_src_28000.is_instant AS booking__is_instant - , DATE_TRUNC(bookings_source_src_28000.ds, day) AS booking__ds__day - , DATE_TRUNC(bookings_source_src_28000.ds, isoweek) AS booking__ds__week - , DATE_TRUNC(bookings_source_src_28000.ds, month) AS booking__ds__month - , DATE_TRUNC(bookings_source_src_28000.ds, quarter) AS booking__ds__quarter - , DATE_TRUNC(bookings_source_src_28000.ds, year) AS booking__ds__year + , DATETIME_TRUNC(bookings_source_src_28000.ds, day) AS booking__ds__day + , DATETIME_TRUNC(bookings_source_src_28000.ds, isoweek) AS booking__ds__week + , DATETIME_TRUNC(bookings_source_src_28000.ds, month) AS booking__ds__month + , DATETIME_TRUNC(bookings_source_src_28000.ds, quarter) AS booking__ds__quarter + , DATETIME_TRUNC(bookings_source_src_28000.ds, year) AS booking__ds__year , EXTRACT(year FROM bookings_source_src_28000.ds) AS booking__ds__extract_year , EXTRACT(quarter FROM bookings_source_src_28000.ds) AS booking__ds__extract_quarter , EXTRACT(month FROM bookings_source_src_28000.ds) AS booking__ds__extract_month , EXTRACT(day FROM bookings_source_src_28000.ds) AS booking__ds__extract_day , IF(EXTRACT(dayofweek FROM bookings_source_src_28000.ds) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_28000.ds) - 1) AS booking__ds__extract_dow , EXTRACT(dayofyear FROM bookings_source_src_28000.ds) AS booking__ds__extract_doy - , DATE_TRUNC(bookings_source_src_28000.ds_partitioned, day) AS booking__ds_partitioned__day - , DATE_TRUNC(bookings_source_src_28000.ds_partitioned, isoweek) AS booking__ds_partitioned__week - , DATE_TRUNC(bookings_source_src_28000.ds_partitioned, month) AS booking__ds_partitioned__month - , DATE_TRUNC(bookings_source_src_28000.ds_partitioned, quarter) AS booking__ds_partitioned__quarter - , DATE_TRUNC(bookings_source_src_28000.ds_partitioned, year) AS booking__ds_partitioned__year + , DATETIME_TRUNC(bookings_source_src_28000.ds_partitioned, day) AS booking__ds_partitioned__day + , DATETIME_TRUNC(bookings_source_src_28000.ds_partitioned, isoweek) AS booking__ds_partitioned__week + , DATETIME_TRUNC(bookings_source_src_28000.ds_partitioned, month) AS booking__ds_partitioned__month + , DATETIME_TRUNC(bookings_source_src_28000.ds_partitioned, quarter) AS booking__ds_partitioned__quarter + , DATETIME_TRUNC(bookings_source_src_28000.ds_partitioned, year) AS booking__ds_partitioned__year , EXTRACT(year FROM bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__extract_year , EXTRACT(quarter FROM bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__extract_quarter , EXTRACT(month FROM bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__extract_month , EXTRACT(day FROM bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__extract_day , IF(EXTRACT(dayofweek FROM bookings_source_src_28000.ds_partitioned) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_28000.ds_partitioned) - 1) AS booking__ds_partitioned__extract_dow , EXTRACT(dayofyear FROM bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__extract_doy - , DATE_TRUNC(bookings_source_src_28000.paid_at, day) AS booking__paid_at__day - , DATE_TRUNC(bookings_source_src_28000.paid_at, isoweek) AS booking__paid_at__week - , DATE_TRUNC(bookings_source_src_28000.paid_at, month) AS booking__paid_at__month - , DATE_TRUNC(bookings_source_src_28000.paid_at, quarter) AS booking__paid_at__quarter - , DATE_TRUNC(bookings_source_src_28000.paid_at, year) AS booking__paid_at__year + , DATETIME_TRUNC(bookings_source_src_28000.paid_at, day) AS booking__paid_at__day + , DATETIME_TRUNC(bookings_source_src_28000.paid_at, isoweek) AS booking__paid_at__week + , DATETIME_TRUNC(bookings_source_src_28000.paid_at, month) AS booking__paid_at__month + , DATETIME_TRUNC(bookings_source_src_28000.paid_at, quarter) AS booking__paid_at__quarter + , DATETIME_TRUNC(bookings_source_src_28000.paid_at, year) AS booking__paid_at__year , EXTRACT(year FROM bookings_source_src_28000.paid_at) AS booking__paid_at__extract_year , EXTRACT(quarter FROM bookings_source_src_28000.paid_at) AS booking__paid_at__extract_quarter , EXTRACT(month FROM bookings_source_src_28000.paid_at) AS booking__paid_at__extract_month diff --git a/tests_metricflow/snapshots/test_granularity_date_part_rendering.py/SqlQueryPlan/BigQuery/test_offset_window_with_date_part__plan0_optimized.sql b/tests_metricflow/snapshots/test_granularity_date_part_rendering.py/SqlQueryPlan/BigQuery/test_offset_window_with_date_part__plan0_optimized.sql index ad65e7abbd..109240c757 100644 --- a/tests_metricflow/snapshots/test_granularity_date_part_rendering.py/SqlQueryPlan/BigQuery/test_offset_window_with_date_part__plan0_optimized.sql +++ b/tests_metricflow/snapshots/test_granularity_date_part_rendering.py/SqlQueryPlan/BigQuery/test_offset_window_with_date_part__plan0_optimized.sql @@ -39,7 +39,7 @@ FROM ( -- Read Elements From Semantic Model 'bookings_source' -- Metric Time Dimension 'ds' SELECT - DATE_TRUNC(ds, day) AS metric_time__day + DATETIME_TRUNC(ds, day) AS metric_time__day , 1 AS bookings FROM ***************************.fct_bookings bookings_source_src_28000 ) subq_20 diff --git a/tests_metricflow/snapshots/test_granularity_date_part_rendering.py/SqlQueryPlan/BigQuery/test_simple_query_with_date_part__plan0.sql b/tests_metricflow/snapshots/test_granularity_date_part_rendering.py/SqlQueryPlan/BigQuery/test_simple_query_with_date_part__plan0.sql index 83036a567a..f5e982e99a 100644 --- a/tests_metricflow/snapshots/test_granularity_date_part_rendering.py/SqlQueryPlan/BigQuery/test_simple_query_with_date_part__plan0.sql +++ b/tests_metricflow/snapshots/test_granularity_date_part_rendering.py/SqlQueryPlan/BigQuery/test_simple_query_with_date_part__plan0.sql @@ -131,33 +131,33 @@ FROM ( , bookings_source_src_28000.booking_value AS approximate_continuous_booking_value_p99 , bookings_source_src_28000.booking_value AS approximate_discrete_booking_value_p99 , bookings_source_src_28000.is_instant - , DATE_TRUNC(bookings_source_src_28000.ds, day) AS ds__day - , DATE_TRUNC(bookings_source_src_28000.ds, isoweek) AS ds__week - , DATE_TRUNC(bookings_source_src_28000.ds, month) AS ds__month - , DATE_TRUNC(bookings_source_src_28000.ds, quarter) AS ds__quarter - , DATE_TRUNC(bookings_source_src_28000.ds, year) AS ds__year + , DATETIME_TRUNC(bookings_source_src_28000.ds, day) AS ds__day + , DATETIME_TRUNC(bookings_source_src_28000.ds, isoweek) AS ds__week + , DATETIME_TRUNC(bookings_source_src_28000.ds, month) AS ds__month + , DATETIME_TRUNC(bookings_source_src_28000.ds, quarter) AS ds__quarter + , DATETIME_TRUNC(bookings_source_src_28000.ds, year) AS ds__year , EXTRACT(year FROM bookings_source_src_28000.ds) AS ds__extract_year , EXTRACT(quarter FROM bookings_source_src_28000.ds) AS ds__extract_quarter , EXTRACT(month FROM bookings_source_src_28000.ds) AS ds__extract_month , EXTRACT(day FROM bookings_source_src_28000.ds) AS ds__extract_day , IF(EXTRACT(dayofweek FROM bookings_source_src_28000.ds) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_28000.ds) - 1) AS ds__extract_dow , EXTRACT(dayofyear FROM bookings_source_src_28000.ds) AS ds__extract_doy - , DATE_TRUNC(bookings_source_src_28000.ds_partitioned, day) AS ds_partitioned__day - , DATE_TRUNC(bookings_source_src_28000.ds_partitioned, isoweek) AS ds_partitioned__week - , DATE_TRUNC(bookings_source_src_28000.ds_partitioned, month) AS ds_partitioned__month - , DATE_TRUNC(bookings_source_src_28000.ds_partitioned, quarter) AS ds_partitioned__quarter - , DATE_TRUNC(bookings_source_src_28000.ds_partitioned, year) AS ds_partitioned__year + , DATETIME_TRUNC(bookings_source_src_28000.ds_partitioned, day) AS ds_partitioned__day + , DATETIME_TRUNC(bookings_source_src_28000.ds_partitioned, isoweek) AS ds_partitioned__week + , DATETIME_TRUNC(bookings_source_src_28000.ds_partitioned, month) AS ds_partitioned__month + , DATETIME_TRUNC(bookings_source_src_28000.ds_partitioned, quarter) AS ds_partitioned__quarter + , DATETIME_TRUNC(bookings_source_src_28000.ds_partitioned, year) AS ds_partitioned__year , EXTRACT(year FROM bookings_source_src_28000.ds_partitioned) AS ds_partitioned__extract_year , EXTRACT(quarter FROM bookings_source_src_28000.ds_partitioned) AS ds_partitioned__extract_quarter , EXTRACT(month FROM bookings_source_src_28000.ds_partitioned) AS ds_partitioned__extract_month , EXTRACT(day FROM bookings_source_src_28000.ds_partitioned) AS ds_partitioned__extract_day , IF(EXTRACT(dayofweek FROM bookings_source_src_28000.ds_partitioned) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_28000.ds_partitioned) - 1) AS ds_partitioned__extract_dow , EXTRACT(dayofyear FROM bookings_source_src_28000.ds_partitioned) AS ds_partitioned__extract_doy - , DATE_TRUNC(bookings_source_src_28000.paid_at, day) AS paid_at__day - , DATE_TRUNC(bookings_source_src_28000.paid_at, isoweek) AS paid_at__week - , DATE_TRUNC(bookings_source_src_28000.paid_at, month) AS paid_at__month - , DATE_TRUNC(bookings_source_src_28000.paid_at, quarter) AS paid_at__quarter - , DATE_TRUNC(bookings_source_src_28000.paid_at, year) AS paid_at__year + , DATETIME_TRUNC(bookings_source_src_28000.paid_at, day) AS paid_at__day + , DATETIME_TRUNC(bookings_source_src_28000.paid_at, isoweek) AS paid_at__week + , DATETIME_TRUNC(bookings_source_src_28000.paid_at, month) AS paid_at__month + , DATETIME_TRUNC(bookings_source_src_28000.paid_at, quarter) AS paid_at__quarter + , DATETIME_TRUNC(bookings_source_src_28000.paid_at, year) AS paid_at__year , EXTRACT(year FROM bookings_source_src_28000.paid_at) AS paid_at__extract_year , EXTRACT(quarter FROM bookings_source_src_28000.paid_at) AS paid_at__extract_quarter , EXTRACT(month FROM bookings_source_src_28000.paid_at) AS paid_at__extract_month @@ -165,33 +165,33 @@ FROM ( , IF(EXTRACT(dayofweek FROM bookings_source_src_28000.paid_at) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_28000.paid_at) - 1) AS paid_at__extract_dow , EXTRACT(dayofyear FROM bookings_source_src_28000.paid_at) AS paid_at__extract_doy , bookings_source_src_28000.is_instant AS booking__is_instant - , DATE_TRUNC(bookings_source_src_28000.ds, day) AS booking__ds__day - , DATE_TRUNC(bookings_source_src_28000.ds, isoweek) AS booking__ds__week - , DATE_TRUNC(bookings_source_src_28000.ds, month) AS booking__ds__month - , DATE_TRUNC(bookings_source_src_28000.ds, quarter) AS booking__ds__quarter - , DATE_TRUNC(bookings_source_src_28000.ds, year) AS booking__ds__year + , DATETIME_TRUNC(bookings_source_src_28000.ds, day) AS booking__ds__day + , DATETIME_TRUNC(bookings_source_src_28000.ds, isoweek) AS booking__ds__week + , DATETIME_TRUNC(bookings_source_src_28000.ds, month) AS booking__ds__month + , DATETIME_TRUNC(bookings_source_src_28000.ds, quarter) AS booking__ds__quarter + , DATETIME_TRUNC(bookings_source_src_28000.ds, year) AS booking__ds__year , EXTRACT(year FROM bookings_source_src_28000.ds) AS booking__ds__extract_year , EXTRACT(quarter FROM bookings_source_src_28000.ds) AS booking__ds__extract_quarter , EXTRACT(month FROM bookings_source_src_28000.ds) AS booking__ds__extract_month , EXTRACT(day FROM bookings_source_src_28000.ds) AS booking__ds__extract_day , IF(EXTRACT(dayofweek FROM bookings_source_src_28000.ds) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_28000.ds) - 1) AS booking__ds__extract_dow , EXTRACT(dayofyear FROM bookings_source_src_28000.ds) AS booking__ds__extract_doy - , DATE_TRUNC(bookings_source_src_28000.ds_partitioned, day) AS booking__ds_partitioned__day - , DATE_TRUNC(bookings_source_src_28000.ds_partitioned, isoweek) AS booking__ds_partitioned__week - , DATE_TRUNC(bookings_source_src_28000.ds_partitioned, month) AS booking__ds_partitioned__month - , DATE_TRUNC(bookings_source_src_28000.ds_partitioned, quarter) AS booking__ds_partitioned__quarter - , DATE_TRUNC(bookings_source_src_28000.ds_partitioned, year) AS booking__ds_partitioned__year + , DATETIME_TRUNC(bookings_source_src_28000.ds_partitioned, day) AS booking__ds_partitioned__day + , DATETIME_TRUNC(bookings_source_src_28000.ds_partitioned, isoweek) AS booking__ds_partitioned__week + , DATETIME_TRUNC(bookings_source_src_28000.ds_partitioned, month) AS booking__ds_partitioned__month + , DATETIME_TRUNC(bookings_source_src_28000.ds_partitioned, quarter) AS booking__ds_partitioned__quarter + , DATETIME_TRUNC(bookings_source_src_28000.ds_partitioned, year) AS booking__ds_partitioned__year , EXTRACT(year FROM bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__extract_year , EXTRACT(quarter FROM bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__extract_quarter , EXTRACT(month FROM bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__extract_month , EXTRACT(day FROM bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__extract_day , IF(EXTRACT(dayofweek FROM bookings_source_src_28000.ds_partitioned) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_28000.ds_partitioned) - 1) AS booking__ds_partitioned__extract_dow , EXTRACT(dayofyear FROM bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__extract_doy - , DATE_TRUNC(bookings_source_src_28000.paid_at, day) AS booking__paid_at__day - , DATE_TRUNC(bookings_source_src_28000.paid_at, isoweek) AS booking__paid_at__week - , DATE_TRUNC(bookings_source_src_28000.paid_at, month) AS booking__paid_at__month - , DATE_TRUNC(bookings_source_src_28000.paid_at, quarter) AS booking__paid_at__quarter - , DATE_TRUNC(bookings_source_src_28000.paid_at, year) AS booking__paid_at__year + , DATETIME_TRUNC(bookings_source_src_28000.paid_at, day) AS booking__paid_at__day + , DATETIME_TRUNC(bookings_source_src_28000.paid_at, isoweek) AS booking__paid_at__week + , DATETIME_TRUNC(bookings_source_src_28000.paid_at, month) AS booking__paid_at__month + , DATETIME_TRUNC(bookings_source_src_28000.paid_at, quarter) AS booking__paid_at__quarter + , DATETIME_TRUNC(bookings_source_src_28000.paid_at, year) AS booking__paid_at__year , EXTRACT(year FROM bookings_source_src_28000.paid_at) AS booking__paid_at__extract_year , EXTRACT(quarter FROM bookings_source_src_28000.paid_at) AS booking__paid_at__extract_quarter , EXTRACT(month FROM bookings_source_src_28000.paid_at) AS booking__paid_at__extract_month diff --git a/tests_metricflow/snapshots/test_granularity_date_part_rendering.py/SqlQueryPlan/BigQuery/test_simple_query_with_multiple_date_parts__plan0.sql b/tests_metricflow/snapshots/test_granularity_date_part_rendering.py/SqlQueryPlan/BigQuery/test_simple_query_with_multiple_date_parts__plan0.sql index f6febed711..55ae076884 100644 --- a/tests_metricflow/snapshots/test_granularity_date_part_rendering.py/SqlQueryPlan/BigQuery/test_simple_query_with_multiple_date_parts__plan0.sql +++ b/tests_metricflow/snapshots/test_granularity_date_part_rendering.py/SqlQueryPlan/BigQuery/test_simple_query_with_multiple_date_parts__plan0.sql @@ -154,33 +154,33 @@ FROM ( , bookings_source_src_28000.booking_value AS approximate_continuous_booking_value_p99 , bookings_source_src_28000.booking_value AS approximate_discrete_booking_value_p99 , bookings_source_src_28000.is_instant - , DATE_TRUNC(bookings_source_src_28000.ds, day) AS ds__day - , DATE_TRUNC(bookings_source_src_28000.ds, isoweek) AS ds__week - , DATE_TRUNC(bookings_source_src_28000.ds, month) AS ds__month - , DATE_TRUNC(bookings_source_src_28000.ds, quarter) AS ds__quarter - , DATE_TRUNC(bookings_source_src_28000.ds, year) AS ds__year + , DATETIME_TRUNC(bookings_source_src_28000.ds, day) AS ds__day + , DATETIME_TRUNC(bookings_source_src_28000.ds, isoweek) AS ds__week + , DATETIME_TRUNC(bookings_source_src_28000.ds, month) AS ds__month + , DATETIME_TRUNC(bookings_source_src_28000.ds, quarter) AS ds__quarter + , DATETIME_TRUNC(bookings_source_src_28000.ds, year) AS ds__year , EXTRACT(year FROM bookings_source_src_28000.ds) AS ds__extract_year , EXTRACT(quarter FROM bookings_source_src_28000.ds) AS ds__extract_quarter , EXTRACT(month FROM bookings_source_src_28000.ds) AS ds__extract_month , EXTRACT(day FROM bookings_source_src_28000.ds) AS ds__extract_day , IF(EXTRACT(dayofweek FROM bookings_source_src_28000.ds) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_28000.ds) - 1) AS ds__extract_dow , EXTRACT(dayofyear FROM bookings_source_src_28000.ds) AS ds__extract_doy - , DATE_TRUNC(bookings_source_src_28000.ds_partitioned, day) AS ds_partitioned__day - , DATE_TRUNC(bookings_source_src_28000.ds_partitioned, isoweek) AS ds_partitioned__week - , DATE_TRUNC(bookings_source_src_28000.ds_partitioned, month) AS ds_partitioned__month - , DATE_TRUNC(bookings_source_src_28000.ds_partitioned, quarter) AS ds_partitioned__quarter - , DATE_TRUNC(bookings_source_src_28000.ds_partitioned, year) AS ds_partitioned__year + , DATETIME_TRUNC(bookings_source_src_28000.ds_partitioned, day) AS ds_partitioned__day + , DATETIME_TRUNC(bookings_source_src_28000.ds_partitioned, isoweek) AS ds_partitioned__week + , DATETIME_TRUNC(bookings_source_src_28000.ds_partitioned, month) AS ds_partitioned__month + , DATETIME_TRUNC(bookings_source_src_28000.ds_partitioned, quarter) AS ds_partitioned__quarter + , DATETIME_TRUNC(bookings_source_src_28000.ds_partitioned, year) AS ds_partitioned__year , EXTRACT(year FROM bookings_source_src_28000.ds_partitioned) AS ds_partitioned__extract_year , EXTRACT(quarter FROM bookings_source_src_28000.ds_partitioned) AS ds_partitioned__extract_quarter , EXTRACT(month FROM bookings_source_src_28000.ds_partitioned) AS ds_partitioned__extract_month , EXTRACT(day FROM bookings_source_src_28000.ds_partitioned) AS ds_partitioned__extract_day , IF(EXTRACT(dayofweek FROM bookings_source_src_28000.ds_partitioned) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_28000.ds_partitioned) - 1) AS ds_partitioned__extract_dow , EXTRACT(dayofyear FROM bookings_source_src_28000.ds_partitioned) AS ds_partitioned__extract_doy - , DATE_TRUNC(bookings_source_src_28000.paid_at, day) AS paid_at__day - , DATE_TRUNC(bookings_source_src_28000.paid_at, isoweek) AS paid_at__week - , DATE_TRUNC(bookings_source_src_28000.paid_at, month) AS paid_at__month - , DATE_TRUNC(bookings_source_src_28000.paid_at, quarter) AS paid_at__quarter - , DATE_TRUNC(bookings_source_src_28000.paid_at, year) AS paid_at__year + , DATETIME_TRUNC(bookings_source_src_28000.paid_at, day) AS paid_at__day + , DATETIME_TRUNC(bookings_source_src_28000.paid_at, isoweek) AS paid_at__week + , DATETIME_TRUNC(bookings_source_src_28000.paid_at, month) AS paid_at__month + , DATETIME_TRUNC(bookings_source_src_28000.paid_at, quarter) AS paid_at__quarter + , DATETIME_TRUNC(bookings_source_src_28000.paid_at, year) AS paid_at__year , EXTRACT(year FROM bookings_source_src_28000.paid_at) AS paid_at__extract_year , EXTRACT(quarter FROM bookings_source_src_28000.paid_at) AS paid_at__extract_quarter , EXTRACT(month FROM bookings_source_src_28000.paid_at) AS paid_at__extract_month @@ -188,33 +188,33 @@ FROM ( , IF(EXTRACT(dayofweek FROM bookings_source_src_28000.paid_at) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_28000.paid_at) - 1) AS paid_at__extract_dow , EXTRACT(dayofyear FROM bookings_source_src_28000.paid_at) AS paid_at__extract_doy , bookings_source_src_28000.is_instant AS booking__is_instant - , DATE_TRUNC(bookings_source_src_28000.ds, day) AS booking__ds__day - , DATE_TRUNC(bookings_source_src_28000.ds, isoweek) AS booking__ds__week - , DATE_TRUNC(bookings_source_src_28000.ds, month) AS booking__ds__month - , DATE_TRUNC(bookings_source_src_28000.ds, quarter) AS booking__ds__quarter - , DATE_TRUNC(bookings_source_src_28000.ds, year) AS booking__ds__year + , DATETIME_TRUNC(bookings_source_src_28000.ds, day) AS booking__ds__day + , DATETIME_TRUNC(bookings_source_src_28000.ds, isoweek) AS booking__ds__week + , DATETIME_TRUNC(bookings_source_src_28000.ds, month) AS booking__ds__month + , DATETIME_TRUNC(bookings_source_src_28000.ds, quarter) AS booking__ds__quarter + , DATETIME_TRUNC(bookings_source_src_28000.ds, year) AS booking__ds__year , EXTRACT(year FROM bookings_source_src_28000.ds) AS booking__ds__extract_year , EXTRACT(quarter FROM bookings_source_src_28000.ds) AS booking__ds__extract_quarter , EXTRACT(month FROM bookings_source_src_28000.ds) AS booking__ds__extract_month , EXTRACT(day FROM bookings_source_src_28000.ds) AS booking__ds__extract_day , IF(EXTRACT(dayofweek FROM bookings_source_src_28000.ds) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_28000.ds) - 1) AS booking__ds__extract_dow , EXTRACT(dayofyear FROM bookings_source_src_28000.ds) AS booking__ds__extract_doy - , DATE_TRUNC(bookings_source_src_28000.ds_partitioned, day) AS booking__ds_partitioned__day - , DATE_TRUNC(bookings_source_src_28000.ds_partitioned, isoweek) AS booking__ds_partitioned__week - , DATE_TRUNC(bookings_source_src_28000.ds_partitioned, month) AS booking__ds_partitioned__month - , DATE_TRUNC(bookings_source_src_28000.ds_partitioned, quarter) AS booking__ds_partitioned__quarter - , DATE_TRUNC(bookings_source_src_28000.ds_partitioned, year) AS booking__ds_partitioned__year + , DATETIME_TRUNC(bookings_source_src_28000.ds_partitioned, day) AS booking__ds_partitioned__day + , DATETIME_TRUNC(bookings_source_src_28000.ds_partitioned, isoweek) AS booking__ds_partitioned__week + , DATETIME_TRUNC(bookings_source_src_28000.ds_partitioned, month) AS booking__ds_partitioned__month + , DATETIME_TRUNC(bookings_source_src_28000.ds_partitioned, quarter) AS booking__ds_partitioned__quarter + , DATETIME_TRUNC(bookings_source_src_28000.ds_partitioned, year) AS booking__ds_partitioned__year , EXTRACT(year FROM bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__extract_year , EXTRACT(quarter FROM bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__extract_quarter , EXTRACT(month FROM bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__extract_month , EXTRACT(day FROM bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__extract_day , IF(EXTRACT(dayofweek FROM bookings_source_src_28000.ds_partitioned) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_28000.ds_partitioned) - 1) AS booking__ds_partitioned__extract_dow , EXTRACT(dayofyear FROM bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__extract_doy - , DATE_TRUNC(bookings_source_src_28000.paid_at, day) AS booking__paid_at__day - , DATE_TRUNC(bookings_source_src_28000.paid_at, isoweek) AS booking__paid_at__week - , DATE_TRUNC(bookings_source_src_28000.paid_at, month) AS booking__paid_at__month - , DATE_TRUNC(bookings_source_src_28000.paid_at, quarter) AS booking__paid_at__quarter - , DATE_TRUNC(bookings_source_src_28000.paid_at, year) AS booking__paid_at__year + , DATETIME_TRUNC(bookings_source_src_28000.paid_at, day) AS booking__paid_at__day + , DATETIME_TRUNC(bookings_source_src_28000.paid_at, isoweek) AS booking__paid_at__week + , DATETIME_TRUNC(bookings_source_src_28000.paid_at, month) AS booking__paid_at__month + , DATETIME_TRUNC(bookings_source_src_28000.paid_at, quarter) AS booking__paid_at__quarter + , DATETIME_TRUNC(bookings_source_src_28000.paid_at, year) AS booking__paid_at__year , EXTRACT(year FROM bookings_source_src_28000.paid_at) AS booking__paid_at__extract_year , EXTRACT(quarter FROM bookings_source_src_28000.paid_at) AS booking__paid_at__extract_quarter , EXTRACT(month FROM bookings_source_src_28000.paid_at) AS booking__paid_at__extract_month diff --git a/tests_metricflow/snapshots/test_metric_filter_rendering.py/SqlQueryPlan/BigQuery/test_distinct_values_query_with_metric_filter__plan0.sql b/tests_metricflow/snapshots/test_metric_filter_rendering.py/SqlQueryPlan/BigQuery/test_distinct_values_query_with_metric_filter__plan0.sql index e67da26c3a..8a99c7037a 100644 --- a/tests_metricflow/snapshots/test_metric_filter_rendering.py/SqlQueryPlan/BigQuery/test_distinct_values_query_with_metric_filter__plan0.sql +++ b/tests_metricflow/snapshots/test_metric_filter_rendering.py/SqlQueryPlan/BigQuery/test_distinct_values_query_with_metric_filter__plan0.sql @@ -162,33 +162,33 @@ FROM ( , bookings_source_src_28000.booking_value AS approximate_continuous_booking_value_p99 , bookings_source_src_28000.booking_value AS approximate_discrete_booking_value_p99 , bookings_source_src_28000.is_instant - , DATE_TRUNC(bookings_source_src_28000.ds, day) AS ds__day - , DATE_TRUNC(bookings_source_src_28000.ds, isoweek) AS ds__week - , DATE_TRUNC(bookings_source_src_28000.ds, month) AS ds__month - , DATE_TRUNC(bookings_source_src_28000.ds, quarter) AS ds__quarter - , DATE_TRUNC(bookings_source_src_28000.ds, year) AS ds__year + , DATETIME_TRUNC(bookings_source_src_28000.ds, day) AS ds__day + , DATETIME_TRUNC(bookings_source_src_28000.ds, isoweek) AS ds__week + , DATETIME_TRUNC(bookings_source_src_28000.ds, month) AS ds__month + , DATETIME_TRUNC(bookings_source_src_28000.ds, quarter) AS ds__quarter + , DATETIME_TRUNC(bookings_source_src_28000.ds, year) AS ds__year , EXTRACT(year FROM bookings_source_src_28000.ds) AS ds__extract_year , EXTRACT(quarter FROM bookings_source_src_28000.ds) AS ds__extract_quarter , EXTRACT(month FROM bookings_source_src_28000.ds) AS ds__extract_month , EXTRACT(day FROM bookings_source_src_28000.ds) AS ds__extract_day , IF(EXTRACT(dayofweek FROM bookings_source_src_28000.ds) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_28000.ds) - 1) AS ds__extract_dow , EXTRACT(dayofyear FROM bookings_source_src_28000.ds) AS ds__extract_doy - , DATE_TRUNC(bookings_source_src_28000.ds_partitioned, day) AS ds_partitioned__day - , DATE_TRUNC(bookings_source_src_28000.ds_partitioned, isoweek) AS ds_partitioned__week - , DATE_TRUNC(bookings_source_src_28000.ds_partitioned, month) AS ds_partitioned__month - , DATE_TRUNC(bookings_source_src_28000.ds_partitioned, quarter) AS ds_partitioned__quarter - , DATE_TRUNC(bookings_source_src_28000.ds_partitioned, year) AS ds_partitioned__year + , DATETIME_TRUNC(bookings_source_src_28000.ds_partitioned, day) AS ds_partitioned__day + , DATETIME_TRUNC(bookings_source_src_28000.ds_partitioned, isoweek) AS ds_partitioned__week + , DATETIME_TRUNC(bookings_source_src_28000.ds_partitioned, month) AS ds_partitioned__month + , DATETIME_TRUNC(bookings_source_src_28000.ds_partitioned, quarter) AS ds_partitioned__quarter + , DATETIME_TRUNC(bookings_source_src_28000.ds_partitioned, year) AS ds_partitioned__year , EXTRACT(year FROM bookings_source_src_28000.ds_partitioned) AS ds_partitioned__extract_year , EXTRACT(quarter FROM bookings_source_src_28000.ds_partitioned) AS ds_partitioned__extract_quarter , EXTRACT(month FROM bookings_source_src_28000.ds_partitioned) AS ds_partitioned__extract_month , EXTRACT(day FROM bookings_source_src_28000.ds_partitioned) AS ds_partitioned__extract_day , IF(EXTRACT(dayofweek FROM bookings_source_src_28000.ds_partitioned) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_28000.ds_partitioned) - 1) AS ds_partitioned__extract_dow , EXTRACT(dayofyear FROM bookings_source_src_28000.ds_partitioned) AS ds_partitioned__extract_doy - , DATE_TRUNC(bookings_source_src_28000.paid_at, day) AS paid_at__day - , DATE_TRUNC(bookings_source_src_28000.paid_at, isoweek) AS paid_at__week - , DATE_TRUNC(bookings_source_src_28000.paid_at, month) AS paid_at__month - , DATE_TRUNC(bookings_source_src_28000.paid_at, quarter) AS paid_at__quarter - , DATE_TRUNC(bookings_source_src_28000.paid_at, year) AS paid_at__year + , DATETIME_TRUNC(bookings_source_src_28000.paid_at, day) AS paid_at__day + , DATETIME_TRUNC(bookings_source_src_28000.paid_at, isoweek) AS paid_at__week + , DATETIME_TRUNC(bookings_source_src_28000.paid_at, month) AS paid_at__month + , DATETIME_TRUNC(bookings_source_src_28000.paid_at, quarter) AS paid_at__quarter + , DATETIME_TRUNC(bookings_source_src_28000.paid_at, year) AS paid_at__year , EXTRACT(year FROM bookings_source_src_28000.paid_at) AS paid_at__extract_year , EXTRACT(quarter FROM bookings_source_src_28000.paid_at) AS paid_at__extract_quarter , EXTRACT(month FROM bookings_source_src_28000.paid_at) AS paid_at__extract_month @@ -196,33 +196,33 @@ FROM ( , IF(EXTRACT(dayofweek FROM bookings_source_src_28000.paid_at) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_28000.paid_at) - 1) AS paid_at__extract_dow , EXTRACT(dayofyear FROM bookings_source_src_28000.paid_at) AS paid_at__extract_doy , bookings_source_src_28000.is_instant AS booking__is_instant - , DATE_TRUNC(bookings_source_src_28000.ds, day) AS booking__ds__day - , DATE_TRUNC(bookings_source_src_28000.ds, isoweek) AS booking__ds__week - , DATE_TRUNC(bookings_source_src_28000.ds, month) AS booking__ds__month - , DATE_TRUNC(bookings_source_src_28000.ds, quarter) AS booking__ds__quarter - , DATE_TRUNC(bookings_source_src_28000.ds, year) AS booking__ds__year + , DATETIME_TRUNC(bookings_source_src_28000.ds, day) AS booking__ds__day + , DATETIME_TRUNC(bookings_source_src_28000.ds, isoweek) AS booking__ds__week + , DATETIME_TRUNC(bookings_source_src_28000.ds, month) AS booking__ds__month + , DATETIME_TRUNC(bookings_source_src_28000.ds, quarter) AS booking__ds__quarter + , DATETIME_TRUNC(bookings_source_src_28000.ds, year) AS booking__ds__year , EXTRACT(year FROM bookings_source_src_28000.ds) AS booking__ds__extract_year , EXTRACT(quarter FROM bookings_source_src_28000.ds) AS booking__ds__extract_quarter , EXTRACT(month FROM bookings_source_src_28000.ds) AS booking__ds__extract_month , EXTRACT(day FROM bookings_source_src_28000.ds) AS booking__ds__extract_day , IF(EXTRACT(dayofweek FROM bookings_source_src_28000.ds) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_28000.ds) - 1) AS booking__ds__extract_dow , EXTRACT(dayofyear FROM bookings_source_src_28000.ds) AS booking__ds__extract_doy - , DATE_TRUNC(bookings_source_src_28000.ds_partitioned, day) AS booking__ds_partitioned__day - , DATE_TRUNC(bookings_source_src_28000.ds_partitioned, isoweek) AS booking__ds_partitioned__week - , DATE_TRUNC(bookings_source_src_28000.ds_partitioned, month) AS booking__ds_partitioned__month - , DATE_TRUNC(bookings_source_src_28000.ds_partitioned, quarter) AS booking__ds_partitioned__quarter - , DATE_TRUNC(bookings_source_src_28000.ds_partitioned, year) AS booking__ds_partitioned__year + , DATETIME_TRUNC(bookings_source_src_28000.ds_partitioned, day) AS booking__ds_partitioned__day + , DATETIME_TRUNC(bookings_source_src_28000.ds_partitioned, isoweek) AS booking__ds_partitioned__week + , DATETIME_TRUNC(bookings_source_src_28000.ds_partitioned, month) AS booking__ds_partitioned__month + , DATETIME_TRUNC(bookings_source_src_28000.ds_partitioned, quarter) AS booking__ds_partitioned__quarter + , DATETIME_TRUNC(bookings_source_src_28000.ds_partitioned, year) AS booking__ds_partitioned__year , EXTRACT(year FROM bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__extract_year , EXTRACT(quarter FROM bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__extract_quarter , EXTRACT(month FROM bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__extract_month , EXTRACT(day FROM bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__extract_day , IF(EXTRACT(dayofweek FROM bookings_source_src_28000.ds_partitioned) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_28000.ds_partitioned) - 1) AS booking__ds_partitioned__extract_dow , EXTRACT(dayofyear FROM bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__extract_doy - , DATE_TRUNC(bookings_source_src_28000.paid_at, day) AS booking__paid_at__day - , DATE_TRUNC(bookings_source_src_28000.paid_at, isoweek) AS booking__paid_at__week - , DATE_TRUNC(bookings_source_src_28000.paid_at, month) AS booking__paid_at__month - , DATE_TRUNC(bookings_source_src_28000.paid_at, quarter) AS booking__paid_at__quarter - , DATE_TRUNC(bookings_source_src_28000.paid_at, year) AS booking__paid_at__year + , DATETIME_TRUNC(bookings_source_src_28000.paid_at, day) AS booking__paid_at__day + , DATETIME_TRUNC(bookings_source_src_28000.paid_at, isoweek) AS booking__paid_at__week + , DATETIME_TRUNC(bookings_source_src_28000.paid_at, month) AS booking__paid_at__month + , DATETIME_TRUNC(bookings_source_src_28000.paid_at, quarter) AS booking__paid_at__quarter + , DATETIME_TRUNC(bookings_source_src_28000.paid_at, year) AS booking__paid_at__year , EXTRACT(year FROM bookings_source_src_28000.paid_at) AS booking__paid_at__extract_year , EXTRACT(quarter FROM bookings_source_src_28000.paid_at) AS booking__paid_at__extract_quarter , EXTRACT(month FROM bookings_source_src_28000.paid_at) AS booking__paid_at__extract_month diff --git a/tests_metricflow/snapshots/test_metric_filter_rendering.py/SqlQueryPlan/BigQuery/test_filter_by_metric_in_same_semantic_model_as_queried_metric__plan0.sql b/tests_metricflow/snapshots/test_metric_filter_rendering.py/SqlQueryPlan/BigQuery/test_filter_by_metric_in_same_semantic_model_as_queried_metric__plan0.sql index b72dfb8369..cbaa9d4725 100644 --- a/tests_metricflow/snapshots/test_metric_filter_rendering.py/SqlQueryPlan/BigQuery/test_filter_by_metric_in_same_semantic_model_as_queried_metric__plan0.sql +++ b/tests_metricflow/snapshots/test_metric_filter_rendering.py/SqlQueryPlan/BigQuery/test_filter_by_metric_in_same_semantic_model_as_queried_metric__plan0.sql @@ -149,33 +149,33 @@ FROM ( , bookings_source_src_28000.booking_value AS approximate_continuous_booking_value_p99 , bookings_source_src_28000.booking_value AS approximate_discrete_booking_value_p99 , bookings_source_src_28000.is_instant - , DATE_TRUNC(bookings_source_src_28000.ds, day) AS ds__day - , DATE_TRUNC(bookings_source_src_28000.ds, isoweek) AS ds__week - , DATE_TRUNC(bookings_source_src_28000.ds, month) AS ds__month - , DATE_TRUNC(bookings_source_src_28000.ds, quarter) AS ds__quarter - , DATE_TRUNC(bookings_source_src_28000.ds, year) AS ds__year + , DATETIME_TRUNC(bookings_source_src_28000.ds, day) AS ds__day + , DATETIME_TRUNC(bookings_source_src_28000.ds, isoweek) AS ds__week + , DATETIME_TRUNC(bookings_source_src_28000.ds, month) AS ds__month + , DATETIME_TRUNC(bookings_source_src_28000.ds, quarter) AS ds__quarter + , DATETIME_TRUNC(bookings_source_src_28000.ds, year) AS ds__year , EXTRACT(year FROM bookings_source_src_28000.ds) AS ds__extract_year , EXTRACT(quarter FROM bookings_source_src_28000.ds) AS ds__extract_quarter , EXTRACT(month FROM bookings_source_src_28000.ds) AS ds__extract_month , EXTRACT(day FROM bookings_source_src_28000.ds) AS ds__extract_day , IF(EXTRACT(dayofweek FROM bookings_source_src_28000.ds) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_28000.ds) - 1) AS ds__extract_dow , EXTRACT(dayofyear FROM bookings_source_src_28000.ds) AS ds__extract_doy - , DATE_TRUNC(bookings_source_src_28000.ds_partitioned, day) AS ds_partitioned__day - , DATE_TRUNC(bookings_source_src_28000.ds_partitioned, isoweek) AS ds_partitioned__week - , DATE_TRUNC(bookings_source_src_28000.ds_partitioned, month) AS ds_partitioned__month - , DATE_TRUNC(bookings_source_src_28000.ds_partitioned, quarter) AS ds_partitioned__quarter - , DATE_TRUNC(bookings_source_src_28000.ds_partitioned, year) AS ds_partitioned__year + , DATETIME_TRUNC(bookings_source_src_28000.ds_partitioned, day) AS ds_partitioned__day + , DATETIME_TRUNC(bookings_source_src_28000.ds_partitioned, isoweek) AS ds_partitioned__week + , DATETIME_TRUNC(bookings_source_src_28000.ds_partitioned, month) AS ds_partitioned__month + , DATETIME_TRUNC(bookings_source_src_28000.ds_partitioned, quarter) AS ds_partitioned__quarter + , DATETIME_TRUNC(bookings_source_src_28000.ds_partitioned, year) AS ds_partitioned__year , EXTRACT(year FROM bookings_source_src_28000.ds_partitioned) AS ds_partitioned__extract_year , EXTRACT(quarter FROM bookings_source_src_28000.ds_partitioned) AS ds_partitioned__extract_quarter , EXTRACT(month FROM bookings_source_src_28000.ds_partitioned) AS ds_partitioned__extract_month , EXTRACT(day FROM bookings_source_src_28000.ds_partitioned) AS ds_partitioned__extract_day , IF(EXTRACT(dayofweek FROM bookings_source_src_28000.ds_partitioned) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_28000.ds_partitioned) - 1) AS ds_partitioned__extract_dow , EXTRACT(dayofyear FROM bookings_source_src_28000.ds_partitioned) AS ds_partitioned__extract_doy - , DATE_TRUNC(bookings_source_src_28000.paid_at, day) AS paid_at__day - , DATE_TRUNC(bookings_source_src_28000.paid_at, isoweek) AS paid_at__week - , DATE_TRUNC(bookings_source_src_28000.paid_at, month) AS paid_at__month - , DATE_TRUNC(bookings_source_src_28000.paid_at, quarter) AS paid_at__quarter - , DATE_TRUNC(bookings_source_src_28000.paid_at, year) AS paid_at__year + , DATETIME_TRUNC(bookings_source_src_28000.paid_at, day) AS paid_at__day + , DATETIME_TRUNC(bookings_source_src_28000.paid_at, isoweek) AS paid_at__week + , DATETIME_TRUNC(bookings_source_src_28000.paid_at, month) AS paid_at__month + , DATETIME_TRUNC(bookings_source_src_28000.paid_at, quarter) AS paid_at__quarter + , DATETIME_TRUNC(bookings_source_src_28000.paid_at, year) AS paid_at__year , EXTRACT(year FROM bookings_source_src_28000.paid_at) AS paid_at__extract_year , EXTRACT(quarter FROM bookings_source_src_28000.paid_at) AS paid_at__extract_quarter , EXTRACT(month FROM bookings_source_src_28000.paid_at) AS paid_at__extract_month @@ -183,33 +183,33 @@ FROM ( , IF(EXTRACT(dayofweek FROM bookings_source_src_28000.paid_at) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_28000.paid_at) - 1) AS paid_at__extract_dow , EXTRACT(dayofyear FROM bookings_source_src_28000.paid_at) AS paid_at__extract_doy , bookings_source_src_28000.is_instant AS booking__is_instant - , DATE_TRUNC(bookings_source_src_28000.ds, day) AS booking__ds__day - , DATE_TRUNC(bookings_source_src_28000.ds, isoweek) AS booking__ds__week - , DATE_TRUNC(bookings_source_src_28000.ds, month) AS booking__ds__month - , DATE_TRUNC(bookings_source_src_28000.ds, quarter) AS booking__ds__quarter - , DATE_TRUNC(bookings_source_src_28000.ds, year) AS booking__ds__year + , DATETIME_TRUNC(bookings_source_src_28000.ds, day) AS booking__ds__day + , DATETIME_TRUNC(bookings_source_src_28000.ds, isoweek) AS booking__ds__week + , DATETIME_TRUNC(bookings_source_src_28000.ds, month) AS booking__ds__month + , DATETIME_TRUNC(bookings_source_src_28000.ds, quarter) AS booking__ds__quarter + , DATETIME_TRUNC(bookings_source_src_28000.ds, year) AS booking__ds__year , EXTRACT(year FROM bookings_source_src_28000.ds) AS booking__ds__extract_year , EXTRACT(quarter FROM bookings_source_src_28000.ds) AS booking__ds__extract_quarter , EXTRACT(month FROM bookings_source_src_28000.ds) AS booking__ds__extract_month , EXTRACT(day FROM bookings_source_src_28000.ds) AS booking__ds__extract_day , IF(EXTRACT(dayofweek FROM bookings_source_src_28000.ds) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_28000.ds) - 1) AS booking__ds__extract_dow , EXTRACT(dayofyear FROM bookings_source_src_28000.ds) AS booking__ds__extract_doy - , DATE_TRUNC(bookings_source_src_28000.ds_partitioned, day) AS booking__ds_partitioned__day - , DATE_TRUNC(bookings_source_src_28000.ds_partitioned, isoweek) AS booking__ds_partitioned__week - , DATE_TRUNC(bookings_source_src_28000.ds_partitioned, month) AS booking__ds_partitioned__month - , DATE_TRUNC(bookings_source_src_28000.ds_partitioned, quarter) AS booking__ds_partitioned__quarter - , DATE_TRUNC(bookings_source_src_28000.ds_partitioned, year) AS booking__ds_partitioned__year + , DATETIME_TRUNC(bookings_source_src_28000.ds_partitioned, day) AS booking__ds_partitioned__day + , DATETIME_TRUNC(bookings_source_src_28000.ds_partitioned, isoweek) AS booking__ds_partitioned__week + , DATETIME_TRUNC(bookings_source_src_28000.ds_partitioned, month) AS booking__ds_partitioned__month + , DATETIME_TRUNC(bookings_source_src_28000.ds_partitioned, quarter) AS booking__ds_partitioned__quarter + , DATETIME_TRUNC(bookings_source_src_28000.ds_partitioned, year) AS booking__ds_partitioned__year , EXTRACT(year FROM bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__extract_year , EXTRACT(quarter FROM bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__extract_quarter , EXTRACT(month FROM bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__extract_month , EXTRACT(day FROM bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__extract_day , IF(EXTRACT(dayofweek FROM bookings_source_src_28000.ds_partitioned) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_28000.ds_partitioned) - 1) AS booking__ds_partitioned__extract_dow , EXTRACT(dayofyear FROM bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__extract_doy - , DATE_TRUNC(bookings_source_src_28000.paid_at, day) AS booking__paid_at__day - , DATE_TRUNC(bookings_source_src_28000.paid_at, isoweek) AS booking__paid_at__week - , DATE_TRUNC(bookings_source_src_28000.paid_at, month) AS booking__paid_at__month - , DATE_TRUNC(bookings_source_src_28000.paid_at, quarter) AS booking__paid_at__quarter - , DATE_TRUNC(bookings_source_src_28000.paid_at, year) AS booking__paid_at__year + , DATETIME_TRUNC(bookings_source_src_28000.paid_at, day) AS booking__paid_at__day + , DATETIME_TRUNC(bookings_source_src_28000.paid_at, isoweek) AS booking__paid_at__week + , DATETIME_TRUNC(bookings_source_src_28000.paid_at, month) AS booking__paid_at__month + , DATETIME_TRUNC(bookings_source_src_28000.paid_at, quarter) AS booking__paid_at__quarter + , DATETIME_TRUNC(bookings_source_src_28000.paid_at, year) AS booking__paid_at__year , EXTRACT(year FROM bookings_source_src_28000.paid_at) AS booking__paid_at__extract_year , EXTRACT(quarter FROM bookings_source_src_28000.paid_at) AS booking__paid_at__extract_quarter , EXTRACT(month FROM bookings_source_src_28000.paid_at) AS booking__paid_at__extract_month @@ -365,33 +365,33 @@ FROM ( , bookings_source_src_28000.booking_value AS approximate_continuous_booking_value_p99 , bookings_source_src_28000.booking_value AS approximate_discrete_booking_value_p99 , bookings_source_src_28000.is_instant - , DATE_TRUNC(bookings_source_src_28000.ds, day) AS ds__day - , DATE_TRUNC(bookings_source_src_28000.ds, isoweek) AS ds__week - , DATE_TRUNC(bookings_source_src_28000.ds, month) AS ds__month - , DATE_TRUNC(bookings_source_src_28000.ds, quarter) AS ds__quarter - , DATE_TRUNC(bookings_source_src_28000.ds, year) AS ds__year + , DATETIME_TRUNC(bookings_source_src_28000.ds, day) AS ds__day + , DATETIME_TRUNC(bookings_source_src_28000.ds, isoweek) AS ds__week + , DATETIME_TRUNC(bookings_source_src_28000.ds, month) AS ds__month + , DATETIME_TRUNC(bookings_source_src_28000.ds, quarter) AS ds__quarter + , DATETIME_TRUNC(bookings_source_src_28000.ds, year) AS ds__year , EXTRACT(year FROM bookings_source_src_28000.ds) AS ds__extract_year , EXTRACT(quarter FROM bookings_source_src_28000.ds) AS ds__extract_quarter , EXTRACT(month FROM bookings_source_src_28000.ds) AS ds__extract_month , EXTRACT(day FROM bookings_source_src_28000.ds) AS ds__extract_day , IF(EXTRACT(dayofweek FROM bookings_source_src_28000.ds) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_28000.ds) - 1) AS ds__extract_dow , EXTRACT(dayofyear FROM bookings_source_src_28000.ds) AS ds__extract_doy - , DATE_TRUNC(bookings_source_src_28000.ds_partitioned, day) AS ds_partitioned__day - , DATE_TRUNC(bookings_source_src_28000.ds_partitioned, isoweek) AS ds_partitioned__week - , DATE_TRUNC(bookings_source_src_28000.ds_partitioned, month) AS ds_partitioned__month - , DATE_TRUNC(bookings_source_src_28000.ds_partitioned, quarter) AS ds_partitioned__quarter - , DATE_TRUNC(bookings_source_src_28000.ds_partitioned, year) AS ds_partitioned__year + , DATETIME_TRUNC(bookings_source_src_28000.ds_partitioned, day) AS ds_partitioned__day + , DATETIME_TRUNC(bookings_source_src_28000.ds_partitioned, isoweek) AS ds_partitioned__week + , DATETIME_TRUNC(bookings_source_src_28000.ds_partitioned, month) AS ds_partitioned__month + , DATETIME_TRUNC(bookings_source_src_28000.ds_partitioned, quarter) AS ds_partitioned__quarter + , DATETIME_TRUNC(bookings_source_src_28000.ds_partitioned, year) AS ds_partitioned__year , EXTRACT(year FROM bookings_source_src_28000.ds_partitioned) AS ds_partitioned__extract_year , EXTRACT(quarter FROM bookings_source_src_28000.ds_partitioned) AS ds_partitioned__extract_quarter , EXTRACT(month FROM bookings_source_src_28000.ds_partitioned) AS ds_partitioned__extract_month , EXTRACT(day FROM bookings_source_src_28000.ds_partitioned) AS ds_partitioned__extract_day , IF(EXTRACT(dayofweek FROM bookings_source_src_28000.ds_partitioned) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_28000.ds_partitioned) - 1) AS ds_partitioned__extract_dow , EXTRACT(dayofyear FROM bookings_source_src_28000.ds_partitioned) AS ds_partitioned__extract_doy - , DATE_TRUNC(bookings_source_src_28000.paid_at, day) AS paid_at__day - , DATE_TRUNC(bookings_source_src_28000.paid_at, isoweek) AS paid_at__week - , DATE_TRUNC(bookings_source_src_28000.paid_at, month) AS paid_at__month - , DATE_TRUNC(bookings_source_src_28000.paid_at, quarter) AS paid_at__quarter - , DATE_TRUNC(bookings_source_src_28000.paid_at, year) AS paid_at__year + , DATETIME_TRUNC(bookings_source_src_28000.paid_at, day) AS paid_at__day + , DATETIME_TRUNC(bookings_source_src_28000.paid_at, isoweek) AS paid_at__week + , DATETIME_TRUNC(bookings_source_src_28000.paid_at, month) AS paid_at__month + , DATETIME_TRUNC(bookings_source_src_28000.paid_at, quarter) AS paid_at__quarter + , DATETIME_TRUNC(bookings_source_src_28000.paid_at, year) AS paid_at__year , EXTRACT(year FROM bookings_source_src_28000.paid_at) AS paid_at__extract_year , EXTRACT(quarter FROM bookings_source_src_28000.paid_at) AS paid_at__extract_quarter , EXTRACT(month FROM bookings_source_src_28000.paid_at) AS paid_at__extract_month @@ -399,33 +399,33 @@ FROM ( , IF(EXTRACT(dayofweek FROM bookings_source_src_28000.paid_at) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_28000.paid_at) - 1) AS paid_at__extract_dow , EXTRACT(dayofyear FROM bookings_source_src_28000.paid_at) AS paid_at__extract_doy , bookings_source_src_28000.is_instant AS booking__is_instant - , DATE_TRUNC(bookings_source_src_28000.ds, day) AS booking__ds__day - , DATE_TRUNC(bookings_source_src_28000.ds, isoweek) AS booking__ds__week - , DATE_TRUNC(bookings_source_src_28000.ds, month) AS booking__ds__month - , DATE_TRUNC(bookings_source_src_28000.ds, quarter) AS booking__ds__quarter - , DATE_TRUNC(bookings_source_src_28000.ds, year) AS booking__ds__year + , DATETIME_TRUNC(bookings_source_src_28000.ds, day) AS booking__ds__day + , DATETIME_TRUNC(bookings_source_src_28000.ds, isoweek) AS booking__ds__week + , DATETIME_TRUNC(bookings_source_src_28000.ds, month) AS booking__ds__month + , DATETIME_TRUNC(bookings_source_src_28000.ds, quarter) AS booking__ds__quarter + , DATETIME_TRUNC(bookings_source_src_28000.ds, year) AS booking__ds__year , EXTRACT(year FROM bookings_source_src_28000.ds) AS booking__ds__extract_year , EXTRACT(quarter FROM bookings_source_src_28000.ds) AS booking__ds__extract_quarter , EXTRACT(month FROM bookings_source_src_28000.ds) AS booking__ds__extract_month , EXTRACT(day FROM bookings_source_src_28000.ds) AS booking__ds__extract_day , IF(EXTRACT(dayofweek FROM bookings_source_src_28000.ds) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_28000.ds) - 1) AS booking__ds__extract_dow , EXTRACT(dayofyear FROM bookings_source_src_28000.ds) AS booking__ds__extract_doy - , DATE_TRUNC(bookings_source_src_28000.ds_partitioned, day) AS booking__ds_partitioned__day - , DATE_TRUNC(bookings_source_src_28000.ds_partitioned, isoweek) AS booking__ds_partitioned__week - , DATE_TRUNC(bookings_source_src_28000.ds_partitioned, month) AS booking__ds_partitioned__month - , DATE_TRUNC(bookings_source_src_28000.ds_partitioned, quarter) AS booking__ds_partitioned__quarter - , DATE_TRUNC(bookings_source_src_28000.ds_partitioned, year) AS booking__ds_partitioned__year + , DATETIME_TRUNC(bookings_source_src_28000.ds_partitioned, day) AS booking__ds_partitioned__day + , DATETIME_TRUNC(bookings_source_src_28000.ds_partitioned, isoweek) AS booking__ds_partitioned__week + , DATETIME_TRUNC(bookings_source_src_28000.ds_partitioned, month) AS booking__ds_partitioned__month + , DATETIME_TRUNC(bookings_source_src_28000.ds_partitioned, quarter) AS booking__ds_partitioned__quarter + , DATETIME_TRUNC(bookings_source_src_28000.ds_partitioned, year) AS booking__ds_partitioned__year , EXTRACT(year FROM bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__extract_year , EXTRACT(quarter FROM bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__extract_quarter , EXTRACT(month FROM bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__extract_month , EXTRACT(day FROM bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__extract_day , IF(EXTRACT(dayofweek FROM bookings_source_src_28000.ds_partitioned) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_28000.ds_partitioned) - 1) AS booking__ds_partitioned__extract_dow , EXTRACT(dayofyear FROM bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__extract_doy - , DATE_TRUNC(bookings_source_src_28000.paid_at, day) AS booking__paid_at__day - , DATE_TRUNC(bookings_source_src_28000.paid_at, isoweek) AS booking__paid_at__week - , DATE_TRUNC(bookings_source_src_28000.paid_at, month) AS booking__paid_at__month - , DATE_TRUNC(bookings_source_src_28000.paid_at, quarter) AS booking__paid_at__quarter - , DATE_TRUNC(bookings_source_src_28000.paid_at, year) AS booking__paid_at__year + , DATETIME_TRUNC(bookings_source_src_28000.paid_at, day) AS booking__paid_at__day + , DATETIME_TRUNC(bookings_source_src_28000.paid_at, isoweek) AS booking__paid_at__week + , DATETIME_TRUNC(bookings_source_src_28000.paid_at, month) AS booking__paid_at__month + , DATETIME_TRUNC(bookings_source_src_28000.paid_at, quarter) AS booking__paid_at__quarter + , DATETIME_TRUNC(bookings_source_src_28000.paid_at, year) AS booking__paid_at__year , EXTRACT(year FROM bookings_source_src_28000.paid_at) AS booking__paid_at__extract_year , EXTRACT(quarter FROM bookings_source_src_28000.paid_at) AS booking__paid_at__extract_quarter , EXTRACT(month FROM bookings_source_src_28000.paid_at) AS booking__paid_at__extract_month diff --git a/tests_metricflow/snapshots/test_metric_filter_rendering.py/SqlQueryPlan/BigQuery/test_filter_with_conversion_metric__plan0.sql b/tests_metricflow/snapshots/test_metric_filter_rendering.py/SqlQueryPlan/BigQuery/test_filter_with_conversion_metric__plan0.sql index 5d1c993c3a..388180cf2a 100644 --- a/tests_metricflow/snapshots/test_metric_filter_rendering.py/SqlQueryPlan/BigQuery/test_filter_with_conversion_metric__plan0.sql +++ b/tests_metricflow/snapshots/test_metric_filter_rendering.py/SqlQueryPlan/BigQuery/test_filter_with_conversion_metric__plan0.sql @@ -106,22 +106,22 @@ FROM ( 1 AS listings , listings_latest_src_28000.capacity AS largest_listing , listings_latest_src_28000.capacity AS smallest_listing - , DATE_TRUNC(listings_latest_src_28000.created_at, day) AS ds__day - , DATE_TRUNC(listings_latest_src_28000.created_at, isoweek) AS ds__week - , DATE_TRUNC(listings_latest_src_28000.created_at, month) AS ds__month - , DATE_TRUNC(listings_latest_src_28000.created_at, quarter) AS ds__quarter - , DATE_TRUNC(listings_latest_src_28000.created_at, year) AS ds__year + , DATETIME_TRUNC(listings_latest_src_28000.created_at, day) AS ds__day + , DATETIME_TRUNC(listings_latest_src_28000.created_at, isoweek) AS ds__week + , DATETIME_TRUNC(listings_latest_src_28000.created_at, month) AS ds__month + , DATETIME_TRUNC(listings_latest_src_28000.created_at, quarter) AS ds__quarter + , DATETIME_TRUNC(listings_latest_src_28000.created_at, year) AS ds__year , EXTRACT(year FROM listings_latest_src_28000.created_at) AS ds__extract_year , EXTRACT(quarter FROM listings_latest_src_28000.created_at) AS ds__extract_quarter , EXTRACT(month FROM listings_latest_src_28000.created_at) AS ds__extract_month , EXTRACT(day FROM listings_latest_src_28000.created_at) AS ds__extract_day , IF(EXTRACT(dayofweek FROM listings_latest_src_28000.created_at) = 1, 7, EXTRACT(dayofweek FROM listings_latest_src_28000.created_at) - 1) AS ds__extract_dow , EXTRACT(dayofyear FROM listings_latest_src_28000.created_at) AS ds__extract_doy - , DATE_TRUNC(listings_latest_src_28000.created_at, day) AS created_at__day - , DATE_TRUNC(listings_latest_src_28000.created_at, isoweek) AS created_at__week - , DATE_TRUNC(listings_latest_src_28000.created_at, month) AS created_at__month - , DATE_TRUNC(listings_latest_src_28000.created_at, quarter) AS created_at__quarter - , DATE_TRUNC(listings_latest_src_28000.created_at, year) AS created_at__year + , DATETIME_TRUNC(listings_latest_src_28000.created_at, day) AS created_at__day + , DATETIME_TRUNC(listings_latest_src_28000.created_at, isoweek) AS created_at__week + , DATETIME_TRUNC(listings_latest_src_28000.created_at, month) AS created_at__month + , DATETIME_TRUNC(listings_latest_src_28000.created_at, quarter) AS created_at__quarter + , DATETIME_TRUNC(listings_latest_src_28000.created_at, year) AS created_at__year , EXTRACT(year FROM listings_latest_src_28000.created_at) AS created_at__extract_year , EXTRACT(quarter FROM listings_latest_src_28000.created_at) AS created_at__extract_quarter , EXTRACT(month FROM listings_latest_src_28000.created_at) AS created_at__extract_month @@ -131,22 +131,22 @@ FROM ( , listings_latest_src_28000.country AS country_latest , listings_latest_src_28000.is_lux AS is_lux_latest , listings_latest_src_28000.capacity AS capacity_latest - , DATE_TRUNC(listings_latest_src_28000.created_at, day) AS listing__ds__day - , DATE_TRUNC(listings_latest_src_28000.created_at, isoweek) AS listing__ds__week - , DATE_TRUNC(listings_latest_src_28000.created_at, month) AS listing__ds__month - , DATE_TRUNC(listings_latest_src_28000.created_at, quarter) AS listing__ds__quarter - , DATE_TRUNC(listings_latest_src_28000.created_at, year) AS listing__ds__year + , DATETIME_TRUNC(listings_latest_src_28000.created_at, day) AS listing__ds__day + , DATETIME_TRUNC(listings_latest_src_28000.created_at, isoweek) AS listing__ds__week + , DATETIME_TRUNC(listings_latest_src_28000.created_at, month) AS listing__ds__month + , DATETIME_TRUNC(listings_latest_src_28000.created_at, quarter) AS listing__ds__quarter + , DATETIME_TRUNC(listings_latest_src_28000.created_at, year) AS listing__ds__year , EXTRACT(year FROM listings_latest_src_28000.created_at) AS listing__ds__extract_year , EXTRACT(quarter FROM listings_latest_src_28000.created_at) AS listing__ds__extract_quarter , EXTRACT(month FROM listings_latest_src_28000.created_at) AS listing__ds__extract_month , EXTRACT(day FROM listings_latest_src_28000.created_at) AS listing__ds__extract_day , IF(EXTRACT(dayofweek FROM listings_latest_src_28000.created_at) = 1, 7, EXTRACT(dayofweek FROM listings_latest_src_28000.created_at) - 1) AS listing__ds__extract_dow , EXTRACT(dayofyear FROM listings_latest_src_28000.created_at) AS listing__ds__extract_doy - , DATE_TRUNC(listings_latest_src_28000.created_at, day) AS listing__created_at__day - , DATE_TRUNC(listings_latest_src_28000.created_at, isoweek) AS listing__created_at__week - , DATE_TRUNC(listings_latest_src_28000.created_at, month) AS listing__created_at__month - , DATE_TRUNC(listings_latest_src_28000.created_at, quarter) AS listing__created_at__quarter - , DATE_TRUNC(listings_latest_src_28000.created_at, year) AS listing__created_at__year + , DATETIME_TRUNC(listings_latest_src_28000.created_at, day) AS listing__created_at__day + , DATETIME_TRUNC(listings_latest_src_28000.created_at, isoweek) AS listing__created_at__week + , DATETIME_TRUNC(listings_latest_src_28000.created_at, month) AS listing__created_at__month + , DATETIME_TRUNC(listings_latest_src_28000.created_at, quarter) AS listing__created_at__quarter + , DATETIME_TRUNC(listings_latest_src_28000.created_at, year) AS listing__created_at__year , EXTRACT(year FROM listings_latest_src_28000.created_at) AS listing__created_at__extract_year , EXTRACT(quarter FROM listings_latest_src_28000.created_at) AS listing__created_at__extract_quarter , EXTRACT(month FROM listings_latest_src_28000.created_at) AS listing__created_at__extract_month @@ -238,11 +238,11 @@ FROM ( SELECT 1 AS visits , visits_source_src_28000.user_id AS visitors - , DATE_TRUNC(visits_source_src_28000.ds, day) AS ds__day - , DATE_TRUNC(visits_source_src_28000.ds, isoweek) AS ds__week - , DATE_TRUNC(visits_source_src_28000.ds, month) AS ds__month - , DATE_TRUNC(visits_source_src_28000.ds, quarter) AS ds__quarter - , DATE_TRUNC(visits_source_src_28000.ds, year) AS ds__year + , DATETIME_TRUNC(visits_source_src_28000.ds, day) AS ds__day + , DATETIME_TRUNC(visits_source_src_28000.ds, isoweek) AS ds__week + , DATETIME_TRUNC(visits_source_src_28000.ds, month) AS ds__month + , DATETIME_TRUNC(visits_source_src_28000.ds, quarter) AS ds__quarter + , DATETIME_TRUNC(visits_source_src_28000.ds, year) AS ds__year , EXTRACT(year FROM visits_source_src_28000.ds) AS ds__extract_year , EXTRACT(quarter FROM visits_source_src_28000.ds) AS ds__extract_quarter , EXTRACT(month FROM visits_source_src_28000.ds) AS ds__extract_month @@ -250,11 +250,11 @@ FROM ( , IF(EXTRACT(dayofweek FROM visits_source_src_28000.ds) = 1, 7, EXTRACT(dayofweek FROM visits_source_src_28000.ds) - 1) AS ds__extract_dow , EXTRACT(dayofyear FROM visits_source_src_28000.ds) AS ds__extract_doy , visits_source_src_28000.referrer_id - , DATE_TRUNC(visits_source_src_28000.ds, day) AS visit__ds__day - , DATE_TRUNC(visits_source_src_28000.ds, isoweek) AS visit__ds__week - , DATE_TRUNC(visits_source_src_28000.ds, month) AS visit__ds__month - , DATE_TRUNC(visits_source_src_28000.ds, quarter) AS visit__ds__quarter - , DATE_TRUNC(visits_source_src_28000.ds, year) AS visit__ds__year + , DATETIME_TRUNC(visits_source_src_28000.ds, day) AS visit__ds__day + , DATETIME_TRUNC(visits_source_src_28000.ds, isoweek) AS visit__ds__week + , DATETIME_TRUNC(visits_source_src_28000.ds, month) AS visit__ds__month + , DATETIME_TRUNC(visits_source_src_28000.ds, quarter) AS visit__ds__quarter + , DATETIME_TRUNC(visits_source_src_28000.ds, year) AS visit__ds__year , EXTRACT(year FROM visits_source_src_28000.ds) AS visit__ds__extract_year , EXTRACT(quarter FROM visits_source_src_28000.ds) AS visit__ds__extract_quarter , EXTRACT(month FROM visits_source_src_28000.ds) AS visit__ds__extract_month @@ -374,11 +374,11 @@ FROM ( SELECT 1 AS visits , visits_source_src_28000.user_id AS visitors - , DATE_TRUNC(visits_source_src_28000.ds, day) AS ds__day - , DATE_TRUNC(visits_source_src_28000.ds, isoweek) AS ds__week - , DATE_TRUNC(visits_source_src_28000.ds, month) AS ds__month - , DATE_TRUNC(visits_source_src_28000.ds, quarter) AS ds__quarter - , DATE_TRUNC(visits_source_src_28000.ds, year) AS ds__year + , DATETIME_TRUNC(visits_source_src_28000.ds, day) AS ds__day + , DATETIME_TRUNC(visits_source_src_28000.ds, isoweek) AS ds__week + , DATETIME_TRUNC(visits_source_src_28000.ds, month) AS ds__month + , DATETIME_TRUNC(visits_source_src_28000.ds, quarter) AS ds__quarter + , DATETIME_TRUNC(visits_source_src_28000.ds, year) AS ds__year , EXTRACT(year FROM visits_source_src_28000.ds) AS ds__extract_year , EXTRACT(quarter FROM visits_source_src_28000.ds) AS ds__extract_quarter , EXTRACT(month FROM visits_source_src_28000.ds) AS ds__extract_month @@ -386,11 +386,11 @@ FROM ( , IF(EXTRACT(dayofweek FROM visits_source_src_28000.ds) = 1, 7, EXTRACT(dayofweek FROM visits_source_src_28000.ds) - 1) AS ds__extract_dow , EXTRACT(dayofyear FROM visits_source_src_28000.ds) AS ds__extract_doy , visits_source_src_28000.referrer_id - , DATE_TRUNC(visits_source_src_28000.ds, day) AS visit__ds__day - , DATE_TRUNC(visits_source_src_28000.ds, isoweek) AS visit__ds__week - , DATE_TRUNC(visits_source_src_28000.ds, month) AS visit__ds__month - , DATE_TRUNC(visits_source_src_28000.ds, quarter) AS visit__ds__quarter - , DATE_TRUNC(visits_source_src_28000.ds, year) AS visit__ds__year + , DATETIME_TRUNC(visits_source_src_28000.ds, day) AS visit__ds__day + , DATETIME_TRUNC(visits_source_src_28000.ds, isoweek) AS visit__ds__week + , DATETIME_TRUNC(visits_source_src_28000.ds, month) AS visit__ds__month + , DATETIME_TRUNC(visits_source_src_28000.ds, quarter) AS visit__ds__quarter + , DATETIME_TRUNC(visits_source_src_28000.ds, year) AS visit__ds__year , EXTRACT(year FROM visits_source_src_28000.ds) AS visit__ds__extract_year , EXTRACT(quarter FROM visits_source_src_28000.ds) AS visit__ds__extract_quarter , EXTRACT(month FROM visits_source_src_28000.ds) AS visit__ds__extract_month @@ -496,22 +496,22 @@ FROM ( SELECT 1 AS buys , buys_source_src_28000.user_id AS buyers - , DATE_TRUNC(buys_source_src_28000.ds, day) AS ds__day - , DATE_TRUNC(buys_source_src_28000.ds, isoweek) AS ds__week - , DATE_TRUNC(buys_source_src_28000.ds, month) AS ds__month - , DATE_TRUNC(buys_source_src_28000.ds, quarter) AS ds__quarter - , DATE_TRUNC(buys_source_src_28000.ds, year) AS ds__year + , DATETIME_TRUNC(buys_source_src_28000.ds, day) AS ds__day + , DATETIME_TRUNC(buys_source_src_28000.ds, isoweek) AS ds__week + , DATETIME_TRUNC(buys_source_src_28000.ds, month) AS ds__month + , DATETIME_TRUNC(buys_source_src_28000.ds, quarter) AS ds__quarter + , DATETIME_TRUNC(buys_source_src_28000.ds, year) AS ds__year , EXTRACT(year FROM buys_source_src_28000.ds) AS ds__extract_year , EXTRACT(quarter FROM buys_source_src_28000.ds) AS ds__extract_quarter , EXTRACT(month FROM buys_source_src_28000.ds) AS ds__extract_month , EXTRACT(day FROM buys_source_src_28000.ds) AS ds__extract_day , IF(EXTRACT(dayofweek FROM buys_source_src_28000.ds) = 1, 7, EXTRACT(dayofweek FROM buys_source_src_28000.ds) - 1) AS ds__extract_dow , EXTRACT(dayofyear FROM buys_source_src_28000.ds) AS ds__extract_doy - , DATE_TRUNC(buys_source_src_28000.ds, day) AS buy__ds__day - , DATE_TRUNC(buys_source_src_28000.ds, isoweek) AS buy__ds__week - , DATE_TRUNC(buys_source_src_28000.ds, month) AS buy__ds__month - , DATE_TRUNC(buys_source_src_28000.ds, quarter) AS buy__ds__quarter - , DATE_TRUNC(buys_source_src_28000.ds, year) AS buy__ds__year + , DATETIME_TRUNC(buys_source_src_28000.ds, day) AS buy__ds__day + , DATETIME_TRUNC(buys_source_src_28000.ds, isoweek) AS buy__ds__week + , DATETIME_TRUNC(buys_source_src_28000.ds, month) AS buy__ds__month + , DATETIME_TRUNC(buys_source_src_28000.ds, quarter) AS buy__ds__quarter + , DATETIME_TRUNC(buys_source_src_28000.ds, year) AS buy__ds__year , EXTRACT(year FROM buys_source_src_28000.ds) AS buy__ds__extract_year , EXTRACT(quarter FROM buys_source_src_28000.ds) AS buy__ds__extract_quarter , EXTRACT(month FROM buys_source_src_28000.ds) AS buy__ds__extract_month diff --git a/tests_metricflow/snapshots/test_metric_filter_rendering.py/SqlQueryPlan/BigQuery/test_filter_with_conversion_metric__plan0_optimized.sql b/tests_metricflow/snapshots/test_metric_filter_rendering.py/SqlQueryPlan/BigQuery/test_filter_with_conversion_metric__plan0_optimized.sql index 42f8341179..01a66ea87b 100644 --- a/tests_metricflow/snapshots/test_metric_filter_rendering.py/SqlQueryPlan/BigQuery/test_filter_with_conversion_metric__plan0_optimized.sql +++ b/tests_metricflow/snapshots/test_metric_filter_rendering.py/SqlQueryPlan/BigQuery/test_filter_with_conversion_metric__plan0_optimized.sql @@ -83,7 +83,7 @@ FROM ( -- Metric Time Dimension 'ds' -- Pass Only Elements: ['visits', 'ds__day', 'user'] SELECT - DATE_TRUNC(ds, day) AS ds__day + DATETIME_TRUNC(ds, day) AS ds__day , user_id AS user , 1 AS visits FROM ***************************.fct_visits visits_source_src_28000 @@ -93,7 +93,7 @@ FROM ( -- Metric Time Dimension 'ds' -- Add column with generated UUID SELECT - DATE_TRUNC(ds, day) AS ds__day + DATETIME_TRUNC(ds, day) AS ds__day , user_id AS user , 1 AS buys , GENERATE_UUID() AS mf_internal_uuid diff --git a/tests_metricflow/snapshots/test_metric_filter_rendering.py/SqlQueryPlan/BigQuery/test_group_by_has_local_entity_prefix__plan0.sql b/tests_metricflow/snapshots/test_metric_filter_rendering.py/SqlQueryPlan/BigQuery/test_group_by_has_local_entity_prefix__plan0.sql index fb86b1dfeb..6dc29144e6 100644 --- a/tests_metricflow/snapshots/test_metric_filter_rendering.py/SqlQueryPlan/BigQuery/test_group_by_has_local_entity_prefix__plan0.sql +++ b/tests_metricflow/snapshots/test_metric_filter_rendering.py/SqlQueryPlan/BigQuery/test_group_by_has_local_entity_prefix__plan0.sql @@ -107,22 +107,22 @@ FROM ( 1 AS listings , listings_latest_src_28000.capacity AS largest_listing , listings_latest_src_28000.capacity AS smallest_listing - , DATE_TRUNC(listings_latest_src_28000.created_at, day) AS ds__day - , DATE_TRUNC(listings_latest_src_28000.created_at, isoweek) AS ds__week - , DATE_TRUNC(listings_latest_src_28000.created_at, month) AS ds__month - , DATE_TRUNC(listings_latest_src_28000.created_at, quarter) AS ds__quarter - , DATE_TRUNC(listings_latest_src_28000.created_at, year) AS ds__year + , DATETIME_TRUNC(listings_latest_src_28000.created_at, day) AS ds__day + , DATETIME_TRUNC(listings_latest_src_28000.created_at, isoweek) AS ds__week + , DATETIME_TRUNC(listings_latest_src_28000.created_at, month) AS ds__month + , DATETIME_TRUNC(listings_latest_src_28000.created_at, quarter) AS ds__quarter + , DATETIME_TRUNC(listings_latest_src_28000.created_at, year) AS ds__year , EXTRACT(year FROM listings_latest_src_28000.created_at) AS ds__extract_year , EXTRACT(quarter FROM listings_latest_src_28000.created_at) AS ds__extract_quarter , EXTRACT(month FROM listings_latest_src_28000.created_at) AS ds__extract_month , EXTRACT(day FROM listings_latest_src_28000.created_at) AS ds__extract_day , IF(EXTRACT(dayofweek FROM listings_latest_src_28000.created_at) = 1, 7, EXTRACT(dayofweek FROM listings_latest_src_28000.created_at) - 1) AS ds__extract_dow , EXTRACT(dayofyear FROM listings_latest_src_28000.created_at) AS ds__extract_doy - , DATE_TRUNC(listings_latest_src_28000.created_at, day) AS created_at__day - , DATE_TRUNC(listings_latest_src_28000.created_at, isoweek) AS created_at__week - , DATE_TRUNC(listings_latest_src_28000.created_at, month) AS created_at__month - , DATE_TRUNC(listings_latest_src_28000.created_at, quarter) AS created_at__quarter - , DATE_TRUNC(listings_latest_src_28000.created_at, year) AS created_at__year + , DATETIME_TRUNC(listings_latest_src_28000.created_at, day) AS created_at__day + , DATETIME_TRUNC(listings_latest_src_28000.created_at, isoweek) AS created_at__week + , DATETIME_TRUNC(listings_latest_src_28000.created_at, month) AS created_at__month + , DATETIME_TRUNC(listings_latest_src_28000.created_at, quarter) AS created_at__quarter + , DATETIME_TRUNC(listings_latest_src_28000.created_at, year) AS created_at__year , EXTRACT(year FROM listings_latest_src_28000.created_at) AS created_at__extract_year , EXTRACT(quarter FROM listings_latest_src_28000.created_at) AS created_at__extract_quarter , EXTRACT(month FROM listings_latest_src_28000.created_at) AS created_at__extract_month @@ -132,22 +132,22 @@ FROM ( , listings_latest_src_28000.country AS country_latest , listings_latest_src_28000.is_lux AS is_lux_latest , listings_latest_src_28000.capacity AS capacity_latest - , DATE_TRUNC(listings_latest_src_28000.created_at, day) AS listing__ds__day - , DATE_TRUNC(listings_latest_src_28000.created_at, isoweek) AS listing__ds__week - , DATE_TRUNC(listings_latest_src_28000.created_at, month) AS listing__ds__month - , DATE_TRUNC(listings_latest_src_28000.created_at, quarter) AS listing__ds__quarter - , DATE_TRUNC(listings_latest_src_28000.created_at, year) AS listing__ds__year + , DATETIME_TRUNC(listings_latest_src_28000.created_at, day) AS listing__ds__day + , DATETIME_TRUNC(listings_latest_src_28000.created_at, isoweek) AS listing__ds__week + , DATETIME_TRUNC(listings_latest_src_28000.created_at, month) AS listing__ds__month + , DATETIME_TRUNC(listings_latest_src_28000.created_at, quarter) AS listing__ds__quarter + , DATETIME_TRUNC(listings_latest_src_28000.created_at, year) AS listing__ds__year , EXTRACT(year FROM listings_latest_src_28000.created_at) AS listing__ds__extract_year , EXTRACT(quarter FROM listings_latest_src_28000.created_at) AS listing__ds__extract_quarter , EXTRACT(month FROM listings_latest_src_28000.created_at) AS listing__ds__extract_month , EXTRACT(day FROM listings_latest_src_28000.created_at) AS listing__ds__extract_day , IF(EXTRACT(dayofweek FROM listings_latest_src_28000.created_at) = 1, 7, EXTRACT(dayofweek FROM listings_latest_src_28000.created_at) - 1) AS listing__ds__extract_dow , EXTRACT(dayofyear FROM listings_latest_src_28000.created_at) AS listing__ds__extract_doy - , DATE_TRUNC(listings_latest_src_28000.created_at, day) AS listing__created_at__day - , DATE_TRUNC(listings_latest_src_28000.created_at, isoweek) AS listing__created_at__week - , DATE_TRUNC(listings_latest_src_28000.created_at, month) AS listing__created_at__month - , DATE_TRUNC(listings_latest_src_28000.created_at, quarter) AS listing__created_at__quarter - , DATE_TRUNC(listings_latest_src_28000.created_at, year) AS listing__created_at__year + , DATETIME_TRUNC(listings_latest_src_28000.created_at, day) AS listing__created_at__day + , DATETIME_TRUNC(listings_latest_src_28000.created_at, isoweek) AS listing__created_at__week + , DATETIME_TRUNC(listings_latest_src_28000.created_at, month) AS listing__created_at__month + , DATETIME_TRUNC(listings_latest_src_28000.created_at, quarter) AS listing__created_at__quarter + , DATETIME_TRUNC(listings_latest_src_28000.created_at, year) AS listing__created_at__year , EXTRACT(year FROM listings_latest_src_28000.created_at) AS listing__created_at__extract_year , EXTRACT(quarter FROM listings_latest_src_28000.created_at) AS listing__created_at__extract_quarter , EXTRACT(month FROM listings_latest_src_28000.created_at) AS listing__created_at__extract_month @@ -314,33 +314,33 @@ FROM ( , bookings_source_src_28000.booking_value AS approximate_continuous_booking_value_p99 , bookings_source_src_28000.booking_value AS approximate_discrete_booking_value_p99 , bookings_source_src_28000.is_instant - , DATE_TRUNC(bookings_source_src_28000.ds, day) AS ds__day - , DATE_TRUNC(bookings_source_src_28000.ds, isoweek) AS ds__week - , DATE_TRUNC(bookings_source_src_28000.ds, month) AS ds__month - , DATE_TRUNC(bookings_source_src_28000.ds, quarter) AS ds__quarter - , DATE_TRUNC(bookings_source_src_28000.ds, year) AS ds__year + , DATETIME_TRUNC(bookings_source_src_28000.ds, day) AS ds__day + , DATETIME_TRUNC(bookings_source_src_28000.ds, isoweek) AS ds__week + , DATETIME_TRUNC(bookings_source_src_28000.ds, month) AS ds__month + , DATETIME_TRUNC(bookings_source_src_28000.ds, quarter) AS ds__quarter + , DATETIME_TRUNC(bookings_source_src_28000.ds, year) AS ds__year , EXTRACT(year FROM bookings_source_src_28000.ds) AS ds__extract_year , EXTRACT(quarter FROM bookings_source_src_28000.ds) AS ds__extract_quarter , EXTRACT(month FROM bookings_source_src_28000.ds) AS ds__extract_month , EXTRACT(day FROM bookings_source_src_28000.ds) AS ds__extract_day , IF(EXTRACT(dayofweek FROM bookings_source_src_28000.ds) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_28000.ds) - 1) AS ds__extract_dow , EXTRACT(dayofyear FROM bookings_source_src_28000.ds) AS ds__extract_doy - , DATE_TRUNC(bookings_source_src_28000.ds_partitioned, day) AS ds_partitioned__day - , DATE_TRUNC(bookings_source_src_28000.ds_partitioned, isoweek) AS ds_partitioned__week - , DATE_TRUNC(bookings_source_src_28000.ds_partitioned, month) AS ds_partitioned__month - , DATE_TRUNC(bookings_source_src_28000.ds_partitioned, quarter) AS ds_partitioned__quarter - , DATE_TRUNC(bookings_source_src_28000.ds_partitioned, year) AS ds_partitioned__year + , DATETIME_TRUNC(bookings_source_src_28000.ds_partitioned, day) AS ds_partitioned__day + , DATETIME_TRUNC(bookings_source_src_28000.ds_partitioned, isoweek) AS ds_partitioned__week + , DATETIME_TRUNC(bookings_source_src_28000.ds_partitioned, month) AS ds_partitioned__month + , DATETIME_TRUNC(bookings_source_src_28000.ds_partitioned, quarter) AS ds_partitioned__quarter + , DATETIME_TRUNC(bookings_source_src_28000.ds_partitioned, year) AS ds_partitioned__year , EXTRACT(year FROM bookings_source_src_28000.ds_partitioned) AS ds_partitioned__extract_year , EXTRACT(quarter FROM bookings_source_src_28000.ds_partitioned) AS ds_partitioned__extract_quarter , EXTRACT(month FROM bookings_source_src_28000.ds_partitioned) AS ds_partitioned__extract_month , EXTRACT(day FROM bookings_source_src_28000.ds_partitioned) AS ds_partitioned__extract_day , IF(EXTRACT(dayofweek FROM bookings_source_src_28000.ds_partitioned) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_28000.ds_partitioned) - 1) AS ds_partitioned__extract_dow , EXTRACT(dayofyear FROM bookings_source_src_28000.ds_partitioned) AS ds_partitioned__extract_doy - , DATE_TRUNC(bookings_source_src_28000.paid_at, day) AS paid_at__day - , DATE_TRUNC(bookings_source_src_28000.paid_at, isoweek) AS paid_at__week - , DATE_TRUNC(bookings_source_src_28000.paid_at, month) AS paid_at__month - , DATE_TRUNC(bookings_source_src_28000.paid_at, quarter) AS paid_at__quarter - , DATE_TRUNC(bookings_source_src_28000.paid_at, year) AS paid_at__year + , DATETIME_TRUNC(bookings_source_src_28000.paid_at, day) AS paid_at__day + , DATETIME_TRUNC(bookings_source_src_28000.paid_at, isoweek) AS paid_at__week + , DATETIME_TRUNC(bookings_source_src_28000.paid_at, month) AS paid_at__month + , DATETIME_TRUNC(bookings_source_src_28000.paid_at, quarter) AS paid_at__quarter + , DATETIME_TRUNC(bookings_source_src_28000.paid_at, year) AS paid_at__year , EXTRACT(year FROM bookings_source_src_28000.paid_at) AS paid_at__extract_year , EXTRACT(quarter FROM bookings_source_src_28000.paid_at) AS paid_at__extract_quarter , EXTRACT(month FROM bookings_source_src_28000.paid_at) AS paid_at__extract_month @@ -348,33 +348,33 @@ FROM ( , IF(EXTRACT(dayofweek FROM bookings_source_src_28000.paid_at) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_28000.paid_at) - 1) AS paid_at__extract_dow , EXTRACT(dayofyear FROM bookings_source_src_28000.paid_at) AS paid_at__extract_doy , bookings_source_src_28000.is_instant AS booking__is_instant - , DATE_TRUNC(bookings_source_src_28000.ds, day) AS booking__ds__day - , DATE_TRUNC(bookings_source_src_28000.ds, isoweek) AS booking__ds__week - , DATE_TRUNC(bookings_source_src_28000.ds, month) AS booking__ds__month - , DATE_TRUNC(bookings_source_src_28000.ds, quarter) AS booking__ds__quarter - , DATE_TRUNC(bookings_source_src_28000.ds, year) AS booking__ds__year + , DATETIME_TRUNC(bookings_source_src_28000.ds, day) AS booking__ds__day + , DATETIME_TRUNC(bookings_source_src_28000.ds, isoweek) AS booking__ds__week + , DATETIME_TRUNC(bookings_source_src_28000.ds, month) AS booking__ds__month + , DATETIME_TRUNC(bookings_source_src_28000.ds, quarter) AS booking__ds__quarter + , DATETIME_TRUNC(bookings_source_src_28000.ds, year) AS booking__ds__year , EXTRACT(year FROM bookings_source_src_28000.ds) AS booking__ds__extract_year , EXTRACT(quarter FROM bookings_source_src_28000.ds) AS booking__ds__extract_quarter , EXTRACT(month FROM bookings_source_src_28000.ds) AS booking__ds__extract_month , EXTRACT(day FROM bookings_source_src_28000.ds) AS booking__ds__extract_day , IF(EXTRACT(dayofweek FROM bookings_source_src_28000.ds) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_28000.ds) - 1) AS booking__ds__extract_dow , EXTRACT(dayofyear FROM bookings_source_src_28000.ds) AS booking__ds__extract_doy - , DATE_TRUNC(bookings_source_src_28000.ds_partitioned, day) AS booking__ds_partitioned__day - , DATE_TRUNC(bookings_source_src_28000.ds_partitioned, isoweek) AS booking__ds_partitioned__week - , DATE_TRUNC(bookings_source_src_28000.ds_partitioned, month) AS booking__ds_partitioned__month - , DATE_TRUNC(bookings_source_src_28000.ds_partitioned, quarter) AS booking__ds_partitioned__quarter - , DATE_TRUNC(bookings_source_src_28000.ds_partitioned, year) AS booking__ds_partitioned__year + , DATETIME_TRUNC(bookings_source_src_28000.ds_partitioned, day) AS booking__ds_partitioned__day + , DATETIME_TRUNC(bookings_source_src_28000.ds_partitioned, isoweek) AS booking__ds_partitioned__week + , DATETIME_TRUNC(bookings_source_src_28000.ds_partitioned, month) AS booking__ds_partitioned__month + , DATETIME_TRUNC(bookings_source_src_28000.ds_partitioned, quarter) AS booking__ds_partitioned__quarter + , DATETIME_TRUNC(bookings_source_src_28000.ds_partitioned, year) AS booking__ds_partitioned__year , EXTRACT(year FROM bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__extract_year , EXTRACT(quarter FROM bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__extract_quarter , EXTRACT(month FROM bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__extract_month , EXTRACT(day FROM bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__extract_day , IF(EXTRACT(dayofweek FROM bookings_source_src_28000.ds_partitioned) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_28000.ds_partitioned) - 1) AS booking__ds_partitioned__extract_dow , EXTRACT(dayofyear FROM bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__extract_doy - , DATE_TRUNC(bookings_source_src_28000.paid_at, day) AS booking__paid_at__day - , DATE_TRUNC(bookings_source_src_28000.paid_at, isoweek) AS booking__paid_at__week - , DATE_TRUNC(bookings_source_src_28000.paid_at, month) AS booking__paid_at__month - , DATE_TRUNC(bookings_source_src_28000.paid_at, quarter) AS booking__paid_at__quarter - , DATE_TRUNC(bookings_source_src_28000.paid_at, year) AS booking__paid_at__year + , DATETIME_TRUNC(bookings_source_src_28000.paid_at, day) AS booking__paid_at__day + , DATETIME_TRUNC(bookings_source_src_28000.paid_at, isoweek) AS booking__paid_at__week + , DATETIME_TRUNC(bookings_source_src_28000.paid_at, month) AS booking__paid_at__month + , DATETIME_TRUNC(bookings_source_src_28000.paid_at, quarter) AS booking__paid_at__quarter + , DATETIME_TRUNC(bookings_source_src_28000.paid_at, year) AS booking__paid_at__year , EXTRACT(year FROM bookings_source_src_28000.paid_at) AS booking__paid_at__extract_year , EXTRACT(quarter FROM bookings_source_src_28000.paid_at) AS booking__paid_at__extract_quarter , EXTRACT(month FROM bookings_source_src_28000.paid_at) AS booking__paid_at__extract_month @@ -472,22 +472,22 @@ FROM ( 1 AS listings , listings_latest_src_28000.capacity AS largest_listing , listings_latest_src_28000.capacity AS smallest_listing - , DATE_TRUNC(listings_latest_src_28000.created_at, day) AS ds__day - , DATE_TRUNC(listings_latest_src_28000.created_at, isoweek) AS ds__week - , DATE_TRUNC(listings_latest_src_28000.created_at, month) AS ds__month - , DATE_TRUNC(listings_latest_src_28000.created_at, quarter) AS ds__quarter - , DATE_TRUNC(listings_latest_src_28000.created_at, year) AS ds__year + , DATETIME_TRUNC(listings_latest_src_28000.created_at, day) AS ds__day + , DATETIME_TRUNC(listings_latest_src_28000.created_at, isoweek) AS ds__week + , DATETIME_TRUNC(listings_latest_src_28000.created_at, month) AS ds__month + , DATETIME_TRUNC(listings_latest_src_28000.created_at, quarter) AS ds__quarter + , DATETIME_TRUNC(listings_latest_src_28000.created_at, year) AS ds__year , EXTRACT(year FROM listings_latest_src_28000.created_at) AS ds__extract_year , EXTRACT(quarter FROM listings_latest_src_28000.created_at) AS ds__extract_quarter , EXTRACT(month FROM listings_latest_src_28000.created_at) AS ds__extract_month , EXTRACT(day FROM listings_latest_src_28000.created_at) AS ds__extract_day , IF(EXTRACT(dayofweek FROM listings_latest_src_28000.created_at) = 1, 7, EXTRACT(dayofweek FROM listings_latest_src_28000.created_at) - 1) AS ds__extract_dow , EXTRACT(dayofyear FROM listings_latest_src_28000.created_at) AS ds__extract_doy - , DATE_TRUNC(listings_latest_src_28000.created_at, day) AS created_at__day - , DATE_TRUNC(listings_latest_src_28000.created_at, isoweek) AS created_at__week - , DATE_TRUNC(listings_latest_src_28000.created_at, month) AS created_at__month - , DATE_TRUNC(listings_latest_src_28000.created_at, quarter) AS created_at__quarter - , DATE_TRUNC(listings_latest_src_28000.created_at, year) AS created_at__year + , DATETIME_TRUNC(listings_latest_src_28000.created_at, day) AS created_at__day + , DATETIME_TRUNC(listings_latest_src_28000.created_at, isoweek) AS created_at__week + , DATETIME_TRUNC(listings_latest_src_28000.created_at, month) AS created_at__month + , DATETIME_TRUNC(listings_latest_src_28000.created_at, quarter) AS created_at__quarter + , DATETIME_TRUNC(listings_latest_src_28000.created_at, year) AS created_at__year , EXTRACT(year FROM listings_latest_src_28000.created_at) AS created_at__extract_year , EXTRACT(quarter FROM listings_latest_src_28000.created_at) AS created_at__extract_quarter , EXTRACT(month FROM listings_latest_src_28000.created_at) AS created_at__extract_month @@ -497,22 +497,22 @@ FROM ( , listings_latest_src_28000.country AS country_latest , listings_latest_src_28000.is_lux AS is_lux_latest , listings_latest_src_28000.capacity AS capacity_latest - , DATE_TRUNC(listings_latest_src_28000.created_at, day) AS listing__ds__day - , DATE_TRUNC(listings_latest_src_28000.created_at, isoweek) AS listing__ds__week - , DATE_TRUNC(listings_latest_src_28000.created_at, month) AS listing__ds__month - , DATE_TRUNC(listings_latest_src_28000.created_at, quarter) AS listing__ds__quarter - , DATE_TRUNC(listings_latest_src_28000.created_at, year) AS listing__ds__year + , DATETIME_TRUNC(listings_latest_src_28000.created_at, day) AS listing__ds__day + , DATETIME_TRUNC(listings_latest_src_28000.created_at, isoweek) AS listing__ds__week + , DATETIME_TRUNC(listings_latest_src_28000.created_at, month) AS listing__ds__month + , DATETIME_TRUNC(listings_latest_src_28000.created_at, quarter) AS listing__ds__quarter + , DATETIME_TRUNC(listings_latest_src_28000.created_at, year) AS listing__ds__year , EXTRACT(year FROM listings_latest_src_28000.created_at) AS listing__ds__extract_year , EXTRACT(quarter FROM listings_latest_src_28000.created_at) AS listing__ds__extract_quarter , EXTRACT(month FROM listings_latest_src_28000.created_at) AS listing__ds__extract_month , EXTRACT(day FROM listings_latest_src_28000.created_at) AS listing__ds__extract_day , IF(EXTRACT(dayofweek FROM listings_latest_src_28000.created_at) = 1, 7, EXTRACT(dayofweek FROM listings_latest_src_28000.created_at) - 1) AS listing__ds__extract_dow , EXTRACT(dayofyear FROM listings_latest_src_28000.created_at) AS listing__ds__extract_doy - , DATE_TRUNC(listings_latest_src_28000.created_at, day) AS listing__created_at__day - , DATE_TRUNC(listings_latest_src_28000.created_at, isoweek) AS listing__created_at__week - , DATE_TRUNC(listings_latest_src_28000.created_at, month) AS listing__created_at__month - , DATE_TRUNC(listings_latest_src_28000.created_at, quarter) AS listing__created_at__quarter - , DATE_TRUNC(listings_latest_src_28000.created_at, year) AS listing__created_at__year + , DATETIME_TRUNC(listings_latest_src_28000.created_at, day) AS listing__created_at__day + , DATETIME_TRUNC(listings_latest_src_28000.created_at, isoweek) AS listing__created_at__week + , DATETIME_TRUNC(listings_latest_src_28000.created_at, month) AS listing__created_at__month + , DATETIME_TRUNC(listings_latest_src_28000.created_at, quarter) AS listing__created_at__quarter + , DATETIME_TRUNC(listings_latest_src_28000.created_at, year) AS listing__created_at__year , EXTRACT(year FROM listings_latest_src_28000.created_at) AS listing__created_at__extract_year , EXTRACT(quarter FROM listings_latest_src_28000.created_at) AS listing__created_at__extract_quarter , EXTRACT(month FROM listings_latest_src_28000.created_at) AS listing__created_at__extract_month diff --git a/tests_metricflow/snapshots/test_metric_filter_rendering.py/SqlQueryPlan/BigQuery/test_inner_query_multi_hop__plan0.sql b/tests_metricflow/snapshots/test_metric_filter_rendering.py/SqlQueryPlan/BigQuery/test_inner_query_multi_hop__plan0.sql index 2cca68ca92..c1ad0fe8a0 100644 --- a/tests_metricflow/snapshots/test_metric_filter_rendering.py/SqlQueryPlan/BigQuery/test_inner_query_multi_hop__plan0.sql +++ b/tests_metricflow/snapshots/test_metric_filter_rendering.py/SqlQueryPlan/BigQuery/test_inner_query_multi_hop__plan0.sql @@ -76,11 +76,11 @@ FROM ( SELECT third_hop_table_src_22000.customer_third_hop_id AS third_hop_count , third_hop_table_src_22000.value - , DATE_TRUNC(third_hop_table_src_22000.third_hop_ds, day) AS third_hop_ds__day - , DATE_TRUNC(third_hop_table_src_22000.third_hop_ds, isoweek) AS third_hop_ds__week - , DATE_TRUNC(third_hop_table_src_22000.third_hop_ds, month) AS third_hop_ds__month - , DATE_TRUNC(third_hop_table_src_22000.third_hop_ds, quarter) AS third_hop_ds__quarter - , DATE_TRUNC(third_hop_table_src_22000.third_hop_ds, year) AS third_hop_ds__year + , DATETIME_TRUNC(third_hop_table_src_22000.third_hop_ds, day) AS third_hop_ds__day + , DATETIME_TRUNC(third_hop_table_src_22000.third_hop_ds, isoweek) AS third_hop_ds__week + , DATETIME_TRUNC(third_hop_table_src_22000.third_hop_ds, month) AS third_hop_ds__month + , DATETIME_TRUNC(third_hop_table_src_22000.third_hop_ds, quarter) AS third_hop_ds__quarter + , DATETIME_TRUNC(third_hop_table_src_22000.third_hop_ds, year) AS third_hop_ds__year , EXTRACT(year FROM third_hop_table_src_22000.third_hop_ds) AS third_hop_ds__extract_year , EXTRACT(quarter FROM third_hop_table_src_22000.third_hop_ds) AS third_hop_ds__extract_quarter , EXTRACT(month FROM third_hop_table_src_22000.third_hop_ds) AS third_hop_ds__extract_month @@ -88,11 +88,11 @@ FROM ( , IF(EXTRACT(dayofweek FROM third_hop_table_src_22000.third_hop_ds) = 1, 7, EXTRACT(dayofweek FROM third_hop_table_src_22000.third_hop_ds) - 1) AS third_hop_ds__extract_dow , EXTRACT(dayofyear FROM third_hop_table_src_22000.third_hop_ds) AS third_hop_ds__extract_doy , third_hop_table_src_22000.value AS customer_third_hop_id__value - , DATE_TRUNC(third_hop_table_src_22000.third_hop_ds, day) AS customer_third_hop_id__third_hop_ds__day - , DATE_TRUNC(third_hop_table_src_22000.third_hop_ds, isoweek) AS customer_third_hop_id__third_hop_ds__week - , DATE_TRUNC(third_hop_table_src_22000.third_hop_ds, month) AS customer_third_hop_id__third_hop_ds__month - , DATE_TRUNC(third_hop_table_src_22000.third_hop_ds, quarter) AS customer_third_hop_id__third_hop_ds__quarter - , DATE_TRUNC(third_hop_table_src_22000.third_hop_ds, year) AS customer_third_hop_id__third_hop_ds__year + , DATETIME_TRUNC(third_hop_table_src_22000.third_hop_ds, day) AS customer_third_hop_id__third_hop_ds__day + , DATETIME_TRUNC(third_hop_table_src_22000.third_hop_ds, isoweek) AS customer_third_hop_id__third_hop_ds__week + , DATETIME_TRUNC(third_hop_table_src_22000.third_hop_ds, month) AS customer_third_hop_id__third_hop_ds__month + , DATETIME_TRUNC(third_hop_table_src_22000.third_hop_ds, quarter) AS customer_third_hop_id__third_hop_ds__quarter + , DATETIME_TRUNC(third_hop_table_src_22000.third_hop_ds, year) AS customer_third_hop_id__third_hop_ds__year , EXTRACT(year FROM third_hop_table_src_22000.third_hop_ds) AS customer_third_hop_id__third_hop_ds__extract_year , EXTRACT(quarter FROM third_hop_table_src_22000.third_hop_ds) AS customer_third_hop_id__third_hop_ds__extract_quarter , EXTRACT(month FROM third_hop_table_src_22000.third_hop_ds) AS customer_third_hop_id__third_hop_ds__extract_month @@ -204,22 +204,22 @@ FROM ( -- Read Elements From Semantic Model 'account_month_txns' SELECT account_month_txns_src_22000.txn_count - , DATE_TRUNC(account_month_txns_src_22000.ds_partitioned, day) AS ds_partitioned__day - , DATE_TRUNC(account_month_txns_src_22000.ds_partitioned, isoweek) AS ds_partitioned__week - , DATE_TRUNC(account_month_txns_src_22000.ds_partitioned, month) AS ds_partitioned__month - , DATE_TRUNC(account_month_txns_src_22000.ds_partitioned, quarter) AS ds_partitioned__quarter - , DATE_TRUNC(account_month_txns_src_22000.ds_partitioned, year) AS ds_partitioned__year + , DATETIME_TRUNC(account_month_txns_src_22000.ds_partitioned, day) AS ds_partitioned__day + , DATETIME_TRUNC(account_month_txns_src_22000.ds_partitioned, isoweek) AS ds_partitioned__week + , DATETIME_TRUNC(account_month_txns_src_22000.ds_partitioned, month) AS ds_partitioned__month + , DATETIME_TRUNC(account_month_txns_src_22000.ds_partitioned, quarter) AS ds_partitioned__quarter + , DATETIME_TRUNC(account_month_txns_src_22000.ds_partitioned, year) AS ds_partitioned__year , EXTRACT(year FROM account_month_txns_src_22000.ds_partitioned) AS ds_partitioned__extract_year , EXTRACT(quarter FROM account_month_txns_src_22000.ds_partitioned) AS ds_partitioned__extract_quarter , EXTRACT(month FROM account_month_txns_src_22000.ds_partitioned) AS ds_partitioned__extract_month , EXTRACT(day FROM account_month_txns_src_22000.ds_partitioned) AS ds_partitioned__extract_day , IF(EXTRACT(dayofweek FROM account_month_txns_src_22000.ds_partitioned) = 1, 7, EXTRACT(dayofweek FROM account_month_txns_src_22000.ds_partitioned) - 1) AS ds_partitioned__extract_dow , EXTRACT(dayofyear FROM account_month_txns_src_22000.ds_partitioned) AS ds_partitioned__extract_doy - , DATE_TRUNC(account_month_txns_src_22000.ds, day) AS ds__day - , DATE_TRUNC(account_month_txns_src_22000.ds, isoweek) AS ds__week - , DATE_TRUNC(account_month_txns_src_22000.ds, month) AS ds__month - , DATE_TRUNC(account_month_txns_src_22000.ds, quarter) AS ds__quarter - , DATE_TRUNC(account_month_txns_src_22000.ds, year) AS ds__year + , DATETIME_TRUNC(account_month_txns_src_22000.ds, day) AS ds__day + , DATETIME_TRUNC(account_month_txns_src_22000.ds, isoweek) AS ds__week + , DATETIME_TRUNC(account_month_txns_src_22000.ds, month) AS ds__month + , DATETIME_TRUNC(account_month_txns_src_22000.ds, quarter) AS ds__quarter + , DATETIME_TRUNC(account_month_txns_src_22000.ds, year) AS ds__year , EXTRACT(year FROM account_month_txns_src_22000.ds) AS ds__extract_year , EXTRACT(quarter FROM account_month_txns_src_22000.ds) AS ds__extract_quarter , EXTRACT(month FROM account_month_txns_src_22000.ds) AS ds__extract_month @@ -227,22 +227,22 @@ FROM ( , IF(EXTRACT(dayofweek FROM account_month_txns_src_22000.ds) = 1, 7, EXTRACT(dayofweek FROM account_month_txns_src_22000.ds) - 1) AS ds__extract_dow , EXTRACT(dayofyear FROM account_month_txns_src_22000.ds) AS ds__extract_doy , account_month_txns_src_22000.account_month - , DATE_TRUNC(account_month_txns_src_22000.ds_partitioned, day) AS account_id__ds_partitioned__day - , DATE_TRUNC(account_month_txns_src_22000.ds_partitioned, isoweek) AS account_id__ds_partitioned__week - , DATE_TRUNC(account_month_txns_src_22000.ds_partitioned, month) AS account_id__ds_partitioned__month - , DATE_TRUNC(account_month_txns_src_22000.ds_partitioned, quarter) AS account_id__ds_partitioned__quarter - , DATE_TRUNC(account_month_txns_src_22000.ds_partitioned, year) AS account_id__ds_partitioned__year + , DATETIME_TRUNC(account_month_txns_src_22000.ds_partitioned, day) AS account_id__ds_partitioned__day + , DATETIME_TRUNC(account_month_txns_src_22000.ds_partitioned, isoweek) AS account_id__ds_partitioned__week + , DATETIME_TRUNC(account_month_txns_src_22000.ds_partitioned, month) AS account_id__ds_partitioned__month + , DATETIME_TRUNC(account_month_txns_src_22000.ds_partitioned, quarter) AS account_id__ds_partitioned__quarter + , DATETIME_TRUNC(account_month_txns_src_22000.ds_partitioned, year) AS account_id__ds_partitioned__year , EXTRACT(year FROM account_month_txns_src_22000.ds_partitioned) AS account_id__ds_partitioned__extract_year , EXTRACT(quarter FROM account_month_txns_src_22000.ds_partitioned) AS account_id__ds_partitioned__extract_quarter , EXTRACT(month FROM account_month_txns_src_22000.ds_partitioned) AS account_id__ds_partitioned__extract_month , EXTRACT(day FROM account_month_txns_src_22000.ds_partitioned) AS account_id__ds_partitioned__extract_day , IF(EXTRACT(dayofweek FROM account_month_txns_src_22000.ds_partitioned) = 1, 7, EXTRACT(dayofweek FROM account_month_txns_src_22000.ds_partitioned) - 1) AS account_id__ds_partitioned__extract_dow , EXTRACT(dayofyear FROM account_month_txns_src_22000.ds_partitioned) AS account_id__ds_partitioned__extract_doy - , DATE_TRUNC(account_month_txns_src_22000.ds, day) AS account_id__ds__day - , DATE_TRUNC(account_month_txns_src_22000.ds, isoweek) AS account_id__ds__week - , DATE_TRUNC(account_month_txns_src_22000.ds, month) AS account_id__ds__month - , DATE_TRUNC(account_month_txns_src_22000.ds, quarter) AS account_id__ds__quarter - , DATE_TRUNC(account_month_txns_src_22000.ds, year) AS account_id__ds__year + , DATETIME_TRUNC(account_month_txns_src_22000.ds, day) AS account_id__ds__day + , DATETIME_TRUNC(account_month_txns_src_22000.ds, isoweek) AS account_id__ds__week + , DATETIME_TRUNC(account_month_txns_src_22000.ds, month) AS account_id__ds__month + , DATETIME_TRUNC(account_month_txns_src_22000.ds, quarter) AS account_id__ds__quarter + , DATETIME_TRUNC(account_month_txns_src_22000.ds, year) AS account_id__ds__year , EXTRACT(year FROM account_month_txns_src_22000.ds) AS account_id__ds__extract_year , EXTRACT(quarter FROM account_month_txns_src_22000.ds) AS account_id__ds__extract_quarter , EXTRACT(month FROM account_month_txns_src_22000.ds) AS account_id__ds__extract_month @@ -415,11 +415,11 @@ FROM ( SELECT account_id || customer_id AS account_customer_combos , bridge_table_src_22000.extra_dim - , DATE_TRUNC(bridge_table_src_22000.ds_partitioned, day) AS ds_partitioned__day - , DATE_TRUNC(bridge_table_src_22000.ds_partitioned, isoweek) AS ds_partitioned__week - , DATE_TRUNC(bridge_table_src_22000.ds_partitioned, month) AS ds_partitioned__month - , DATE_TRUNC(bridge_table_src_22000.ds_partitioned, quarter) AS ds_partitioned__quarter - , DATE_TRUNC(bridge_table_src_22000.ds_partitioned, year) AS ds_partitioned__year + , DATETIME_TRUNC(bridge_table_src_22000.ds_partitioned, day) AS ds_partitioned__day + , DATETIME_TRUNC(bridge_table_src_22000.ds_partitioned, isoweek) AS ds_partitioned__week + , DATETIME_TRUNC(bridge_table_src_22000.ds_partitioned, month) AS ds_partitioned__month + , DATETIME_TRUNC(bridge_table_src_22000.ds_partitioned, quarter) AS ds_partitioned__quarter + , DATETIME_TRUNC(bridge_table_src_22000.ds_partitioned, year) AS ds_partitioned__year , EXTRACT(year FROM bridge_table_src_22000.ds_partitioned) AS ds_partitioned__extract_year , EXTRACT(quarter FROM bridge_table_src_22000.ds_partitioned) AS ds_partitioned__extract_quarter , EXTRACT(month FROM bridge_table_src_22000.ds_partitioned) AS ds_partitioned__extract_month @@ -427,11 +427,11 @@ FROM ( , IF(EXTRACT(dayofweek FROM bridge_table_src_22000.ds_partitioned) = 1, 7, EXTRACT(dayofweek FROM bridge_table_src_22000.ds_partitioned) - 1) AS ds_partitioned__extract_dow , EXTRACT(dayofyear FROM bridge_table_src_22000.ds_partitioned) AS ds_partitioned__extract_doy , bridge_table_src_22000.extra_dim AS account_id__extra_dim - , DATE_TRUNC(bridge_table_src_22000.ds_partitioned, day) AS account_id__ds_partitioned__day - , DATE_TRUNC(bridge_table_src_22000.ds_partitioned, isoweek) AS account_id__ds_partitioned__week - , DATE_TRUNC(bridge_table_src_22000.ds_partitioned, month) AS account_id__ds_partitioned__month - , DATE_TRUNC(bridge_table_src_22000.ds_partitioned, quarter) AS account_id__ds_partitioned__quarter - , DATE_TRUNC(bridge_table_src_22000.ds_partitioned, year) AS account_id__ds_partitioned__year + , DATETIME_TRUNC(bridge_table_src_22000.ds_partitioned, day) AS account_id__ds_partitioned__day + , DATETIME_TRUNC(bridge_table_src_22000.ds_partitioned, isoweek) AS account_id__ds_partitioned__week + , DATETIME_TRUNC(bridge_table_src_22000.ds_partitioned, month) AS account_id__ds_partitioned__month + , DATETIME_TRUNC(bridge_table_src_22000.ds_partitioned, quarter) AS account_id__ds_partitioned__quarter + , DATETIME_TRUNC(bridge_table_src_22000.ds_partitioned, year) AS account_id__ds_partitioned__year , EXTRACT(year FROM bridge_table_src_22000.ds_partitioned) AS account_id__ds_partitioned__extract_year , EXTRACT(quarter FROM bridge_table_src_22000.ds_partitioned) AS account_id__ds_partitioned__extract_quarter , EXTRACT(month FROM bridge_table_src_22000.ds_partitioned) AS account_id__ds_partitioned__extract_month @@ -439,11 +439,11 @@ FROM ( , IF(EXTRACT(dayofweek FROM bridge_table_src_22000.ds_partitioned) = 1, 7, EXTRACT(dayofweek FROM bridge_table_src_22000.ds_partitioned) - 1) AS account_id__ds_partitioned__extract_dow , EXTRACT(dayofyear FROM bridge_table_src_22000.ds_partitioned) AS account_id__ds_partitioned__extract_doy , bridge_table_src_22000.extra_dim AS bridge_account__extra_dim - , DATE_TRUNC(bridge_table_src_22000.ds_partitioned, day) AS bridge_account__ds_partitioned__day - , DATE_TRUNC(bridge_table_src_22000.ds_partitioned, isoweek) AS bridge_account__ds_partitioned__week - , DATE_TRUNC(bridge_table_src_22000.ds_partitioned, month) AS bridge_account__ds_partitioned__month - , DATE_TRUNC(bridge_table_src_22000.ds_partitioned, quarter) AS bridge_account__ds_partitioned__quarter - , DATE_TRUNC(bridge_table_src_22000.ds_partitioned, year) AS bridge_account__ds_partitioned__year + , DATETIME_TRUNC(bridge_table_src_22000.ds_partitioned, day) AS bridge_account__ds_partitioned__day + , DATETIME_TRUNC(bridge_table_src_22000.ds_partitioned, isoweek) AS bridge_account__ds_partitioned__week + , DATETIME_TRUNC(bridge_table_src_22000.ds_partitioned, month) AS bridge_account__ds_partitioned__month + , DATETIME_TRUNC(bridge_table_src_22000.ds_partitioned, quarter) AS bridge_account__ds_partitioned__quarter + , DATETIME_TRUNC(bridge_table_src_22000.ds_partitioned, year) AS bridge_account__ds_partitioned__year , EXTRACT(year FROM bridge_table_src_22000.ds_partitioned) AS bridge_account__ds_partitioned__extract_year , EXTRACT(quarter FROM bridge_table_src_22000.ds_partitioned) AS bridge_account__ds_partitioned__extract_quarter , EXTRACT(month FROM bridge_table_src_22000.ds_partitioned) AS bridge_account__ds_partitioned__extract_month @@ -624,11 +624,11 @@ FROM ( SELECT 1 AS customers_with_other_data , customer_other_data_src_22000.country - , DATE_TRUNC(customer_other_data_src_22000.acquired_ds, day) AS acquired_ds__day - , DATE_TRUNC(customer_other_data_src_22000.acquired_ds, isoweek) AS acquired_ds__week - , DATE_TRUNC(customer_other_data_src_22000.acquired_ds, month) AS acquired_ds__month - , DATE_TRUNC(customer_other_data_src_22000.acquired_ds, quarter) AS acquired_ds__quarter - , DATE_TRUNC(customer_other_data_src_22000.acquired_ds, year) AS acquired_ds__year + , DATETIME_TRUNC(customer_other_data_src_22000.acquired_ds, day) AS acquired_ds__day + , DATETIME_TRUNC(customer_other_data_src_22000.acquired_ds, isoweek) AS acquired_ds__week + , DATETIME_TRUNC(customer_other_data_src_22000.acquired_ds, month) AS acquired_ds__month + , DATETIME_TRUNC(customer_other_data_src_22000.acquired_ds, quarter) AS acquired_ds__quarter + , DATETIME_TRUNC(customer_other_data_src_22000.acquired_ds, year) AS acquired_ds__year , EXTRACT(year FROM customer_other_data_src_22000.acquired_ds) AS acquired_ds__extract_year , EXTRACT(quarter FROM customer_other_data_src_22000.acquired_ds) AS acquired_ds__extract_quarter , EXTRACT(month FROM customer_other_data_src_22000.acquired_ds) AS acquired_ds__extract_month @@ -636,11 +636,11 @@ FROM ( , IF(EXTRACT(dayofweek FROM customer_other_data_src_22000.acquired_ds) = 1, 7, EXTRACT(dayofweek FROM customer_other_data_src_22000.acquired_ds) - 1) AS acquired_ds__extract_dow , EXTRACT(dayofyear FROM customer_other_data_src_22000.acquired_ds) AS acquired_ds__extract_doy , customer_other_data_src_22000.country AS customer_id__country - , DATE_TRUNC(customer_other_data_src_22000.acquired_ds, day) AS customer_id__acquired_ds__day - , DATE_TRUNC(customer_other_data_src_22000.acquired_ds, isoweek) AS customer_id__acquired_ds__week - , DATE_TRUNC(customer_other_data_src_22000.acquired_ds, month) AS customer_id__acquired_ds__month - , DATE_TRUNC(customer_other_data_src_22000.acquired_ds, quarter) AS customer_id__acquired_ds__quarter - , DATE_TRUNC(customer_other_data_src_22000.acquired_ds, year) AS customer_id__acquired_ds__year + , DATETIME_TRUNC(customer_other_data_src_22000.acquired_ds, day) AS customer_id__acquired_ds__day + , DATETIME_TRUNC(customer_other_data_src_22000.acquired_ds, isoweek) AS customer_id__acquired_ds__week + , DATETIME_TRUNC(customer_other_data_src_22000.acquired_ds, month) AS customer_id__acquired_ds__month + , DATETIME_TRUNC(customer_other_data_src_22000.acquired_ds, quarter) AS customer_id__acquired_ds__quarter + , DATETIME_TRUNC(customer_other_data_src_22000.acquired_ds, year) AS customer_id__acquired_ds__year , EXTRACT(year FROM customer_other_data_src_22000.acquired_ds) AS customer_id__acquired_ds__extract_year , EXTRACT(quarter FROM customer_other_data_src_22000.acquired_ds) AS customer_id__acquired_ds__extract_quarter , EXTRACT(month FROM customer_other_data_src_22000.acquired_ds) AS customer_id__acquired_ds__extract_month @@ -648,11 +648,11 @@ FROM ( , IF(EXTRACT(dayofweek FROM customer_other_data_src_22000.acquired_ds) = 1, 7, EXTRACT(dayofweek FROM customer_other_data_src_22000.acquired_ds) - 1) AS customer_id__acquired_ds__extract_dow , EXTRACT(dayofyear FROM customer_other_data_src_22000.acquired_ds) AS customer_id__acquired_ds__extract_doy , customer_other_data_src_22000.country AS customer_third_hop_id__country - , DATE_TRUNC(customer_other_data_src_22000.acquired_ds, day) AS customer_third_hop_id__acquired_ds__day - , DATE_TRUNC(customer_other_data_src_22000.acquired_ds, isoweek) AS customer_third_hop_id__acquired_ds__week - , DATE_TRUNC(customer_other_data_src_22000.acquired_ds, month) AS customer_third_hop_id__acquired_ds__month - , DATE_TRUNC(customer_other_data_src_22000.acquired_ds, quarter) AS customer_third_hop_id__acquired_ds__quarter - , DATE_TRUNC(customer_other_data_src_22000.acquired_ds, year) AS customer_third_hop_id__acquired_ds__year + , DATETIME_TRUNC(customer_other_data_src_22000.acquired_ds, day) AS customer_third_hop_id__acquired_ds__day + , DATETIME_TRUNC(customer_other_data_src_22000.acquired_ds, isoweek) AS customer_third_hop_id__acquired_ds__week + , DATETIME_TRUNC(customer_other_data_src_22000.acquired_ds, month) AS customer_third_hop_id__acquired_ds__month + , DATETIME_TRUNC(customer_other_data_src_22000.acquired_ds, quarter) AS customer_third_hop_id__acquired_ds__quarter + , DATETIME_TRUNC(customer_other_data_src_22000.acquired_ds, year) AS customer_third_hop_id__acquired_ds__year , EXTRACT(year FROM customer_other_data_src_22000.acquired_ds) AS customer_third_hop_id__acquired_ds__extract_year , EXTRACT(quarter FROM customer_other_data_src_22000.acquired_ds) AS customer_third_hop_id__acquired_ds__extract_quarter , EXTRACT(month FROM customer_other_data_src_22000.acquired_ds) AS customer_third_hop_id__acquired_ds__extract_month diff --git a/tests_metricflow/snapshots/test_metric_filter_rendering.py/SqlQueryPlan/BigQuery/test_inner_query_multi_hop__plan0_optimized.sql b/tests_metricflow/snapshots/test_metric_filter_rendering.py/SqlQueryPlan/BigQuery/test_inner_query_multi_hop__plan0_optimized.sql index 256af26325..94e352c575 100644 --- a/tests_metricflow/snapshots/test_metric_filter_rendering.py/SqlQueryPlan/BigQuery/test_inner_query_multi_hop__plan0_optimized.sql +++ b/tests_metricflow/snapshots/test_metric_filter_rendering.py/SqlQueryPlan/BigQuery/test_inner_query_multi_hop__plan0_optimized.sql @@ -25,7 +25,7 @@ FROM ( -- Join Standard Outputs -- Pass Only Elements: ['ds_partitioned__day', 'account_id', 'customer_id__customer_third_hop_id'] SELECT - DATE_TRUNC(bridge_table_src_22000.ds_partitioned, day) AS ds_partitioned__day + DATETIME_TRUNC(bridge_table_src_22000.ds_partitioned, day) AS ds_partitioned__day , bridge_table_src_22000.account_id AS account_id , customer_other_data_src_22000.customer_third_hop_id AS customer_id__customer_third_hop_id FROM ***************************.bridge_table bridge_table_src_22000 @@ -38,7 +38,7 @@ FROM ( ( account_month_txns_src_22000.account_id = subq_53.account_id ) AND ( - DATE_TRUNC(account_month_txns_src_22000.ds_partitioned, day) = subq_53.ds_partitioned__day + DATETIME_TRUNC(account_month_txns_src_22000.ds_partitioned, day) = subq_53.ds_partitioned__day ) GROUP BY account_id__customer_id__customer_third_hop_id diff --git a/tests_metricflow/snapshots/test_metric_filter_rendering.py/SqlQueryPlan/BigQuery/test_inner_query_single_hop__plan0.sql b/tests_metricflow/snapshots/test_metric_filter_rendering.py/SqlQueryPlan/BigQuery/test_inner_query_single_hop__plan0.sql index 153ad50485..545abe7b6a 100644 --- a/tests_metricflow/snapshots/test_metric_filter_rendering.py/SqlQueryPlan/BigQuery/test_inner_query_single_hop__plan0.sql +++ b/tests_metricflow/snapshots/test_metric_filter_rendering.py/SqlQueryPlan/BigQuery/test_inner_query_single_hop__plan0.sql @@ -76,11 +76,11 @@ FROM ( SELECT third_hop_table_src_22000.customer_third_hop_id AS third_hop_count , third_hop_table_src_22000.value - , DATE_TRUNC(third_hop_table_src_22000.third_hop_ds, day) AS third_hop_ds__day - , DATE_TRUNC(third_hop_table_src_22000.third_hop_ds, isoweek) AS third_hop_ds__week - , DATE_TRUNC(third_hop_table_src_22000.third_hop_ds, month) AS third_hop_ds__month - , DATE_TRUNC(third_hop_table_src_22000.third_hop_ds, quarter) AS third_hop_ds__quarter - , DATE_TRUNC(third_hop_table_src_22000.third_hop_ds, year) AS third_hop_ds__year + , DATETIME_TRUNC(third_hop_table_src_22000.third_hop_ds, day) AS third_hop_ds__day + , DATETIME_TRUNC(third_hop_table_src_22000.third_hop_ds, isoweek) AS third_hop_ds__week + , DATETIME_TRUNC(third_hop_table_src_22000.third_hop_ds, month) AS third_hop_ds__month + , DATETIME_TRUNC(third_hop_table_src_22000.third_hop_ds, quarter) AS third_hop_ds__quarter + , DATETIME_TRUNC(third_hop_table_src_22000.third_hop_ds, year) AS third_hop_ds__year , EXTRACT(year FROM third_hop_table_src_22000.third_hop_ds) AS third_hop_ds__extract_year , EXTRACT(quarter FROM third_hop_table_src_22000.third_hop_ds) AS third_hop_ds__extract_quarter , EXTRACT(month FROM third_hop_table_src_22000.third_hop_ds) AS third_hop_ds__extract_month @@ -88,11 +88,11 @@ FROM ( , IF(EXTRACT(dayofweek FROM third_hop_table_src_22000.third_hop_ds) = 1, 7, EXTRACT(dayofweek FROM third_hop_table_src_22000.third_hop_ds) - 1) AS third_hop_ds__extract_dow , EXTRACT(dayofyear FROM third_hop_table_src_22000.third_hop_ds) AS third_hop_ds__extract_doy , third_hop_table_src_22000.value AS customer_third_hop_id__value - , DATE_TRUNC(third_hop_table_src_22000.third_hop_ds, day) AS customer_third_hop_id__third_hop_ds__day - , DATE_TRUNC(third_hop_table_src_22000.third_hop_ds, isoweek) AS customer_third_hop_id__third_hop_ds__week - , DATE_TRUNC(third_hop_table_src_22000.third_hop_ds, month) AS customer_third_hop_id__third_hop_ds__month - , DATE_TRUNC(third_hop_table_src_22000.third_hop_ds, quarter) AS customer_third_hop_id__third_hop_ds__quarter - , DATE_TRUNC(third_hop_table_src_22000.third_hop_ds, year) AS customer_third_hop_id__third_hop_ds__year + , DATETIME_TRUNC(third_hop_table_src_22000.third_hop_ds, day) AS customer_third_hop_id__third_hop_ds__day + , DATETIME_TRUNC(third_hop_table_src_22000.third_hop_ds, isoweek) AS customer_third_hop_id__third_hop_ds__week + , DATETIME_TRUNC(third_hop_table_src_22000.third_hop_ds, month) AS customer_third_hop_id__third_hop_ds__month + , DATETIME_TRUNC(third_hop_table_src_22000.third_hop_ds, quarter) AS customer_third_hop_id__third_hop_ds__quarter + , DATETIME_TRUNC(third_hop_table_src_22000.third_hop_ds, year) AS customer_third_hop_id__third_hop_ds__year , EXTRACT(year FROM third_hop_table_src_22000.third_hop_ds) AS customer_third_hop_id__third_hop_ds__extract_year , EXTRACT(quarter FROM third_hop_table_src_22000.third_hop_ds) AS customer_third_hop_id__third_hop_ds__extract_quarter , EXTRACT(month FROM third_hop_table_src_22000.third_hop_ds) AS customer_third_hop_id__third_hop_ds__extract_month @@ -196,11 +196,11 @@ FROM ( SELECT 1 AS customers_with_other_data , customer_other_data_src_22000.country - , DATE_TRUNC(customer_other_data_src_22000.acquired_ds, day) AS acquired_ds__day - , DATE_TRUNC(customer_other_data_src_22000.acquired_ds, isoweek) AS acquired_ds__week - , DATE_TRUNC(customer_other_data_src_22000.acquired_ds, month) AS acquired_ds__month - , DATE_TRUNC(customer_other_data_src_22000.acquired_ds, quarter) AS acquired_ds__quarter - , DATE_TRUNC(customer_other_data_src_22000.acquired_ds, year) AS acquired_ds__year + , DATETIME_TRUNC(customer_other_data_src_22000.acquired_ds, day) AS acquired_ds__day + , DATETIME_TRUNC(customer_other_data_src_22000.acquired_ds, isoweek) AS acquired_ds__week + , DATETIME_TRUNC(customer_other_data_src_22000.acquired_ds, month) AS acquired_ds__month + , DATETIME_TRUNC(customer_other_data_src_22000.acquired_ds, quarter) AS acquired_ds__quarter + , DATETIME_TRUNC(customer_other_data_src_22000.acquired_ds, year) AS acquired_ds__year , EXTRACT(year FROM customer_other_data_src_22000.acquired_ds) AS acquired_ds__extract_year , EXTRACT(quarter FROM customer_other_data_src_22000.acquired_ds) AS acquired_ds__extract_quarter , EXTRACT(month FROM customer_other_data_src_22000.acquired_ds) AS acquired_ds__extract_month @@ -208,11 +208,11 @@ FROM ( , IF(EXTRACT(dayofweek FROM customer_other_data_src_22000.acquired_ds) = 1, 7, EXTRACT(dayofweek FROM customer_other_data_src_22000.acquired_ds) - 1) AS acquired_ds__extract_dow , EXTRACT(dayofyear FROM customer_other_data_src_22000.acquired_ds) AS acquired_ds__extract_doy , customer_other_data_src_22000.country AS customer_id__country - , DATE_TRUNC(customer_other_data_src_22000.acquired_ds, day) AS customer_id__acquired_ds__day - , DATE_TRUNC(customer_other_data_src_22000.acquired_ds, isoweek) AS customer_id__acquired_ds__week - , DATE_TRUNC(customer_other_data_src_22000.acquired_ds, month) AS customer_id__acquired_ds__month - , DATE_TRUNC(customer_other_data_src_22000.acquired_ds, quarter) AS customer_id__acquired_ds__quarter - , DATE_TRUNC(customer_other_data_src_22000.acquired_ds, year) AS customer_id__acquired_ds__year + , DATETIME_TRUNC(customer_other_data_src_22000.acquired_ds, day) AS customer_id__acquired_ds__day + , DATETIME_TRUNC(customer_other_data_src_22000.acquired_ds, isoweek) AS customer_id__acquired_ds__week + , DATETIME_TRUNC(customer_other_data_src_22000.acquired_ds, month) AS customer_id__acquired_ds__month + , DATETIME_TRUNC(customer_other_data_src_22000.acquired_ds, quarter) AS customer_id__acquired_ds__quarter + , DATETIME_TRUNC(customer_other_data_src_22000.acquired_ds, year) AS customer_id__acquired_ds__year , EXTRACT(year FROM customer_other_data_src_22000.acquired_ds) AS customer_id__acquired_ds__extract_year , EXTRACT(quarter FROM customer_other_data_src_22000.acquired_ds) AS customer_id__acquired_ds__extract_quarter , EXTRACT(month FROM customer_other_data_src_22000.acquired_ds) AS customer_id__acquired_ds__extract_month @@ -220,11 +220,11 @@ FROM ( , IF(EXTRACT(dayofweek FROM customer_other_data_src_22000.acquired_ds) = 1, 7, EXTRACT(dayofweek FROM customer_other_data_src_22000.acquired_ds) - 1) AS customer_id__acquired_ds__extract_dow , EXTRACT(dayofyear FROM customer_other_data_src_22000.acquired_ds) AS customer_id__acquired_ds__extract_doy , customer_other_data_src_22000.country AS customer_third_hop_id__country - , DATE_TRUNC(customer_other_data_src_22000.acquired_ds, day) AS customer_third_hop_id__acquired_ds__day - , DATE_TRUNC(customer_other_data_src_22000.acquired_ds, isoweek) AS customer_third_hop_id__acquired_ds__week - , DATE_TRUNC(customer_other_data_src_22000.acquired_ds, month) AS customer_third_hop_id__acquired_ds__month - , DATE_TRUNC(customer_other_data_src_22000.acquired_ds, quarter) AS customer_third_hop_id__acquired_ds__quarter - , DATE_TRUNC(customer_other_data_src_22000.acquired_ds, year) AS customer_third_hop_id__acquired_ds__year + , DATETIME_TRUNC(customer_other_data_src_22000.acquired_ds, day) AS customer_third_hop_id__acquired_ds__day + , DATETIME_TRUNC(customer_other_data_src_22000.acquired_ds, isoweek) AS customer_third_hop_id__acquired_ds__week + , DATETIME_TRUNC(customer_other_data_src_22000.acquired_ds, month) AS customer_third_hop_id__acquired_ds__month + , DATETIME_TRUNC(customer_other_data_src_22000.acquired_ds, quarter) AS customer_third_hop_id__acquired_ds__quarter + , DATETIME_TRUNC(customer_other_data_src_22000.acquired_ds, year) AS customer_third_hop_id__acquired_ds__year , EXTRACT(year FROM customer_other_data_src_22000.acquired_ds) AS customer_third_hop_id__acquired_ds__extract_year , EXTRACT(quarter FROM customer_other_data_src_22000.acquired_ds) AS customer_third_hop_id__acquired_ds__extract_quarter , EXTRACT(month FROM customer_other_data_src_22000.acquired_ds) AS customer_third_hop_id__acquired_ds__extract_month diff --git a/tests_metricflow/snapshots/test_metric_filter_rendering.py/SqlQueryPlan/BigQuery/test_metric_filtered_by_itself__plan0.sql b/tests_metricflow/snapshots/test_metric_filter_rendering.py/SqlQueryPlan/BigQuery/test_metric_filtered_by_itself__plan0.sql index cc551ee5ef..dc6e302472 100644 --- a/tests_metricflow/snapshots/test_metric_filter_rendering.py/SqlQueryPlan/BigQuery/test_metric_filtered_by_itself__plan0.sql +++ b/tests_metricflow/snapshots/test_metric_filter_rendering.py/SqlQueryPlan/BigQuery/test_metric_filtered_by_itself__plan0.sql @@ -149,33 +149,33 @@ FROM ( , bookings_source_src_28000.booking_value AS approximate_continuous_booking_value_p99 , bookings_source_src_28000.booking_value AS approximate_discrete_booking_value_p99 , bookings_source_src_28000.is_instant - , DATE_TRUNC(bookings_source_src_28000.ds, day) AS ds__day - , DATE_TRUNC(bookings_source_src_28000.ds, isoweek) AS ds__week - , DATE_TRUNC(bookings_source_src_28000.ds, month) AS ds__month - , DATE_TRUNC(bookings_source_src_28000.ds, quarter) AS ds__quarter - , DATE_TRUNC(bookings_source_src_28000.ds, year) AS ds__year + , DATETIME_TRUNC(bookings_source_src_28000.ds, day) AS ds__day + , DATETIME_TRUNC(bookings_source_src_28000.ds, isoweek) AS ds__week + , DATETIME_TRUNC(bookings_source_src_28000.ds, month) AS ds__month + , DATETIME_TRUNC(bookings_source_src_28000.ds, quarter) AS ds__quarter + , DATETIME_TRUNC(bookings_source_src_28000.ds, year) AS ds__year , EXTRACT(year FROM bookings_source_src_28000.ds) AS ds__extract_year , EXTRACT(quarter FROM bookings_source_src_28000.ds) AS ds__extract_quarter , EXTRACT(month FROM bookings_source_src_28000.ds) AS ds__extract_month , EXTRACT(day FROM bookings_source_src_28000.ds) AS ds__extract_day , IF(EXTRACT(dayofweek FROM bookings_source_src_28000.ds) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_28000.ds) - 1) AS ds__extract_dow , EXTRACT(dayofyear FROM bookings_source_src_28000.ds) AS ds__extract_doy - , DATE_TRUNC(bookings_source_src_28000.ds_partitioned, day) AS ds_partitioned__day - , DATE_TRUNC(bookings_source_src_28000.ds_partitioned, isoweek) AS ds_partitioned__week - , DATE_TRUNC(bookings_source_src_28000.ds_partitioned, month) AS ds_partitioned__month - , DATE_TRUNC(bookings_source_src_28000.ds_partitioned, quarter) AS ds_partitioned__quarter - , DATE_TRUNC(bookings_source_src_28000.ds_partitioned, year) AS ds_partitioned__year + , DATETIME_TRUNC(bookings_source_src_28000.ds_partitioned, day) AS ds_partitioned__day + , DATETIME_TRUNC(bookings_source_src_28000.ds_partitioned, isoweek) AS ds_partitioned__week + , DATETIME_TRUNC(bookings_source_src_28000.ds_partitioned, month) AS ds_partitioned__month + , DATETIME_TRUNC(bookings_source_src_28000.ds_partitioned, quarter) AS ds_partitioned__quarter + , DATETIME_TRUNC(bookings_source_src_28000.ds_partitioned, year) AS ds_partitioned__year , EXTRACT(year FROM bookings_source_src_28000.ds_partitioned) AS ds_partitioned__extract_year , EXTRACT(quarter FROM bookings_source_src_28000.ds_partitioned) AS ds_partitioned__extract_quarter , EXTRACT(month FROM bookings_source_src_28000.ds_partitioned) AS ds_partitioned__extract_month , EXTRACT(day FROM bookings_source_src_28000.ds_partitioned) AS ds_partitioned__extract_day , IF(EXTRACT(dayofweek FROM bookings_source_src_28000.ds_partitioned) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_28000.ds_partitioned) - 1) AS ds_partitioned__extract_dow , EXTRACT(dayofyear FROM bookings_source_src_28000.ds_partitioned) AS ds_partitioned__extract_doy - , DATE_TRUNC(bookings_source_src_28000.paid_at, day) AS paid_at__day - , DATE_TRUNC(bookings_source_src_28000.paid_at, isoweek) AS paid_at__week - , DATE_TRUNC(bookings_source_src_28000.paid_at, month) AS paid_at__month - , DATE_TRUNC(bookings_source_src_28000.paid_at, quarter) AS paid_at__quarter - , DATE_TRUNC(bookings_source_src_28000.paid_at, year) AS paid_at__year + , DATETIME_TRUNC(bookings_source_src_28000.paid_at, day) AS paid_at__day + , DATETIME_TRUNC(bookings_source_src_28000.paid_at, isoweek) AS paid_at__week + , DATETIME_TRUNC(bookings_source_src_28000.paid_at, month) AS paid_at__month + , DATETIME_TRUNC(bookings_source_src_28000.paid_at, quarter) AS paid_at__quarter + , DATETIME_TRUNC(bookings_source_src_28000.paid_at, year) AS paid_at__year , EXTRACT(year FROM bookings_source_src_28000.paid_at) AS paid_at__extract_year , EXTRACT(quarter FROM bookings_source_src_28000.paid_at) AS paid_at__extract_quarter , EXTRACT(month FROM bookings_source_src_28000.paid_at) AS paid_at__extract_month @@ -183,33 +183,33 @@ FROM ( , IF(EXTRACT(dayofweek FROM bookings_source_src_28000.paid_at) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_28000.paid_at) - 1) AS paid_at__extract_dow , EXTRACT(dayofyear FROM bookings_source_src_28000.paid_at) AS paid_at__extract_doy , bookings_source_src_28000.is_instant AS booking__is_instant - , DATE_TRUNC(bookings_source_src_28000.ds, day) AS booking__ds__day - , DATE_TRUNC(bookings_source_src_28000.ds, isoweek) AS booking__ds__week - , DATE_TRUNC(bookings_source_src_28000.ds, month) AS booking__ds__month - , DATE_TRUNC(bookings_source_src_28000.ds, quarter) AS booking__ds__quarter - , DATE_TRUNC(bookings_source_src_28000.ds, year) AS booking__ds__year + , DATETIME_TRUNC(bookings_source_src_28000.ds, day) AS booking__ds__day + , DATETIME_TRUNC(bookings_source_src_28000.ds, isoweek) AS booking__ds__week + , DATETIME_TRUNC(bookings_source_src_28000.ds, month) AS booking__ds__month + , DATETIME_TRUNC(bookings_source_src_28000.ds, quarter) AS booking__ds__quarter + , DATETIME_TRUNC(bookings_source_src_28000.ds, year) AS booking__ds__year , EXTRACT(year FROM bookings_source_src_28000.ds) AS booking__ds__extract_year , EXTRACT(quarter FROM bookings_source_src_28000.ds) AS booking__ds__extract_quarter , EXTRACT(month FROM bookings_source_src_28000.ds) AS booking__ds__extract_month , EXTRACT(day FROM bookings_source_src_28000.ds) AS booking__ds__extract_day , IF(EXTRACT(dayofweek FROM bookings_source_src_28000.ds) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_28000.ds) - 1) AS booking__ds__extract_dow , EXTRACT(dayofyear FROM bookings_source_src_28000.ds) AS booking__ds__extract_doy - , DATE_TRUNC(bookings_source_src_28000.ds_partitioned, day) AS booking__ds_partitioned__day - , DATE_TRUNC(bookings_source_src_28000.ds_partitioned, isoweek) AS booking__ds_partitioned__week - , DATE_TRUNC(bookings_source_src_28000.ds_partitioned, month) AS booking__ds_partitioned__month - , DATE_TRUNC(bookings_source_src_28000.ds_partitioned, quarter) AS booking__ds_partitioned__quarter - , DATE_TRUNC(bookings_source_src_28000.ds_partitioned, year) AS booking__ds_partitioned__year + , DATETIME_TRUNC(bookings_source_src_28000.ds_partitioned, day) AS booking__ds_partitioned__day + , DATETIME_TRUNC(bookings_source_src_28000.ds_partitioned, isoweek) AS booking__ds_partitioned__week + , DATETIME_TRUNC(bookings_source_src_28000.ds_partitioned, month) AS booking__ds_partitioned__month + , DATETIME_TRUNC(bookings_source_src_28000.ds_partitioned, quarter) AS booking__ds_partitioned__quarter + , DATETIME_TRUNC(bookings_source_src_28000.ds_partitioned, year) AS booking__ds_partitioned__year , EXTRACT(year FROM bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__extract_year , EXTRACT(quarter FROM bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__extract_quarter , EXTRACT(month FROM bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__extract_month , EXTRACT(day FROM bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__extract_day , IF(EXTRACT(dayofweek FROM bookings_source_src_28000.ds_partitioned) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_28000.ds_partitioned) - 1) AS booking__ds_partitioned__extract_dow , EXTRACT(dayofyear FROM bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__extract_doy - , DATE_TRUNC(bookings_source_src_28000.paid_at, day) AS booking__paid_at__day - , DATE_TRUNC(bookings_source_src_28000.paid_at, isoweek) AS booking__paid_at__week - , DATE_TRUNC(bookings_source_src_28000.paid_at, month) AS booking__paid_at__month - , DATE_TRUNC(bookings_source_src_28000.paid_at, quarter) AS booking__paid_at__quarter - , DATE_TRUNC(bookings_source_src_28000.paid_at, year) AS booking__paid_at__year + , DATETIME_TRUNC(bookings_source_src_28000.paid_at, day) AS booking__paid_at__day + , DATETIME_TRUNC(bookings_source_src_28000.paid_at, isoweek) AS booking__paid_at__week + , DATETIME_TRUNC(bookings_source_src_28000.paid_at, month) AS booking__paid_at__month + , DATETIME_TRUNC(bookings_source_src_28000.paid_at, quarter) AS booking__paid_at__quarter + , DATETIME_TRUNC(bookings_source_src_28000.paid_at, year) AS booking__paid_at__year , EXTRACT(year FROM bookings_source_src_28000.paid_at) AS booking__paid_at__extract_year , EXTRACT(quarter FROM bookings_source_src_28000.paid_at) AS booking__paid_at__extract_quarter , EXTRACT(month FROM bookings_source_src_28000.paid_at) AS booking__paid_at__extract_month @@ -365,33 +365,33 @@ FROM ( , bookings_source_src_28000.booking_value AS approximate_continuous_booking_value_p99 , bookings_source_src_28000.booking_value AS approximate_discrete_booking_value_p99 , bookings_source_src_28000.is_instant - , DATE_TRUNC(bookings_source_src_28000.ds, day) AS ds__day - , DATE_TRUNC(bookings_source_src_28000.ds, isoweek) AS ds__week - , DATE_TRUNC(bookings_source_src_28000.ds, month) AS ds__month - , DATE_TRUNC(bookings_source_src_28000.ds, quarter) AS ds__quarter - , DATE_TRUNC(bookings_source_src_28000.ds, year) AS ds__year + , DATETIME_TRUNC(bookings_source_src_28000.ds, day) AS ds__day + , DATETIME_TRUNC(bookings_source_src_28000.ds, isoweek) AS ds__week + , DATETIME_TRUNC(bookings_source_src_28000.ds, month) AS ds__month + , DATETIME_TRUNC(bookings_source_src_28000.ds, quarter) AS ds__quarter + , DATETIME_TRUNC(bookings_source_src_28000.ds, year) AS ds__year , EXTRACT(year FROM bookings_source_src_28000.ds) AS ds__extract_year , EXTRACT(quarter FROM bookings_source_src_28000.ds) AS ds__extract_quarter , EXTRACT(month FROM bookings_source_src_28000.ds) AS ds__extract_month , EXTRACT(day FROM bookings_source_src_28000.ds) AS ds__extract_day , IF(EXTRACT(dayofweek FROM bookings_source_src_28000.ds) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_28000.ds) - 1) AS ds__extract_dow , EXTRACT(dayofyear FROM bookings_source_src_28000.ds) AS ds__extract_doy - , DATE_TRUNC(bookings_source_src_28000.ds_partitioned, day) AS ds_partitioned__day - , DATE_TRUNC(bookings_source_src_28000.ds_partitioned, isoweek) AS ds_partitioned__week - , DATE_TRUNC(bookings_source_src_28000.ds_partitioned, month) AS ds_partitioned__month - , DATE_TRUNC(bookings_source_src_28000.ds_partitioned, quarter) AS ds_partitioned__quarter - , DATE_TRUNC(bookings_source_src_28000.ds_partitioned, year) AS ds_partitioned__year + , DATETIME_TRUNC(bookings_source_src_28000.ds_partitioned, day) AS ds_partitioned__day + , DATETIME_TRUNC(bookings_source_src_28000.ds_partitioned, isoweek) AS ds_partitioned__week + , DATETIME_TRUNC(bookings_source_src_28000.ds_partitioned, month) AS ds_partitioned__month + , DATETIME_TRUNC(bookings_source_src_28000.ds_partitioned, quarter) AS ds_partitioned__quarter + , DATETIME_TRUNC(bookings_source_src_28000.ds_partitioned, year) AS ds_partitioned__year , EXTRACT(year FROM bookings_source_src_28000.ds_partitioned) AS ds_partitioned__extract_year , EXTRACT(quarter FROM bookings_source_src_28000.ds_partitioned) AS ds_partitioned__extract_quarter , EXTRACT(month FROM bookings_source_src_28000.ds_partitioned) AS ds_partitioned__extract_month , EXTRACT(day FROM bookings_source_src_28000.ds_partitioned) AS ds_partitioned__extract_day , IF(EXTRACT(dayofweek FROM bookings_source_src_28000.ds_partitioned) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_28000.ds_partitioned) - 1) AS ds_partitioned__extract_dow , EXTRACT(dayofyear FROM bookings_source_src_28000.ds_partitioned) AS ds_partitioned__extract_doy - , DATE_TRUNC(bookings_source_src_28000.paid_at, day) AS paid_at__day - , DATE_TRUNC(bookings_source_src_28000.paid_at, isoweek) AS paid_at__week - , DATE_TRUNC(bookings_source_src_28000.paid_at, month) AS paid_at__month - , DATE_TRUNC(bookings_source_src_28000.paid_at, quarter) AS paid_at__quarter - , DATE_TRUNC(bookings_source_src_28000.paid_at, year) AS paid_at__year + , DATETIME_TRUNC(bookings_source_src_28000.paid_at, day) AS paid_at__day + , DATETIME_TRUNC(bookings_source_src_28000.paid_at, isoweek) AS paid_at__week + , DATETIME_TRUNC(bookings_source_src_28000.paid_at, month) AS paid_at__month + , DATETIME_TRUNC(bookings_source_src_28000.paid_at, quarter) AS paid_at__quarter + , DATETIME_TRUNC(bookings_source_src_28000.paid_at, year) AS paid_at__year , EXTRACT(year FROM bookings_source_src_28000.paid_at) AS paid_at__extract_year , EXTRACT(quarter FROM bookings_source_src_28000.paid_at) AS paid_at__extract_quarter , EXTRACT(month FROM bookings_source_src_28000.paid_at) AS paid_at__extract_month @@ -399,33 +399,33 @@ FROM ( , IF(EXTRACT(dayofweek FROM bookings_source_src_28000.paid_at) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_28000.paid_at) - 1) AS paid_at__extract_dow , EXTRACT(dayofyear FROM bookings_source_src_28000.paid_at) AS paid_at__extract_doy , bookings_source_src_28000.is_instant AS booking__is_instant - , DATE_TRUNC(bookings_source_src_28000.ds, day) AS booking__ds__day - , DATE_TRUNC(bookings_source_src_28000.ds, isoweek) AS booking__ds__week - , DATE_TRUNC(bookings_source_src_28000.ds, month) AS booking__ds__month - , DATE_TRUNC(bookings_source_src_28000.ds, quarter) AS booking__ds__quarter - , DATE_TRUNC(bookings_source_src_28000.ds, year) AS booking__ds__year + , DATETIME_TRUNC(bookings_source_src_28000.ds, day) AS booking__ds__day + , DATETIME_TRUNC(bookings_source_src_28000.ds, isoweek) AS booking__ds__week + , DATETIME_TRUNC(bookings_source_src_28000.ds, month) AS booking__ds__month + , DATETIME_TRUNC(bookings_source_src_28000.ds, quarter) AS booking__ds__quarter + , DATETIME_TRUNC(bookings_source_src_28000.ds, year) AS booking__ds__year , EXTRACT(year FROM bookings_source_src_28000.ds) AS booking__ds__extract_year , EXTRACT(quarter FROM bookings_source_src_28000.ds) AS booking__ds__extract_quarter , EXTRACT(month FROM bookings_source_src_28000.ds) AS booking__ds__extract_month , EXTRACT(day FROM bookings_source_src_28000.ds) AS booking__ds__extract_day , IF(EXTRACT(dayofweek FROM bookings_source_src_28000.ds) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_28000.ds) - 1) AS booking__ds__extract_dow , EXTRACT(dayofyear FROM bookings_source_src_28000.ds) AS booking__ds__extract_doy - , DATE_TRUNC(bookings_source_src_28000.ds_partitioned, day) AS booking__ds_partitioned__day - , DATE_TRUNC(bookings_source_src_28000.ds_partitioned, isoweek) AS booking__ds_partitioned__week - , DATE_TRUNC(bookings_source_src_28000.ds_partitioned, month) AS booking__ds_partitioned__month - , DATE_TRUNC(bookings_source_src_28000.ds_partitioned, quarter) AS booking__ds_partitioned__quarter - , DATE_TRUNC(bookings_source_src_28000.ds_partitioned, year) AS booking__ds_partitioned__year + , DATETIME_TRUNC(bookings_source_src_28000.ds_partitioned, day) AS booking__ds_partitioned__day + , DATETIME_TRUNC(bookings_source_src_28000.ds_partitioned, isoweek) AS booking__ds_partitioned__week + , DATETIME_TRUNC(bookings_source_src_28000.ds_partitioned, month) AS booking__ds_partitioned__month + , DATETIME_TRUNC(bookings_source_src_28000.ds_partitioned, quarter) AS booking__ds_partitioned__quarter + , DATETIME_TRUNC(bookings_source_src_28000.ds_partitioned, year) AS booking__ds_partitioned__year , EXTRACT(year FROM bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__extract_year , EXTRACT(quarter FROM bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__extract_quarter , EXTRACT(month FROM bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__extract_month , EXTRACT(day FROM bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__extract_day , IF(EXTRACT(dayofweek FROM bookings_source_src_28000.ds_partitioned) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_28000.ds_partitioned) - 1) AS booking__ds_partitioned__extract_dow , EXTRACT(dayofyear FROM bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__extract_doy - , DATE_TRUNC(bookings_source_src_28000.paid_at, day) AS booking__paid_at__day - , DATE_TRUNC(bookings_source_src_28000.paid_at, isoweek) AS booking__paid_at__week - , DATE_TRUNC(bookings_source_src_28000.paid_at, month) AS booking__paid_at__month - , DATE_TRUNC(bookings_source_src_28000.paid_at, quarter) AS booking__paid_at__quarter - , DATE_TRUNC(bookings_source_src_28000.paid_at, year) AS booking__paid_at__year + , DATETIME_TRUNC(bookings_source_src_28000.paid_at, day) AS booking__paid_at__day + , DATETIME_TRUNC(bookings_source_src_28000.paid_at, isoweek) AS booking__paid_at__week + , DATETIME_TRUNC(bookings_source_src_28000.paid_at, month) AS booking__paid_at__month + , DATETIME_TRUNC(bookings_source_src_28000.paid_at, quarter) AS booking__paid_at__quarter + , DATETIME_TRUNC(bookings_source_src_28000.paid_at, year) AS booking__paid_at__year , EXTRACT(year FROM bookings_source_src_28000.paid_at) AS booking__paid_at__extract_year , EXTRACT(quarter FROM bookings_source_src_28000.paid_at) AS booking__paid_at__extract_quarter , EXTRACT(month FROM bookings_source_src_28000.paid_at) AS booking__paid_at__extract_month diff --git a/tests_metricflow/snapshots/test_metric_filter_rendering.py/SqlQueryPlan/BigQuery/test_metric_with_metric_in_where_filter__plan0.sql b/tests_metricflow/snapshots/test_metric_filter_rendering.py/SqlQueryPlan/BigQuery/test_metric_with_metric_in_where_filter__plan0.sql index 4cc263457c..ee56995360 100644 --- a/tests_metricflow/snapshots/test_metric_filter_rendering.py/SqlQueryPlan/BigQuery/test_metric_with_metric_in_where_filter__plan0.sql +++ b/tests_metricflow/snapshots/test_metric_filter_rendering.py/SqlQueryPlan/BigQuery/test_metric_with_metric_in_where_filter__plan0.sql @@ -113,22 +113,22 @@ FROM ( 1 AS listings , listings_latest_src_28000.capacity AS largest_listing , listings_latest_src_28000.capacity AS smallest_listing - , DATE_TRUNC(listings_latest_src_28000.created_at, day) AS ds__day - , DATE_TRUNC(listings_latest_src_28000.created_at, isoweek) AS ds__week - , DATE_TRUNC(listings_latest_src_28000.created_at, month) AS ds__month - , DATE_TRUNC(listings_latest_src_28000.created_at, quarter) AS ds__quarter - , DATE_TRUNC(listings_latest_src_28000.created_at, year) AS ds__year + , DATETIME_TRUNC(listings_latest_src_28000.created_at, day) AS ds__day + , DATETIME_TRUNC(listings_latest_src_28000.created_at, isoweek) AS ds__week + , DATETIME_TRUNC(listings_latest_src_28000.created_at, month) AS ds__month + , DATETIME_TRUNC(listings_latest_src_28000.created_at, quarter) AS ds__quarter + , DATETIME_TRUNC(listings_latest_src_28000.created_at, year) AS ds__year , EXTRACT(year FROM listings_latest_src_28000.created_at) AS ds__extract_year , EXTRACT(quarter FROM listings_latest_src_28000.created_at) AS ds__extract_quarter , EXTRACT(month FROM listings_latest_src_28000.created_at) AS ds__extract_month , EXTRACT(day FROM listings_latest_src_28000.created_at) AS ds__extract_day , IF(EXTRACT(dayofweek FROM listings_latest_src_28000.created_at) = 1, 7, EXTRACT(dayofweek FROM listings_latest_src_28000.created_at) - 1) AS ds__extract_dow , EXTRACT(dayofyear FROM listings_latest_src_28000.created_at) AS ds__extract_doy - , DATE_TRUNC(listings_latest_src_28000.created_at, day) AS created_at__day - , DATE_TRUNC(listings_latest_src_28000.created_at, isoweek) AS created_at__week - , DATE_TRUNC(listings_latest_src_28000.created_at, month) AS created_at__month - , DATE_TRUNC(listings_latest_src_28000.created_at, quarter) AS created_at__quarter - , DATE_TRUNC(listings_latest_src_28000.created_at, year) AS created_at__year + , DATETIME_TRUNC(listings_latest_src_28000.created_at, day) AS created_at__day + , DATETIME_TRUNC(listings_latest_src_28000.created_at, isoweek) AS created_at__week + , DATETIME_TRUNC(listings_latest_src_28000.created_at, month) AS created_at__month + , DATETIME_TRUNC(listings_latest_src_28000.created_at, quarter) AS created_at__quarter + , DATETIME_TRUNC(listings_latest_src_28000.created_at, year) AS created_at__year , EXTRACT(year FROM listings_latest_src_28000.created_at) AS created_at__extract_year , EXTRACT(quarter FROM listings_latest_src_28000.created_at) AS created_at__extract_quarter , EXTRACT(month FROM listings_latest_src_28000.created_at) AS created_at__extract_month @@ -138,22 +138,22 @@ FROM ( , listings_latest_src_28000.country AS country_latest , listings_latest_src_28000.is_lux AS is_lux_latest , listings_latest_src_28000.capacity AS capacity_latest - , DATE_TRUNC(listings_latest_src_28000.created_at, day) AS listing__ds__day - , DATE_TRUNC(listings_latest_src_28000.created_at, isoweek) AS listing__ds__week - , DATE_TRUNC(listings_latest_src_28000.created_at, month) AS listing__ds__month - , DATE_TRUNC(listings_latest_src_28000.created_at, quarter) AS listing__ds__quarter - , DATE_TRUNC(listings_latest_src_28000.created_at, year) AS listing__ds__year + , DATETIME_TRUNC(listings_latest_src_28000.created_at, day) AS listing__ds__day + , DATETIME_TRUNC(listings_latest_src_28000.created_at, isoweek) AS listing__ds__week + , DATETIME_TRUNC(listings_latest_src_28000.created_at, month) AS listing__ds__month + , DATETIME_TRUNC(listings_latest_src_28000.created_at, quarter) AS listing__ds__quarter + , DATETIME_TRUNC(listings_latest_src_28000.created_at, year) AS listing__ds__year , EXTRACT(year FROM listings_latest_src_28000.created_at) AS listing__ds__extract_year , EXTRACT(quarter FROM listings_latest_src_28000.created_at) AS listing__ds__extract_quarter , EXTRACT(month FROM listings_latest_src_28000.created_at) AS listing__ds__extract_month , EXTRACT(day FROM listings_latest_src_28000.created_at) AS listing__ds__extract_day , IF(EXTRACT(dayofweek FROM listings_latest_src_28000.created_at) = 1, 7, EXTRACT(dayofweek FROM listings_latest_src_28000.created_at) - 1) AS listing__ds__extract_dow , EXTRACT(dayofyear FROM listings_latest_src_28000.created_at) AS listing__ds__extract_doy - , DATE_TRUNC(listings_latest_src_28000.created_at, day) AS listing__created_at__day - , DATE_TRUNC(listings_latest_src_28000.created_at, isoweek) AS listing__created_at__week - , DATE_TRUNC(listings_latest_src_28000.created_at, month) AS listing__created_at__month - , DATE_TRUNC(listings_latest_src_28000.created_at, quarter) AS listing__created_at__quarter - , DATE_TRUNC(listings_latest_src_28000.created_at, year) AS listing__created_at__year + , DATETIME_TRUNC(listings_latest_src_28000.created_at, day) AS listing__created_at__day + , DATETIME_TRUNC(listings_latest_src_28000.created_at, isoweek) AS listing__created_at__week + , DATETIME_TRUNC(listings_latest_src_28000.created_at, month) AS listing__created_at__month + , DATETIME_TRUNC(listings_latest_src_28000.created_at, quarter) AS listing__created_at__quarter + , DATETIME_TRUNC(listings_latest_src_28000.created_at, year) AS listing__created_at__year , EXTRACT(year FROM listings_latest_src_28000.created_at) AS listing__created_at__extract_year , EXTRACT(quarter FROM listings_latest_src_28000.created_at) AS listing__created_at__extract_quarter , EXTRACT(month FROM listings_latest_src_28000.created_at) AS listing__created_at__extract_month @@ -309,33 +309,33 @@ FROM ( , bookings_source_src_28000.booking_value AS approximate_continuous_booking_value_p99 , bookings_source_src_28000.booking_value AS approximate_discrete_booking_value_p99 , bookings_source_src_28000.is_instant - , DATE_TRUNC(bookings_source_src_28000.ds, day) AS ds__day - , DATE_TRUNC(bookings_source_src_28000.ds, isoweek) AS ds__week - , DATE_TRUNC(bookings_source_src_28000.ds, month) AS ds__month - , DATE_TRUNC(bookings_source_src_28000.ds, quarter) AS ds__quarter - , DATE_TRUNC(bookings_source_src_28000.ds, year) AS ds__year + , DATETIME_TRUNC(bookings_source_src_28000.ds, day) AS ds__day + , DATETIME_TRUNC(bookings_source_src_28000.ds, isoweek) AS ds__week + , DATETIME_TRUNC(bookings_source_src_28000.ds, month) AS ds__month + , DATETIME_TRUNC(bookings_source_src_28000.ds, quarter) AS ds__quarter + , DATETIME_TRUNC(bookings_source_src_28000.ds, year) AS ds__year , EXTRACT(year FROM bookings_source_src_28000.ds) AS ds__extract_year , EXTRACT(quarter FROM bookings_source_src_28000.ds) AS ds__extract_quarter , EXTRACT(month FROM bookings_source_src_28000.ds) AS ds__extract_month , EXTRACT(day FROM bookings_source_src_28000.ds) AS ds__extract_day , IF(EXTRACT(dayofweek FROM bookings_source_src_28000.ds) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_28000.ds) - 1) AS ds__extract_dow , EXTRACT(dayofyear FROM bookings_source_src_28000.ds) AS ds__extract_doy - , DATE_TRUNC(bookings_source_src_28000.ds_partitioned, day) AS ds_partitioned__day - , DATE_TRUNC(bookings_source_src_28000.ds_partitioned, isoweek) AS ds_partitioned__week - , DATE_TRUNC(bookings_source_src_28000.ds_partitioned, month) AS ds_partitioned__month - , DATE_TRUNC(bookings_source_src_28000.ds_partitioned, quarter) AS ds_partitioned__quarter - , DATE_TRUNC(bookings_source_src_28000.ds_partitioned, year) AS ds_partitioned__year + , DATETIME_TRUNC(bookings_source_src_28000.ds_partitioned, day) AS ds_partitioned__day + , DATETIME_TRUNC(bookings_source_src_28000.ds_partitioned, isoweek) AS ds_partitioned__week + , DATETIME_TRUNC(bookings_source_src_28000.ds_partitioned, month) AS ds_partitioned__month + , DATETIME_TRUNC(bookings_source_src_28000.ds_partitioned, quarter) AS ds_partitioned__quarter + , DATETIME_TRUNC(bookings_source_src_28000.ds_partitioned, year) AS ds_partitioned__year , EXTRACT(year FROM bookings_source_src_28000.ds_partitioned) AS ds_partitioned__extract_year , EXTRACT(quarter FROM bookings_source_src_28000.ds_partitioned) AS ds_partitioned__extract_quarter , EXTRACT(month FROM bookings_source_src_28000.ds_partitioned) AS ds_partitioned__extract_month , EXTRACT(day FROM bookings_source_src_28000.ds_partitioned) AS ds_partitioned__extract_day , IF(EXTRACT(dayofweek FROM bookings_source_src_28000.ds_partitioned) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_28000.ds_partitioned) - 1) AS ds_partitioned__extract_dow , EXTRACT(dayofyear FROM bookings_source_src_28000.ds_partitioned) AS ds_partitioned__extract_doy - , DATE_TRUNC(bookings_source_src_28000.paid_at, day) AS paid_at__day - , DATE_TRUNC(bookings_source_src_28000.paid_at, isoweek) AS paid_at__week - , DATE_TRUNC(bookings_source_src_28000.paid_at, month) AS paid_at__month - , DATE_TRUNC(bookings_source_src_28000.paid_at, quarter) AS paid_at__quarter - , DATE_TRUNC(bookings_source_src_28000.paid_at, year) AS paid_at__year + , DATETIME_TRUNC(bookings_source_src_28000.paid_at, day) AS paid_at__day + , DATETIME_TRUNC(bookings_source_src_28000.paid_at, isoweek) AS paid_at__week + , DATETIME_TRUNC(bookings_source_src_28000.paid_at, month) AS paid_at__month + , DATETIME_TRUNC(bookings_source_src_28000.paid_at, quarter) AS paid_at__quarter + , DATETIME_TRUNC(bookings_source_src_28000.paid_at, year) AS paid_at__year , EXTRACT(year FROM bookings_source_src_28000.paid_at) AS paid_at__extract_year , EXTRACT(quarter FROM bookings_source_src_28000.paid_at) AS paid_at__extract_quarter , EXTRACT(month FROM bookings_source_src_28000.paid_at) AS paid_at__extract_month @@ -343,33 +343,33 @@ FROM ( , IF(EXTRACT(dayofweek FROM bookings_source_src_28000.paid_at) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_28000.paid_at) - 1) AS paid_at__extract_dow , EXTRACT(dayofyear FROM bookings_source_src_28000.paid_at) AS paid_at__extract_doy , bookings_source_src_28000.is_instant AS booking__is_instant - , DATE_TRUNC(bookings_source_src_28000.ds, day) AS booking__ds__day - , DATE_TRUNC(bookings_source_src_28000.ds, isoweek) AS booking__ds__week - , DATE_TRUNC(bookings_source_src_28000.ds, month) AS booking__ds__month - , DATE_TRUNC(bookings_source_src_28000.ds, quarter) AS booking__ds__quarter - , DATE_TRUNC(bookings_source_src_28000.ds, year) AS booking__ds__year + , DATETIME_TRUNC(bookings_source_src_28000.ds, day) AS booking__ds__day + , DATETIME_TRUNC(bookings_source_src_28000.ds, isoweek) AS booking__ds__week + , DATETIME_TRUNC(bookings_source_src_28000.ds, month) AS booking__ds__month + , DATETIME_TRUNC(bookings_source_src_28000.ds, quarter) AS booking__ds__quarter + , DATETIME_TRUNC(bookings_source_src_28000.ds, year) AS booking__ds__year , EXTRACT(year FROM bookings_source_src_28000.ds) AS booking__ds__extract_year , EXTRACT(quarter FROM bookings_source_src_28000.ds) AS booking__ds__extract_quarter , EXTRACT(month FROM bookings_source_src_28000.ds) AS booking__ds__extract_month , EXTRACT(day FROM bookings_source_src_28000.ds) AS booking__ds__extract_day , IF(EXTRACT(dayofweek FROM bookings_source_src_28000.ds) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_28000.ds) - 1) AS booking__ds__extract_dow , EXTRACT(dayofyear FROM bookings_source_src_28000.ds) AS booking__ds__extract_doy - , DATE_TRUNC(bookings_source_src_28000.ds_partitioned, day) AS booking__ds_partitioned__day - , DATE_TRUNC(bookings_source_src_28000.ds_partitioned, isoweek) AS booking__ds_partitioned__week - , DATE_TRUNC(bookings_source_src_28000.ds_partitioned, month) AS booking__ds_partitioned__month - , DATE_TRUNC(bookings_source_src_28000.ds_partitioned, quarter) AS booking__ds_partitioned__quarter - , DATE_TRUNC(bookings_source_src_28000.ds_partitioned, year) AS booking__ds_partitioned__year + , DATETIME_TRUNC(bookings_source_src_28000.ds_partitioned, day) AS booking__ds_partitioned__day + , DATETIME_TRUNC(bookings_source_src_28000.ds_partitioned, isoweek) AS booking__ds_partitioned__week + , DATETIME_TRUNC(bookings_source_src_28000.ds_partitioned, month) AS booking__ds_partitioned__month + , DATETIME_TRUNC(bookings_source_src_28000.ds_partitioned, quarter) AS booking__ds_partitioned__quarter + , DATETIME_TRUNC(bookings_source_src_28000.ds_partitioned, year) AS booking__ds_partitioned__year , EXTRACT(year FROM bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__extract_year , EXTRACT(quarter FROM bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__extract_quarter , EXTRACT(month FROM bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__extract_month , EXTRACT(day FROM bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__extract_day , IF(EXTRACT(dayofweek FROM bookings_source_src_28000.ds_partitioned) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_28000.ds_partitioned) - 1) AS booking__ds_partitioned__extract_dow , EXTRACT(dayofyear FROM bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__extract_doy - , DATE_TRUNC(bookings_source_src_28000.paid_at, day) AS booking__paid_at__day - , DATE_TRUNC(bookings_source_src_28000.paid_at, isoweek) AS booking__paid_at__week - , DATE_TRUNC(bookings_source_src_28000.paid_at, month) AS booking__paid_at__month - , DATE_TRUNC(bookings_source_src_28000.paid_at, quarter) AS booking__paid_at__quarter - , DATE_TRUNC(bookings_source_src_28000.paid_at, year) AS booking__paid_at__year + , DATETIME_TRUNC(bookings_source_src_28000.paid_at, day) AS booking__paid_at__day + , DATETIME_TRUNC(bookings_source_src_28000.paid_at, isoweek) AS booking__paid_at__week + , DATETIME_TRUNC(bookings_source_src_28000.paid_at, month) AS booking__paid_at__month + , DATETIME_TRUNC(bookings_source_src_28000.paid_at, quarter) AS booking__paid_at__quarter + , DATETIME_TRUNC(bookings_source_src_28000.paid_at, year) AS booking__paid_at__year , EXTRACT(year FROM bookings_source_src_28000.paid_at) AS booking__paid_at__extract_year , EXTRACT(quarter FROM bookings_source_src_28000.paid_at) AS booking__paid_at__extract_quarter , EXTRACT(month FROM bookings_source_src_28000.paid_at) AS booking__paid_at__extract_month diff --git a/tests_metricflow/snapshots/test_metric_filter_rendering.py/SqlQueryPlan/BigQuery/test_metric_with_metric_in_where_filter__plan0_optimized.sql b/tests_metricflow/snapshots/test_metric_filter_rendering.py/SqlQueryPlan/BigQuery/test_metric_with_metric_in_where_filter__plan0_optimized.sql index d89858f577..e4469c701d 100644 --- a/tests_metricflow/snapshots/test_metric_filter_rendering.py/SqlQueryPlan/BigQuery/test_metric_with_metric_in_where_filter__plan0_optimized.sql +++ b/tests_metricflow/snapshots/test_metric_filter_rendering.py/SqlQueryPlan/BigQuery/test_metric_with_metric_in_where_filter__plan0_optimized.sql @@ -17,7 +17,7 @@ FROM ( -- Metric Time Dimension 'ds' -- Pass Only Elements: ['listings', 'metric_time__day', 'listing'] SELECT - DATE_TRUNC(created_at, day) AS metric_time__day + DATETIME_TRUNC(created_at, day) AS metric_time__day , listing_id AS listing , 1 AS listings FROM ***************************.dim_listings_latest listings_latest_src_28000 diff --git a/tests_metricflow/snapshots/test_metric_filter_rendering.py/SqlQueryPlan/BigQuery/test_query_with_cumulative_metric_in_where_filter__plan0.sql b/tests_metricflow/snapshots/test_metric_filter_rendering.py/SqlQueryPlan/BigQuery/test_query_with_cumulative_metric_in_where_filter__plan0.sql index 19b39288d1..ca7f8d244e 100644 --- a/tests_metricflow/snapshots/test_metric_filter_rendering.py/SqlQueryPlan/BigQuery/test_query_with_cumulative_metric_in_where_filter__plan0.sql +++ b/tests_metricflow/snapshots/test_metric_filter_rendering.py/SqlQueryPlan/BigQuery/test_query_with_cumulative_metric_in_where_filter__plan0.sql @@ -106,22 +106,22 @@ FROM ( 1 AS listings , listings_latest_src_28000.capacity AS largest_listing , listings_latest_src_28000.capacity AS smallest_listing - , DATE_TRUNC(listings_latest_src_28000.created_at, day) AS ds__day - , DATE_TRUNC(listings_latest_src_28000.created_at, isoweek) AS ds__week - , DATE_TRUNC(listings_latest_src_28000.created_at, month) AS ds__month - , DATE_TRUNC(listings_latest_src_28000.created_at, quarter) AS ds__quarter - , DATE_TRUNC(listings_latest_src_28000.created_at, year) AS ds__year + , DATETIME_TRUNC(listings_latest_src_28000.created_at, day) AS ds__day + , DATETIME_TRUNC(listings_latest_src_28000.created_at, isoweek) AS ds__week + , DATETIME_TRUNC(listings_latest_src_28000.created_at, month) AS ds__month + , DATETIME_TRUNC(listings_latest_src_28000.created_at, quarter) AS ds__quarter + , DATETIME_TRUNC(listings_latest_src_28000.created_at, year) AS ds__year , EXTRACT(year FROM listings_latest_src_28000.created_at) AS ds__extract_year , EXTRACT(quarter FROM listings_latest_src_28000.created_at) AS ds__extract_quarter , EXTRACT(month FROM listings_latest_src_28000.created_at) AS ds__extract_month , EXTRACT(day FROM listings_latest_src_28000.created_at) AS ds__extract_day , IF(EXTRACT(dayofweek FROM listings_latest_src_28000.created_at) = 1, 7, EXTRACT(dayofweek FROM listings_latest_src_28000.created_at) - 1) AS ds__extract_dow , EXTRACT(dayofyear FROM listings_latest_src_28000.created_at) AS ds__extract_doy - , DATE_TRUNC(listings_latest_src_28000.created_at, day) AS created_at__day - , DATE_TRUNC(listings_latest_src_28000.created_at, isoweek) AS created_at__week - , DATE_TRUNC(listings_latest_src_28000.created_at, month) AS created_at__month - , DATE_TRUNC(listings_latest_src_28000.created_at, quarter) AS created_at__quarter - , DATE_TRUNC(listings_latest_src_28000.created_at, year) AS created_at__year + , DATETIME_TRUNC(listings_latest_src_28000.created_at, day) AS created_at__day + , DATETIME_TRUNC(listings_latest_src_28000.created_at, isoweek) AS created_at__week + , DATETIME_TRUNC(listings_latest_src_28000.created_at, month) AS created_at__month + , DATETIME_TRUNC(listings_latest_src_28000.created_at, quarter) AS created_at__quarter + , DATETIME_TRUNC(listings_latest_src_28000.created_at, year) AS created_at__year , EXTRACT(year FROM listings_latest_src_28000.created_at) AS created_at__extract_year , EXTRACT(quarter FROM listings_latest_src_28000.created_at) AS created_at__extract_quarter , EXTRACT(month FROM listings_latest_src_28000.created_at) AS created_at__extract_month @@ -131,22 +131,22 @@ FROM ( , listings_latest_src_28000.country AS country_latest , listings_latest_src_28000.is_lux AS is_lux_latest , listings_latest_src_28000.capacity AS capacity_latest - , DATE_TRUNC(listings_latest_src_28000.created_at, day) AS listing__ds__day - , DATE_TRUNC(listings_latest_src_28000.created_at, isoweek) AS listing__ds__week - , DATE_TRUNC(listings_latest_src_28000.created_at, month) AS listing__ds__month - , DATE_TRUNC(listings_latest_src_28000.created_at, quarter) AS listing__ds__quarter - , DATE_TRUNC(listings_latest_src_28000.created_at, year) AS listing__ds__year + , DATETIME_TRUNC(listings_latest_src_28000.created_at, day) AS listing__ds__day + , DATETIME_TRUNC(listings_latest_src_28000.created_at, isoweek) AS listing__ds__week + , DATETIME_TRUNC(listings_latest_src_28000.created_at, month) AS listing__ds__month + , DATETIME_TRUNC(listings_latest_src_28000.created_at, quarter) AS listing__ds__quarter + , DATETIME_TRUNC(listings_latest_src_28000.created_at, year) AS listing__ds__year , EXTRACT(year FROM listings_latest_src_28000.created_at) AS listing__ds__extract_year , EXTRACT(quarter FROM listings_latest_src_28000.created_at) AS listing__ds__extract_quarter , EXTRACT(month FROM listings_latest_src_28000.created_at) AS listing__ds__extract_month , EXTRACT(day FROM listings_latest_src_28000.created_at) AS listing__ds__extract_day , IF(EXTRACT(dayofweek FROM listings_latest_src_28000.created_at) = 1, 7, EXTRACT(dayofweek FROM listings_latest_src_28000.created_at) - 1) AS listing__ds__extract_dow , EXTRACT(dayofyear FROM listings_latest_src_28000.created_at) AS listing__ds__extract_doy - , DATE_TRUNC(listings_latest_src_28000.created_at, day) AS listing__created_at__day - , DATE_TRUNC(listings_latest_src_28000.created_at, isoweek) AS listing__created_at__week - , DATE_TRUNC(listings_latest_src_28000.created_at, month) AS listing__created_at__month - , DATE_TRUNC(listings_latest_src_28000.created_at, quarter) AS listing__created_at__quarter - , DATE_TRUNC(listings_latest_src_28000.created_at, year) AS listing__created_at__year + , DATETIME_TRUNC(listings_latest_src_28000.created_at, day) AS listing__created_at__day + , DATETIME_TRUNC(listings_latest_src_28000.created_at, isoweek) AS listing__created_at__week + , DATETIME_TRUNC(listings_latest_src_28000.created_at, month) AS listing__created_at__month + , DATETIME_TRUNC(listings_latest_src_28000.created_at, quarter) AS listing__created_at__quarter + , DATETIME_TRUNC(listings_latest_src_28000.created_at, year) AS listing__created_at__year , EXTRACT(year FROM listings_latest_src_28000.created_at) AS listing__created_at__extract_year , EXTRACT(quarter FROM listings_latest_src_28000.created_at) AS listing__created_at__extract_quarter , EXTRACT(month FROM listings_latest_src_28000.created_at) AS listing__created_at__extract_month @@ -226,22 +226,22 @@ FROM ( -- Read Elements From Semantic Model 'revenue' SELECT revenue_src_28000.revenue AS txn_revenue - , DATE_TRUNC(revenue_src_28000.created_at, day) AS ds__day - , DATE_TRUNC(revenue_src_28000.created_at, isoweek) AS ds__week - , DATE_TRUNC(revenue_src_28000.created_at, month) AS ds__month - , DATE_TRUNC(revenue_src_28000.created_at, quarter) AS ds__quarter - , DATE_TRUNC(revenue_src_28000.created_at, year) AS ds__year + , DATETIME_TRUNC(revenue_src_28000.created_at, day) AS ds__day + , DATETIME_TRUNC(revenue_src_28000.created_at, isoweek) AS ds__week + , DATETIME_TRUNC(revenue_src_28000.created_at, month) AS ds__month + , DATETIME_TRUNC(revenue_src_28000.created_at, quarter) AS ds__quarter + , DATETIME_TRUNC(revenue_src_28000.created_at, year) AS ds__year , EXTRACT(year FROM revenue_src_28000.created_at) AS ds__extract_year , EXTRACT(quarter FROM revenue_src_28000.created_at) AS ds__extract_quarter , EXTRACT(month FROM revenue_src_28000.created_at) AS ds__extract_month , EXTRACT(day FROM revenue_src_28000.created_at) AS ds__extract_day , IF(EXTRACT(dayofweek FROM revenue_src_28000.created_at) = 1, 7, EXTRACT(dayofweek FROM revenue_src_28000.created_at) - 1) AS ds__extract_dow , EXTRACT(dayofyear FROM revenue_src_28000.created_at) AS ds__extract_doy - , DATE_TRUNC(revenue_src_28000.created_at, day) AS revenue_instance__ds__day - , DATE_TRUNC(revenue_src_28000.created_at, isoweek) AS revenue_instance__ds__week - , DATE_TRUNC(revenue_src_28000.created_at, month) AS revenue_instance__ds__month - , DATE_TRUNC(revenue_src_28000.created_at, quarter) AS revenue_instance__ds__quarter - , DATE_TRUNC(revenue_src_28000.created_at, year) AS revenue_instance__ds__year + , DATETIME_TRUNC(revenue_src_28000.created_at, day) AS revenue_instance__ds__day + , DATETIME_TRUNC(revenue_src_28000.created_at, isoweek) AS revenue_instance__ds__week + , DATETIME_TRUNC(revenue_src_28000.created_at, month) AS revenue_instance__ds__month + , DATETIME_TRUNC(revenue_src_28000.created_at, quarter) AS revenue_instance__ds__quarter + , DATETIME_TRUNC(revenue_src_28000.created_at, year) AS revenue_instance__ds__year , EXTRACT(year FROM revenue_src_28000.created_at) AS revenue_instance__ds__extract_year , EXTRACT(quarter FROM revenue_src_28000.created_at) AS revenue_instance__ds__extract_quarter , EXTRACT(month FROM revenue_src_28000.created_at) AS revenue_instance__ds__extract_month diff --git a/tests_metricflow/snapshots/test_metric_filter_rendering.py/SqlQueryPlan/BigQuery/test_query_with_derived_metric_in_where_filter__plan0.sql b/tests_metricflow/snapshots/test_metric_filter_rendering.py/SqlQueryPlan/BigQuery/test_query_with_derived_metric_in_where_filter__plan0.sql index 898eaa084e..08af12418e 100644 --- a/tests_metricflow/snapshots/test_metric_filter_rendering.py/SqlQueryPlan/BigQuery/test_query_with_derived_metric_in_where_filter__plan0.sql +++ b/tests_metricflow/snapshots/test_metric_filter_rendering.py/SqlQueryPlan/BigQuery/test_query_with_derived_metric_in_where_filter__plan0.sql @@ -106,22 +106,22 @@ FROM ( 1 AS listings , listings_latest_src_28000.capacity AS largest_listing , listings_latest_src_28000.capacity AS smallest_listing - , DATE_TRUNC(listings_latest_src_28000.created_at, day) AS ds__day - , DATE_TRUNC(listings_latest_src_28000.created_at, isoweek) AS ds__week - , DATE_TRUNC(listings_latest_src_28000.created_at, month) AS ds__month - , DATE_TRUNC(listings_latest_src_28000.created_at, quarter) AS ds__quarter - , DATE_TRUNC(listings_latest_src_28000.created_at, year) AS ds__year + , DATETIME_TRUNC(listings_latest_src_28000.created_at, day) AS ds__day + , DATETIME_TRUNC(listings_latest_src_28000.created_at, isoweek) AS ds__week + , DATETIME_TRUNC(listings_latest_src_28000.created_at, month) AS ds__month + , DATETIME_TRUNC(listings_latest_src_28000.created_at, quarter) AS ds__quarter + , DATETIME_TRUNC(listings_latest_src_28000.created_at, year) AS ds__year , EXTRACT(year FROM listings_latest_src_28000.created_at) AS ds__extract_year , EXTRACT(quarter FROM listings_latest_src_28000.created_at) AS ds__extract_quarter , EXTRACT(month FROM listings_latest_src_28000.created_at) AS ds__extract_month , EXTRACT(day FROM listings_latest_src_28000.created_at) AS ds__extract_day , IF(EXTRACT(dayofweek FROM listings_latest_src_28000.created_at) = 1, 7, EXTRACT(dayofweek FROM listings_latest_src_28000.created_at) - 1) AS ds__extract_dow , EXTRACT(dayofyear FROM listings_latest_src_28000.created_at) AS ds__extract_doy - , DATE_TRUNC(listings_latest_src_28000.created_at, day) AS created_at__day - , DATE_TRUNC(listings_latest_src_28000.created_at, isoweek) AS created_at__week - , DATE_TRUNC(listings_latest_src_28000.created_at, month) AS created_at__month - , DATE_TRUNC(listings_latest_src_28000.created_at, quarter) AS created_at__quarter - , DATE_TRUNC(listings_latest_src_28000.created_at, year) AS created_at__year + , DATETIME_TRUNC(listings_latest_src_28000.created_at, day) AS created_at__day + , DATETIME_TRUNC(listings_latest_src_28000.created_at, isoweek) AS created_at__week + , DATETIME_TRUNC(listings_latest_src_28000.created_at, month) AS created_at__month + , DATETIME_TRUNC(listings_latest_src_28000.created_at, quarter) AS created_at__quarter + , DATETIME_TRUNC(listings_latest_src_28000.created_at, year) AS created_at__year , EXTRACT(year FROM listings_latest_src_28000.created_at) AS created_at__extract_year , EXTRACT(quarter FROM listings_latest_src_28000.created_at) AS created_at__extract_quarter , EXTRACT(month FROM listings_latest_src_28000.created_at) AS created_at__extract_month @@ -131,22 +131,22 @@ FROM ( , listings_latest_src_28000.country AS country_latest , listings_latest_src_28000.is_lux AS is_lux_latest , listings_latest_src_28000.capacity AS capacity_latest - , DATE_TRUNC(listings_latest_src_28000.created_at, day) AS listing__ds__day - , DATE_TRUNC(listings_latest_src_28000.created_at, isoweek) AS listing__ds__week - , DATE_TRUNC(listings_latest_src_28000.created_at, month) AS listing__ds__month - , DATE_TRUNC(listings_latest_src_28000.created_at, quarter) AS listing__ds__quarter - , DATE_TRUNC(listings_latest_src_28000.created_at, year) AS listing__ds__year + , DATETIME_TRUNC(listings_latest_src_28000.created_at, day) AS listing__ds__day + , DATETIME_TRUNC(listings_latest_src_28000.created_at, isoweek) AS listing__ds__week + , DATETIME_TRUNC(listings_latest_src_28000.created_at, month) AS listing__ds__month + , DATETIME_TRUNC(listings_latest_src_28000.created_at, quarter) AS listing__ds__quarter + , DATETIME_TRUNC(listings_latest_src_28000.created_at, year) AS listing__ds__year , EXTRACT(year FROM listings_latest_src_28000.created_at) AS listing__ds__extract_year , EXTRACT(quarter FROM listings_latest_src_28000.created_at) AS listing__ds__extract_quarter , EXTRACT(month FROM listings_latest_src_28000.created_at) AS listing__ds__extract_month , EXTRACT(day FROM listings_latest_src_28000.created_at) AS listing__ds__extract_day , IF(EXTRACT(dayofweek FROM listings_latest_src_28000.created_at) = 1, 7, EXTRACT(dayofweek FROM listings_latest_src_28000.created_at) - 1) AS listing__ds__extract_dow , EXTRACT(dayofyear FROM listings_latest_src_28000.created_at) AS listing__ds__extract_doy - , DATE_TRUNC(listings_latest_src_28000.created_at, day) AS listing__created_at__day - , DATE_TRUNC(listings_latest_src_28000.created_at, isoweek) AS listing__created_at__week - , DATE_TRUNC(listings_latest_src_28000.created_at, month) AS listing__created_at__month - , DATE_TRUNC(listings_latest_src_28000.created_at, quarter) AS listing__created_at__quarter - , DATE_TRUNC(listings_latest_src_28000.created_at, year) AS listing__created_at__year + , DATETIME_TRUNC(listings_latest_src_28000.created_at, day) AS listing__created_at__day + , DATETIME_TRUNC(listings_latest_src_28000.created_at, isoweek) AS listing__created_at__week + , DATETIME_TRUNC(listings_latest_src_28000.created_at, month) AS listing__created_at__month + , DATETIME_TRUNC(listings_latest_src_28000.created_at, quarter) AS listing__created_at__quarter + , DATETIME_TRUNC(listings_latest_src_28000.created_at, year) AS listing__created_at__year , EXTRACT(year FROM listings_latest_src_28000.created_at) AS listing__created_at__extract_year , EXTRACT(quarter FROM listings_latest_src_28000.created_at) AS listing__created_at__extract_quarter , EXTRACT(month FROM listings_latest_src_28000.created_at) AS listing__created_at__extract_month @@ -313,33 +313,33 @@ FROM ( , bookings_source_src_28000.booking_value AS approximate_continuous_booking_value_p99 , bookings_source_src_28000.booking_value AS approximate_discrete_booking_value_p99 , bookings_source_src_28000.is_instant - , DATE_TRUNC(bookings_source_src_28000.ds, day) AS ds__day - , DATE_TRUNC(bookings_source_src_28000.ds, isoweek) AS ds__week - , DATE_TRUNC(bookings_source_src_28000.ds, month) AS ds__month - , DATE_TRUNC(bookings_source_src_28000.ds, quarter) AS ds__quarter - , DATE_TRUNC(bookings_source_src_28000.ds, year) AS ds__year + , DATETIME_TRUNC(bookings_source_src_28000.ds, day) AS ds__day + , DATETIME_TRUNC(bookings_source_src_28000.ds, isoweek) AS ds__week + , DATETIME_TRUNC(bookings_source_src_28000.ds, month) AS ds__month + , DATETIME_TRUNC(bookings_source_src_28000.ds, quarter) AS ds__quarter + , DATETIME_TRUNC(bookings_source_src_28000.ds, year) AS ds__year , EXTRACT(year FROM bookings_source_src_28000.ds) AS ds__extract_year , EXTRACT(quarter FROM bookings_source_src_28000.ds) AS ds__extract_quarter , EXTRACT(month FROM bookings_source_src_28000.ds) AS ds__extract_month , EXTRACT(day FROM bookings_source_src_28000.ds) AS ds__extract_day , IF(EXTRACT(dayofweek FROM bookings_source_src_28000.ds) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_28000.ds) - 1) AS ds__extract_dow , EXTRACT(dayofyear FROM bookings_source_src_28000.ds) AS ds__extract_doy - , DATE_TRUNC(bookings_source_src_28000.ds_partitioned, day) AS ds_partitioned__day - , DATE_TRUNC(bookings_source_src_28000.ds_partitioned, isoweek) AS ds_partitioned__week - , DATE_TRUNC(bookings_source_src_28000.ds_partitioned, month) AS ds_partitioned__month - , DATE_TRUNC(bookings_source_src_28000.ds_partitioned, quarter) AS ds_partitioned__quarter - , DATE_TRUNC(bookings_source_src_28000.ds_partitioned, year) AS ds_partitioned__year + , DATETIME_TRUNC(bookings_source_src_28000.ds_partitioned, day) AS ds_partitioned__day + , DATETIME_TRUNC(bookings_source_src_28000.ds_partitioned, isoweek) AS ds_partitioned__week + , DATETIME_TRUNC(bookings_source_src_28000.ds_partitioned, month) AS ds_partitioned__month + , DATETIME_TRUNC(bookings_source_src_28000.ds_partitioned, quarter) AS ds_partitioned__quarter + , DATETIME_TRUNC(bookings_source_src_28000.ds_partitioned, year) AS ds_partitioned__year , EXTRACT(year FROM bookings_source_src_28000.ds_partitioned) AS ds_partitioned__extract_year , EXTRACT(quarter FROM bookings_source_src_28000.ds_partitioned) AS ds_partitioned__extract_quarter , EXTRACT(month FROM bookings_source_src_28000.ds_partitioned) AS ds_partitioned__extract_month , EXTRACT(day FROM bookings_source_src_28000.ds_partitioned) AS ds_partitioned__extract_day , IF(EXTRACT(dayofweek FROM bookings_source_src_28000.ds_partitioned) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_28000.ds_partitioned) - 1) AS ds_partitioned__extract_dow , EXTRACT(dayofyear FROM bookings_source_src_28000.ds_partitioned) AS ds_partitioned__extract_doy - , DATE_TRUNC(bookings_source_src_28000.paid_at, day) AS paid_at__day - , DATE_TRUNC(bookings_source_src_28000.paid_at, isoweek) AS paid_at__week - , DATE_TRUNC(bookings_source_src_28000.paid_at, month) AS paid_at__month - , DATE_TRUNC(bookings_source_src_28000.paid_at, quarter) AS paid_at__quarter - , DATE_TRUNC(bookings_source_src_28000.paid_at, year) AS paid_at__year + , DATETIME_TRUNC(bookings_source_src_28000.paid_at, day) AS paid_at__day + , DATETIME_TRUNC(bookings_source_src_28000.paid_at, isoweek) AS paid_at__week + , DATETIME_TRUNC(bookings_source_src_28000.paid_at, month) AS paid_at__month + , DATETIME_TRUNC(bookings_source_src_28000.paid_at, quarter) AS paid_at__quarter + , DATETIME_TRUNC(bookings_source_src_28000.paid_at, year) AS paid_at__year , EXTRACT(year FROM bookings_source_src_28000.paid_at) AS paid_at__extract_year , EXTRACT(quarter FROM bookings_source_src_28000.paid_at) AS paid_at__extract_quarter , EXTRACT(month FROM bookings_source_src_28000.paid_at) AS paid_at__extract_month @@ -347,33 +347,33 @@ FROM ( , IF(EXTRACT(dayofweek FROM bookings_source_src_28000.paid_at) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_28000.paid_at) - 1) AS paid_at__extract_dow , EXTRACT(dayofyear FROM bookings_source_src_28000.paid_at) AS paid_at__extract_doy , bookings_source_src_28000.is_instant AS booking__is_instant - , DATE_TRUNC(bookings_source_src_28000.ds, day) AS booking__ds__day - , DATE_TRUNC(bookings_source_src_28000.ds, isoweek) AS booking__ds__week - , DATE_TRUNC(bookings_source_src_28000.ds, month) AS booking__ds__month - , DATE_TRUNC(bookings_source_src_28000.ds, quarter) AS booking__ds__quarter - , DATE_TRUNC(bookings_source_src_28000.ds, year) AS booking__ds__year + , DATETIME_TRUNC(bookings_source_src_28000.ds, day) AS booking__ds__day + , DATETIME_TRUNC(bookings_source_src_28000.ds, isoweek) AS booking__ds__week + , DATETIME_TRUNC(bookings_source_src_28000.ds, month) AS booking__ds__month + , DATETIME_TRUNC(bookings_source_src_28000.ds, quarter) AS booking__ds__quarter + , DATETIME_TRUNC(bookings_source_src_28000.ds, year) AS booking__ds__year , EXTRACT(year FROM bookings_source_src_28000.ds) AS booking__ds__extract_year , EXTRACT(quarter FROM bookings_source_src_28000.ds) AS booking__ds__extract_quarter , EXTRACT(month FROM bookings_source_src_28000.ds) AS booking__ds__extract_month , EXTRACT(day FROM bookings_source_src_28000.ds) AS booking__ds__extract_day , IF(EXTRACT(dayofweek FROM bookings_source_src_28000.ds) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_28000.ds) - 1) AS booking__ds__extract_dow , EXTRACT(dayofyear FROM bookings_source_src_28000.ds) AS booking__ds__extract_doy - , DATE_TRUNC(bookings_source_src_28000.ds_partitioned, day) AS booking__ds_partitioned__day - , DATE_TRUNC(bookings_source_src_28000.ds_partitioned, isoweek) AS booking__ds_partitioned__week - , DATE_TRUNC(bookings_source_src_28000.ds_partitioned, month) AS booking__ds_partitioned__month - , DATE_TRUNC(bookings_source_src_28000.ds_partitioned, quarter) AS booking__ds_partitioned__quarter - , DATE_TRUNC(bookings_source_src_28000.ds_partitioned, year) AS booking__ds_partitioned__year + , DATETIME_TRUNC(bookings_source_src_28000.ds_partitioned, day) AS booking__ds_partitioned__day + , DATETIME_TRUNC(bookings_source_src_28000.ds_partitioned, isoweek) AS booking__ds_partitioned__week + , DATETIME_TRUNC(bookings_source_src_28000.ds_partitioned, month) AS booking__ds_partitioned__month + , DATETIME_TRUNC(bookings_source_src_28000.ds_partitioned, quarter) AS booking__ds_partitioned__quarter + , DATETIME_TRUNC(bookings_source_src_28000.ds_partitioned, year) AS booking__ds_partitioned__year , EXTRACT(year FROM bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__extract_year , EXTRACT(quarter FROM bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__extract_quarter , EXTRACT(month FROM bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__extract_month , EXTRACT(day FROM bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__extract_day , IF(EXTRACT(dayofweek FROM bookings_source_src_28000.ds_partitioned) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_28000.ds_partitioned) - 1) AS booking__ds_partitioned__extract_dow , EXTRACT(dayofyear FROM bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__extract_doy - , DATE_TRUNC(bookings_source_src_28000.paid_at, day) AS booking__paid_at__day - , DATE_TRUNC(bookings_source_src_28000.paid_at, isoweek) AS booking__paid_at__week - , DATE_TRUNC(bookings_source_src_28000.paid_at, month) AS booking__paid_at__month - , DATE_TRUNC(bookings_source_src_28000.paid_at, quarter) AS booking__paid_at__quarter - , DATE_TRUNC(bookings_source_src_28000.paid_at, year) AS booking__paid_at__year + , DATETIME_TRUNC(bookings_source_src_28000.paid_at, day) AS booking__paid_at__day + , DATETIME_TRUNC(bookings_source_src_28000.paid_at, isoweek) AS booking__paid_at__week + , DATETIME_TRUNC(bookings_source_src_28000.paid_at, month) AS booking__paid_at__month + , DATETIME_TRUNC(bookings_source_src_28000.paid_at, quarter) AS booking__paid_at__quarter + , DATETIME_TRUNC(bookings_source_src_28000.paid_at, year) AS booking__paid_at__year , EXTRACT(year FROM bookings_source_src_28000.paid_at) AS booking__paid_at__extract_year , EXTRACT(quarter FROM bookings_source_src_28000.paid_at) AS booking__paid_at__extract_quarter , EXTRACT(month FROM bookings_source_src_28000.paid_at) AS booking__paid_at__extract_month @@ -476,44 +476,44 @@ FROM ( -- Read Elements From Semantic Model 'views_source' SELECT 1 AS views - , DATE_TRUNC(views_source_src_28000.ds, day) AS ds__day - , DATE_TRUNC(views_source_src_28000.ds, isoweek) AS ds__week - , DATE_TRUNC(views_source_src_28000.ds, month) AS ds__month - , DATE_TRUNC(views_source_src_28000.ds, quarter) AS ds__quarter - , DATE_TRUNC(views_source_src_28000.ds, year) AS ds__year + , DATETIME_TRUNC(views_source_src_28000.ds, day) AS ds__day + , DATETIME_TRUNC(views_source_src_28000.ds, isoweek) AS ds__week + , DATETIME_TRUNC(views_source_src_28000.ds, month) AS ds__month + , DATETIME_TRUNC(views_source_src_28000.ds, quarter) AS ds__quarter + , DATETIME_TRUNC(views_source_src_28000.ds, year) AS ds__year , EXTRACT(year FROM views_source_src_28000.ds) AS ds__extract_year , EXTRACT(quarter FROM views_source_src_28000.ds) AS ds__extract_quarter , EXTRACT(month FROM views_source_src_28000.ds) AS ds__extract_month , EXTRACT(day FROM views_source_src_28000.ds) AS ds__extract_day , IF(EXTRACT(dayofweek FROM views_source_src_28000.ds) = 1, 7, EXTRACT(dayofweek FROM views_source_src_28000.ds) - 1) AS ds__extract_dow , EXTRACT(dayofyear FROM views_source_src_28000.ds) AS ds__extract_doy - , DATE_TRUNC(views_source_src_28000.ds_partitioned, day) AS ds_partitioned__day - , DATE_TRUNC(views_source_src_28000.ds_partitioned, isoweek) AS ds_partitioned__week - , DATE_TRUNC(views_source_src_28000.ds_partitioned, month) AS ds_partitioned__month - , DATE_TRUNC(views_source_src_28000.ds_partitioned, quarter) AS ds_partitioned__quarter - , DATE_TRUNC(views_source_src_28000.ds_partitioned, year) AS ds_partitioned__year + , DATETIME_TRUNC(views_source_src_28000.ds_partitioned, day) AS ds_partitioned__day + , DATETIME_TRUNC(views_source_src_28000.ds_partitioned, isoweek) AS ds_partitioned__week + , DATETIME_TRUNC(views_source_src_28000.ds_partitioned, month) AS ds_partitioned__month + , DATETIME_TRUNC(views_source_src_28000.ds_partitioned, quarter) AS ds_partitioned__quarter + , DATETIME_TRUNC(views_source_src_28000.ds_partitioned, year) AS ds_partitioned__year , EXTRACT(year FROM views_source_src_28000.ds_partitioned) AS ds_partitioned__extract_year , EXTRACT(quarter FROM views_source_src_28000.ds_partitioned) AS ds_partitioned__extract_quarter , EXTRACT(month FROM views_source_src_28000.ds_partitioned) AS ds_partitioned__extract_month , EXTRACT(day FROM views_source_src_28000.ds_partitioned) AS ds_partitioned__extract_day , IF(EXTRACT(dayofweek FROM views_source_src_28000.ds_partitioned) = 1, 7, EXTRACT(dayofweek FROM views_source_src_28000.ds_partitioned) - 1) AS ds_partitioned__extract_dow , EXTRACT(dayofyear FROM views_source_src_28000.ds_partitioned) AS ds_partitioned__extract_doy - , DATE_TRUNC(views_source_src_28000.ds, day) AS view__ds__day - , DATE_TRUNC(views_source_src_28000.ds, isoweek) AS view__ds__week - , DATE_TRUNC(views_source_src_28000.ds, month) AS view__ds__month - , DATE_TRUNC(views_source_src_28000.ds, quarter) AS view__ds__quarter - , DATE_TRUNC(views_source_src_28000.ds, year) AS view__ds__year + , DATETIME_TRUNC(views_source_src_28000.ds, day) AS view__ds__day + , DATETIME_TRUNC(views_source_src_28000.ds, isoweek) AS view__ds__week + , DATETIME_TRUNC(views_source_src_28000.ds, month) AS view__ds__month + , DATETIME_TRUNC(views_source_src_28000.ds, quarter) AS view__ds__quarter + , DATETIME_TRUNC(views_source_src_28000.ds, year) AS view__ds__year , EXTRACT(year FROM views_source_src_28000.ds) AS view__ds__extract_year , EXTRACT(quarter FROM views_source_src_28000.ds) AS view__ds__extract_quarter , EXTRACT(month FROM views_source_src_28000.ds) AS view__ds__extract_month , EXTRACT(day FROM views_source_src_28000.ds) AS view__ds__extract_day , IF(EXTRACT(dayofweek FROM views_source_src_28000.ds) = 1, 7, EXTRACT(dayofweek FROM views_source_src_28000.ds) - 1) AS view__ds__extract_dow , EXTRACT(dayofyear FROM views_source_src_28000.ds) AS view__ds__extract_doy - , DATE_TRUNC(views_source_src_28000.ds_partitioned, day) AS view__ds_partitioned__day - , DATE_TRUNC(views_source_src_28000.ds_partitioned, isoweek) AS view__ds_partitioned__week - , DATE_TRUNC(views_source_src_28000.ds_partitioned, month) AS view__ds_partitioned__month - , DATE_TRUNC(views_source_src_28000.ds_partitioned, quarter) AS view__ds_partitioned__quarter - , DATE_TRUNC(views_source_src_28000.ds_partitioned, year) AS view__ds_partitioned__year + , DATETIME_TRUNC(views_source_src_28000.ds_partitioned, day) AS view__ds_partitioned__day + , DATETIME_TRUNC(views_source_src_28000.ds_partitioned, isoweek) AS view__ds_partitioned__week + , DATETIME_TRUNC(views_source_src_28000.ds_partitioned, month) AS view__ds_partitioned__month + , DATETIME_TRUNC(views_source_src_28000.ds_partitioned, quarter) AS view__ds_partitioned__quarter + , DATETIME_TRUNC(views_source_src_28000.ds_partitioned, year) AS view__ds_partitioned__year , EXTRACT(year FROM views_source_src_28000.ds_partitioned) AS view__ds_partitioned__extract_year , EXTRACT(quarter FROM views_source_src_28000.ds_partitioned) AS view__ds_partitioned__extract_quarter , EXTRACT(month FROM views_source_src_28000.ds_partitioned) AS view__ds_partitioned__extract_month diff --git a/tests_metricflow/snapshots/test_metric_filter_rendering.py/SqlQueryPlan/BigQuery/test_query_with_multiple_metrics_in_filter__plan0.sql b/tests_metricflow/snapshots/test_metric_filter_rendering.py/SqlQueryPlan/BigQuery/test_query_with_multiple_metrics_in_filter__plan0.sql index dfac5d33d8..48e0714983 100644 --- a/tests_metricflow/snapshots/test_metric_filter_rendering.py/SqlQueryPlan/BigQuery/test_query_with_multiple_metrics_in_filter__plan0.sql +++ b/tests_metricflow/snapshots/test_metric_filter_rendering.py/SqlQueryPlan/BigQuery/test_query_with_multiple_metrics_in_filter__plan0.sql @@ -109,22 +109,22 @@ FROM ( 1 AS listings , listings_latest_src_28000.capacity AS largest_listing , listings_latest_src_28000.capacity AS smallest_listing - , DATE_TRUNC(listings_latest_src_28000.created_at, day) AS ds__day - , DATE_TRUNC(listings_latest_src_28000.created_at, isoweek) AS ds__week - , DATE_TRUNC(listings_latest_src_28000.created_at, month) AS ds__month - , DATE_TRUNC(listings_latest_src_28000.created_at, quarter) AS ds__quarter - , DATE_TRUNC(listings_latest_src_28000.created_at, year) AS ds__year + , DATETIME_TRUNC(listings_latest_src_28000.created_at, day) AS ds__day + , DATETIME_TRUNC(listings_latest_src_28000.created_at, isoweek) AS ds__week + , DATETIME_TRUNC(listings_latest_src_28000.created_at, month) AS ds__month + , DATETIME_TRUNC(listings_latest_src_28000.created_at, quarter) AS ds__quarter + , DATETIME_TRUNC(listings_latest_src_28000.created_at, year) AS ds__year , EXTRACT(year FROM listings_latest_src_28000.created_at) AS ds__extract_year , EXTRACT(quarter FROM listings_latest_src_28000.created_at) AS ds__extract_quarter , EXTRACT(month FROM listings_latest_src_28000.created_at) AS ds__extract_month , EXTRACT(day FROM listings_latest_src_28000.created_at) AS ds__extract_day , IF(EXTRACT(dayofweek FROM listings_latest_src_28000.created_at) = 1, 7, EXTRACT(dayofweek FROM listings_latest_src_28000.created_at) - 1) AS ds__extract_dow , EXTRACT(dayofyear FROM listings_latest_src_28000.created_at) AS ds__extract_doy - , DATE_TRUNC(listings_latest_src_28000.created_at, day) AS created_at__day - , DATE_TRUNC(listings_latest_src_28000.created_at, isoweek) AS created_at__week - , DATE_TRUNC(listings_latest_src_28000.created_at, month) AS created_at__month - , DATE_TRUNC(listings_latest_src_28000.created_at, quarter) AS created_at__quarter - , DATE_TRUNC(listings_latest_src_28000.created_at, year) AS created_at__year + , DATETIME_TRUNC(listings_latest_src_28000.created_at, day) AS created_at__day + , DATETIME_TRUNC(listings_latest_src_28000.created_at, isoweek) AS created_at__week + , DATETIME_TRUNC(listings_latest_src_28000.created_at, month) AS created_at__month + , DATETIME_TRUNC(listings_latest_src_28000.created_at, quarter) AS created_at__quarter + , DATETIME_TRUNC(listings_latest_src_28000.created_at, year) AS created_at__year , EXTRACT(year FROM listings_latest_src_28000.created_at) AS created_at__extract_year , EXTRACT(quarter FROM listings_latest_src_28000.created_at) AS created_at__extract_quarter , EXTRACT(month FROM listings_latest_src_28000.created_at) AS created_at__extract_month @@ -134,22 +134,22 @@ FROM ( , listings_latest_src_28000.country AS country_latest , listings_latest_src_28000.is_lux AS is_lux_latest , listings_latest_src_28000.capacity AS capacity_latest - , DATE_TRUNC(listings_latest_src_28000.created_at, day) AS listing__ds__day - , DATE_TRUNC(listings_latest_src_28000.created_at, isoweek) AS listing__ds__week - , DATE_TRUNC(listings_latest_src_28000.created_at, month) AS listing__ds__month - , DATE_TRUNC(listings_latest_src_28000.created_at, quarter) AS listing__ds__quarter - , DATE_TRUNC(listings_latest_src_28000.created_at, year) AS listing__ds__year + , DATETIME_TRUNC(listings_latest_src_28000.created_at, day) AS listing__ds__day + , DATETIME_TRUNC(listings_latest_src_28000.created_at, isoweek) AS listing__ds__week + , DATETIME_TRUNC(listings_latest_src_28000.created_at, month) AS listing__ds__month + , DATETIME_TRUNC(listings_latest_src_28000.created_at, quarter) AS listing__ds__quarter + , DATETIME_TRUNC(listings_latest_src_28000.created_at, year) AS listing__ds__year , EXTRACT(year FROM listings_latest_src_28000.created_at) AS listing__ds__extract_year , EXTRACT(quarter FROM listings_latest_src_28000.created_at) AS listing__ds__extract_quarter , EXTRACT(month FROM listings_latest_src_28000.created_at) AS listing__ds__extract_month , EXTRACT(day FROM listings_latest_src_28000.created_at) AS listing__ds__extract_day , IF(EXTRACT(dayofweek FROM listings_latest_src_28000.created_at) = 1, 7, EXTRACT(dayofweek FROM listings_latest_src_28000.created_at) - 1) AS listing__ds__extract_dow , EXTRACT(dayofyear FROM listings_latest_src_28000.created_at) AS listing__ds__extract_doy - , DATE_TRUNC(listings_latest_src_28000.created_at, day) AS listing__created_at__day - , DATE_TRUNC(listings_latest_src_28000.created_at, isoweek) AS listing__created_at__week - , DATE_TRUNC(listings_latest_src_28000.created_at, month) AS listing__created_at__month - , DATE_TRUNC(listings_latest_src_28000.created_at, quarter) AS listing__created_at__quarter - , DATE_TRUNC(listings_latest_src_28000.created_at, year) AS listing__created_at__year + , DATETIME_TRUNC(listings_latest_src_28000.created_at, day) AS listing__created_at__day + , DATETIME_TRUNC(listings_latest_src_28000.created_at, isoweek) AS listing__created_at__week + , DATETIME_TRUNC(listings_latest_src_28000.created_at, month) AS listing__created_at__month + , DATETIME_TRUNC(listings_latest_src_28000.created_at, quarter) AS listing__created_at__quarter + , DATETIME_TRUNC(listings_latest_src_28000.created_at, year) AS listing__created_at__year , EXTRACT(year FROM listings_latest_src_28000.created_at) AS listing__created_at__extract_year , EXTRACT(quarter FROM listings_latest_src_28000.created_at) AS listing__created_at__extract_quarter , EXTRACT(month FROM listings_latest_src_28000.created_at) AS listing__created_at__extract_month @@ -305,33 +305,33 @@ FROM ( , bookings_source_src_28000.booking_value AS approximate_continuous_booking_value_p99 , bookings_source_src_28000.booking_value AS approximate_discrete_booking_value_p99 , bookings_source_src_28000.is_instant - , DATE_TRUNC(bookings_source_src_28000.ds, day) AS ds__day - , DATE_TRUNC(bookings_source_src_28000.ds, isoweek) AS ds__week - , DATE_TRUNC(bookings_source_src_28000.ds, month) AS ds__month - , DATE_TRUNC(bookings_source_src_28000.ds, quarter) AS ds__quarter - , DATE_TRUNC(bookings_source_src_28000.ds, year) AS ds__year + , DATETIME_TRUNC(bookings_source_src_28000.ds, day) AS ds__day + , DATETIME_TRUNC(bookings_source_src_28000.ds, isoweek) AS ds__week + , DATETIME_TRUNC(bookings_source_src_28000.ds, month) AS ds__month + , DATETIME_TRUNC(bookings_source_src_28000.ds, quarter) AS ds__quarter + , DATETIME_TRUNC(bookings_source_src_28000.ds, year) AS ds__year , EXTRACT(year FROM bookings_source_src_28000.ds) AS ds__extract_year , EXTRACT(quarter FROM bookings_source_src_28000.ds) AS ds__extract_quarter , EXTRACT(month FROM bookings_source_src_28000.ds) AS ds__extract_month , EXTRACT(day FROM bookings_source_src_28000.ds) AS ds__extract_day , IF(EXTRACT(dayofweek FROM bookings_source_src_28000.ds) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_28000.ds) - 1) AS ds__extract_dow , EXTRACT(dayofyear FROM bookings_source_src_28000.ds) AS ds__extract_doy - , DATE_TRUNC(bookings_source_src_28000.ds_partitioned, day) AS ds_partitioned__day - , DATE_TRUNC(bookings_source_src_28000.ds_partitioned, isoweek) AS ds_partitioned__week - , DATE_TRUNC(bookings_source_src_28000.ds_partitioned, month) AS ds_partitioned__month - , DATE_TRUNC(bookings_source_src_28000.ds_partitioned, quarter) AS ds_partitioned__quarter - , DATE_TRUNC(bookings_source_src_28000.ds_partitioned, year) AS ds_partitioned__year + , DATETIME_TRUNC(bookings_source_src_28000.ds_partitioned, day) AS ds_partitioned__day + , DATETIME_TRUNC(bookings_source_src_28000.ds_partitioned, isoweek) AS ds_partitioned__week + , DATETIME_TRUNC(bookings_source_src_28000.ds_partitioned, month) AS ds_partitioned__month + , DATETIME_TRUNC(bookings_source_src_28000.ds_partitioned, quarter) AS ds_partitioned__quarter + , DATETIME_TRUNC(bookings_source_src_28000.ds_partitioned, year) AS ds_partitioned__year , EXTRACT(year FROM bookings_source_src_28000.ds_partitioned) AS ds_partitioned__extract_year , EXTRACT(quarter FROM bookings_source_src_28000.ds_partitioned) AS ds_partitioned__extract_quarter , EXTRACT(month FROM bookings_source_src_28000.ds_partitioned) AS ds_partitioned__extract_month , EXTRACT(day FROM bookings_source_src_28000.ds_partitioned) AS ds_partitioned__extract_day , IF(EXTRACT(dayofweek FROM bookings_source_src_28000.ds_partitioned) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_28000.ds_partitioned) - 1) AS ds_partitioned__extract_dow , EXTRACT(dayofyear FROM bookings_source_src_28000.ds_partitioned) AS ds_partitioned__extract_doy - , DATE_TRUNC(bookings_source_src_28000.paid_at, day) AS paid_at__day - , DATE_TRUNC(bookings_source_src_28000.paid_at, isoweek) AS paid_at__week - , DATE_TRUNC(bookings_source_src_28000.paid_at, month) AS paid_at__month - , DATE_TRUNC(bookings_source_src_28000.paid_at, quarter) AS paid_at__quarter - , DATE_TRUNC(bookings_source_src_28000.paid_at, year) AS paid_at__year + , DATETIME_TRUNC(bookings_source_src_28000.paid_at, day) AS paid_at__day + , DATETIME_TRUNC(bookings_source_src_28000.paid_at, isoweek) AS paid_at__week + , DATETIME_TRUNC(bookings_source_src_28000.paid_at, month) AS paid_at__month + , DATETIME_TRUNC(bookings_source_src_28000.paid_at, quarter) AS paid_at__quarter + , DATETIME_TRUNC(bookings_source_src_28000.paid_at, year) AS paid_at__year , EXTRACT(year FROM bookings_source_src_28000.paid_at) AS paid_at__extract_year , EXTRACT(quarter FROM bookings_source_src_28000.paid_at) AS paid_at__extract_quarter , EXTRACT(month FROM bookings_source_src_28000.paid_at) AS paid_at__extract_month @@ -339,33 +339,33 @@ FROM ( , IF(EXTRACT(dayofweek FROM bookings_source_src_28000.paid_at) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_28000.paid_at) - 1) AS paid_at__extract_dow , EXTRACT(dayofyear FROM bookings_source_src_28000.paid_at) AS paid_at__extract_doy , bookings_source_src_28000.is_instant AS booking__is_instant - , DATE_TRUNC(bookings_source_src_28000.ds, day) AS booking__ds__day - , DATE_TRUNC(bookings_source_src_28000.ds, isoweek) AS booking__ds__week - , DATE_TRUNC(bookings_source_src_28000.ds, month) AS booking__ds__month - , DATE_TRUNC(bookings_source_src_28000.ds, quarter) AS booking__ds__quarter - , DATE_TRUNC(bookings_source_src_28000.ds, year) AS booking__ds__year + , DATETIME_TRUNC(bookings_source_src_28000.ds, day) AS booking__ds__day + , DATETIME_TRUNC(bookings_source_src_28000.ds, isoweek) AS booking__ds__week + , DATETIME_TRUNC(bookings_source_src_28000.ds, month) AS booking__ds__month + , DATETIME_TRUNC(bookings_source_src_28000.ds, quarter) AS booking__ds__quarter + , DATETIME_TRUNC(bookings_source_src_28000.ds, year) AS booking__ds__year , EXTRACT(year FROM bookings_source_src_28000.ds) AS booking__ds__extract_year , EXTRACT(quarter FROM bookings_source_src_28000.ds) AS booking__ds__extract_quarter , EXTRACT(month FROM bookings_source_src_28000.ds) AS booking__ds__extract_month , EXTRACT(day FROM bookings_source_src_28000.ds) AS booking__ds__extract_day , IF(EXTRACT(dayofweek FROM bookings_source_src_28000.ds) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_28000.ds) - 1) AS booking__ds__extract_dow , EXTRACT(dayofyear FROM bookings_source_src_28000.ds) AS booking__ds__extract_doy - , DATE_TRUNC(bookings_source_src_28000.ds_partitioned, day) AS booking__ds_partitioned__day - , DATE_TRUNC(bookings_source_src_28000.ds_partitioned, isoweek) AS booking__ds_partitioned__week - , DATE_TRUNC(bookings_source_src_28000.ds_partitioned, month) AS booking__ds_partitioned__month - , DATE_TRUNC(bookings_source_src_28000.ds_partitioned, quarter) AS booking__ds_partitioned__quarter - , DATE_TRUNC(bookings_source_src_28000.ds_partitioned, year) AS booking__ds_partitioned__year + , DATETIME_TRUNC(bookings_source_src_28000.ds_partitioned, day) AS booking__ds_partitioned__day + , DATETIME_TRUNC(bookings_source_src_28000.ds_partitioned, isoweek) AS booking__ds_partitioned__week + , DATETIME_TRUNC(bookings_source_src_28000.ds_partitioned, month) AS booking__ds_partitioned__month + , DATETIME_TRUNC(bookings_source_src_28000.ds_partitioned, quarter) AS booking__ds_partitioned__quarter + , DATETIME_TRUNC(bookings_source_src_28000.ds_partitioned, year) AS booking__ds_partitioned__year , EXTRACT(year FROM bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__extract_year , EXTRACT(quarter FROM bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__extract_quarter , EXTRACT(month FROM bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__extract_month , EXTRACT(day FROM bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__extract_day , IF(EXTRACT(dayofweek FROM bookings_source_src_28000.ds_partitioned) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_28000.ds_partitioned) - 1) AS booking__ds_partitioned__extract_dow , EXTRACT(dayofyear FROM bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__extract_doy - , DATE_TRUNC(bookings_source_src_28000.paid_at, day) AS booking__paid_at__day - , DATE_TRUNC(bookings_source_src_28000.paid_at, isoweek) AS booking__paid_at__week - , DATE_TRUNC(bookings_source_src_28000.paid_at, month) AS booking__paid_at__month - , DATE_TRUNC(bookings_source_src_28000.paid_at, quarter) AS booking__paid_at__quarter - , DATE_TRUNC(bookings_source_src_28000.paid_at, year) AS booking__paid_at__year + , DATETIME_TRUNC(bookings_source_src_28000.paid_at, day) AS booking__paid_at__day + , DATETIME_TRUNC(bookings_source_src_28000.paid_at, isoweek) AS booking__paid_at__week + , DATETIME_TRUNC(bookings_source_src_28000.paid_at, month) AS booking__paid_at__month + , DATETIME_TRUNC(bookings_source_src_28000.paid_at, quarter) AS booking__paid_at__quarter + , DATETIME_TRUNC(bookings_source_src_28000.paid_at, year) AS booking__paid_at__year , EXTRACT(year FROM bookings_source_src_28000.paid_at) AS booking__paid_at__extract_year , EXTRACT(quarter FROM bookings_source_src_28000.paid_at) AS booking__paid_at__extract_quarter , EXTRACT(month FROM bookings_source_src_28000.paid_at) AS booking__paid_at__extract_month @@ -528,33 +528,33 @@ FROM ( , bookings_source_src_28000.booking_value AS approximate_continuous_booking_value_p99 , bookings_source_src_28000.booking_value AS approximate_discrete_booking_value_p99 , bookings_source_src_28000.is_instant - , DATE_TRUNC(bookings_source_src_28000.ds, day) AS ds__day - , DATE_TRUNC(bookings_source_src_28000.ds, isoweek) AS ds__week - , DATE_TRUNC(bookings_source_src_28000.ds, month) AS ds__month - , DATE_TRUNC(bookings_source_src_28000.ds, quarter) AS ds__quarter - , DATE_TRUNC(bookings_source_src_28000.ds, year) AS ds__year + , DATETIME_TRUNC(bookings_source_src_28000.ds, day) AS ds__day + , DATETIME_TRUNC(bookings_source_src_28000.ds, isoweek) AS ds__week + , DATETIME_TRUNC(bookings_source_src_28000.ds, month) AS ds__month + , DATETIME_TRUNC(bookings_source_src_28000.ds, quarter) AS ds__quarter + , DATETIME_TRUNC(bookings_source_src_28000.ds, year) AS ds__year , EXTRACT(year FROM bookings_source_src_28000.ds) AS ds__extract_year , EXTRACT(quarter FROM bookings_source_src_28000.ds) AS ds__extract_quarter , EXTRACT(month FROM bookings_source_src_28000.ds) AS ds__extract_month , EXTRACT(day FROM bookings_source_src_28000.ds) AS ds__extract_day , IF(EXTRACT(dayofweek FROM bookings_source_src_28000.ds) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_28000.ds) - 1) AS ds__extract_dow , EXTRACT(dayofyear FROM bookings_source_src_28000.ds) AS ds__extract_doy - , DATE_TRUNC(bookings_source_src_28000.ds_partitioned, day) AS ds_partitioned__day - , DATE_TRUNC(bookings_source_src_28000.ds_partitioned, isoweek) AS ds_partitioned__week - , DATE_TRUNC(bookings_source_src_28000.ds_partitioned, month) AS ds_partitioned__month - , DATE_TRUNC(bookings_source_src_28000.ds_partitioned, quarter) AS ds_partitioned__quarter - , DATE_TRUNC(bookings_source_src_28000.ds_partitioned, year) AS ds_partitioned__year + , DATETIME_TRUNC(bookings_source_src_28000.ds_partitioned, day) AS ds_partitioned__day + , DATETIME_TRUNC(bookings_source_src_28000.ds_partitioned, isoweek) AS ds_partitioned__week + , DATETIME_TRUNC(bookings_source_src_28000.ds_partitioned, month) AS ds_partitioned__month + , DATETIME_TRUNC(bookings_source_src_28000.ds_partitioned, quarter) AS ds_partitioned__quarter + , DATETIME_TRUNC(bookings_source_src_28000.ds_partitioned, year) AS ds_partitioned__year , EXTRACT(year FROM bookings_source_src_28000.ds_partitioned) AS ds_partitioned__extract_year , EXTRACT(quarter FROM bookings_source_src_28000.ds_partitioned) AS ds_partitioned__extract_quarter , EXTRACT(month FROM bookings_source_src_28000.ds_partitioned) AS ds_partitioned__extract_month , EXTRACT(day FROM bookings_source_src_28000.ds_partitioned) AS ds_partitioned__extract_day , IF(EXTRACT(dayofweek FROM bookings_source_src_28000.ds_partitioned) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_28000.ds_partitioned) - 1) AS ds_partitioned__extract_dow , EXTRACT(dayofyear FROM bookings_source_src_28000.ds_partitioned) AS ds_partitioned__extract_doy - , DATE_TRUNC(bookings_source_src_28000.paid_at, day) AS paid_at__day - , DATE_TRUNC(bookings_source_src_28000.paid_at, isoweek) AS paid_at__week - , DATE_TRUNC(bookings_source_src_28000.paid_at, month) AS paid_at__month - , DATE_TRUNC(bookings_source_src_28000.paid_at, quarter) AS paid_at__quarter - , DATE_TRUNC(bookings_source_src_28000.paid_at, year) AS paid_at__year + , DATETIME_TRUNC(bookings_source_src_28000.paid_at, day) AS paid_at__day + , DATETIME_TRUNC(bookings_source_src_28000.paid_at, isoweek) AS paid_at__week + , DATETIME_TRUNC(bookings_source_src_28000.paid_at, month) AS paid_at__month + , DATETIME_TRUNC(bookings_source_src_28000.paid_at, quarter) AS paid_at__quarter + , DATETIME_TRUNC(bookings_source_src_28000.paid_at, year) AS paid_at__year , EXTRACT(year FROM bookings_source_src_28000.paid_at) AS paid_at__extract_year , EXTRACT(quarter FROM bookings_source_src_28000.paid_at) AS paid_at__extract_quarter , EXTRACT(month FROM bookings_source_src_28000.paid_at) AS paid_at__extract_month @@ -562,33 +562,33 @@ FROM ( , IF(EXTRACT(dayofweek FROM bookings_source_src_28000.paid_at) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_28000.paid_at) - 1) AS paid_at__extract_dow , EXTRACT(dayofyear FROM bookings_source_src_28000.paid_at) AS paid_at__extract_doy , bookings_source_src_28000.is_instant AS booking__is_instant - , DATE_TRUNC(bookings_source_src_28000.ds, day) AS booking__ds__day - , DATE_TRUNC(bookings_source_src_28000.ds, isoweek) AS booking__ds__week - , DATE_TRUNC(bookings_source_src_28000.ds, month) AS booking__ds__month - , DATE_TRUNC(bookings_source_src_28000.ds, quarter) AS booking__ds__quarter - , DATE_TRUNC(bookings_source_src_28000.ds, year) AS booking__ds__year + , DATETIME_TRUNC(bookings_source_src_28000.ds, day) AS booking__ds__day + , DATETIME_TRUNC(bookings_source_src_28000.ds, isoweek) AS booking__ds__week + , DATETIME_TRUNC(bookings_source_src_28000.ds, month) AS booking__ds__month + , DATETIME_TRUNC(bookings_source_src_28000.ds, quarter) AS booking__ds__quarter + , DATETIME_TRUNC(bookings_source_src_28000.ds, year) AS booking__ds__year , EXTRACT(year FROM bookings_source_src_28000.ds) AS booking__ds__extract_year , EXTRACT(quarter FROM bookings_source_src_28000.ds) AS booking__ds__extract_quarter , EXTRACT(month FROM bookings_source_src_28000.ds) AS booking__ds__extract_month , EXTRACT(day FROM bookings_source_src_28000.ds) AS booking__ds__extract_day , IF(EXTRACT(dayofweek FROM bookings_source_src_28000.ds) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_28000.ds) - 1) AS booking__ds__extract_dow , EXTRACT(dayofyear FROM bookings_source_src_28000.ds) AS booking__ds__extract_doy - , DATE_TRUNC(bookings_source_src_28000.ds_partitioned, day) AS booking__ds_partitioned__day - , DATE_TRUNC(bookings_source_src_28000.ds_partitioned, isoweek) AS booking__ds_partitioned__week - , DATE_TRUNC(bookings_source_src_28000.ds_partitioned, month) AS booking__ds_partitioned__month - , DATE_TRUNC(bookings_source_src_28000.ds_partitioned, quarter) AS booking__ds_partitioned__quarter - , DATE_TRUNC(bookings_source_src_28000.ds_partitioned, year) AS booking__ds_partitioned__year + , DATETIME_TRUNC(bookings_source_src_28000.ds_partitioned, day) AS booking__ds_partitioned__day + , DATETIME_TRUNC(bookings_source_src_28000.ds_partitioned, isoweek) AS booking__ds_partitioned__week + , DATETIME_TRUNC(bookings_source_src_28000.ds_partitioned, month) AS booking__ds_partitioned__month + , DATETIME_TRUNC(bookings_source_src_28000.ds_partitioned, quarter) AS booking__ds_partitioned__quarter + , DATETIME_TRUNC(bookings_source_src_28000.ds_partitioned, year) AS booking__ds_partitioned__year , EXTRACT(year FROM bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__extract_year , EXTRACT(quarter FROM bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__extract_quarter , EXTRACT(month FROM bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__extract_month , EXTRACT(day FROM bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__extract_day , IF(EXTRACT(dayofweek FROM bookings_source_src_28000.ds_partitioned) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_28000.ds_partitioned) - 1) AS booking__ds_partitioned__extract_dow , EXTRACT(dayofyear FROM bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__extract_doy - , DATE_TRUNC(bookings_source_src_28000.paid_at, day) AS booking__paid_at__day - , DATE_TRUNC(bookings_source_src_28000.paid_at, isoweek) AS booking__paid_at__week - , DATE_TRUNC(bookings_source_src_28000.paid_at, month) AS booking__paid_at__month - , DATE_TRUNC(bookings_source_src_28000.paid_at, quarter) AS booking__paid_at__quarter - , DATE_TRUNC(bookings_source_src_28000.paid_at, year) AS booking__paid_at__year + , DATETIME_TRUNC(bookings_source_src_28000.paid_at, day) AS booking__paid_at__day + , DATETIME_TRUNC(bookings_source_src_28000.paid_at, isoweek) AS booking__paid_at__week + , DATETIME_TRUNC(bookings_source_src_28000.paid_at, month) AS booking__paid_at__month + , DATETIME_TRUNC(bookings_source_src_28000.paid_at, quarter) AS booking__paid_at__quarter + , DATETIME_TRUNC(bookings_source_src_28000.paid_at, year) AS booking__paid_at__year , EXTRACT(year FROM bookings_source_src_28000.paid_at) AS booking__paid_at__extract_year , EXTRACT(quarter FROM bookings_source_src_28000.paid_at) AS booking__paid_at__extract_quarter , EXTRACT(month FROM bookings_source_src_28000.paid_at) AS booking__paid_at__extract_month diff --git a/tests_metricflow/snapshots/test_metric_filter_rendering.py/SqlQueryPlan/BigQuery/test_query_with_ratio_metric_in_where_filter__plan0.sql b/tests_metricflow/snapshots/test_metric_filter_rendering.py/SqlQueryPlan/BigQuery/test_query_with_ratio_metric_in_where_filter__plan0.sql index 22f9fc7ec3..6aa394d52c 100644 --- a/tests_metricflow/snapshots/test_metric_filter_rendering.py/SqlQueryPlan/BigQuery/test_query_with_ratio_metric_in_where_filter__plan0.sql +++ b/tests_metricflow/snapshots/test_metric_filter_rendering.py/SqlQueryPlan/BigQuery/test_query_with_ratio_metric_in_where_filter__plan0.sql @@ -106,22 +106,22 @@ FROM ( 1 AS listings , listings_latest_src_28000.capacity AS largest_listing , listings_latest_src_28000.capacity AS smallest_listing - , DATE_TRUNC(listings_latest_src_28000.created_at, day) AS ds__day - , DATE_TRUNC(listings_latest_src_28000.created_at, isoweek) AS ds__week - , DATE_TRUNC(listings_latest_src_28000.created_at, month) AS ds__month - , DATE_TRUNC(listings_latest_src_28000.created_at, quarter) AS ds__quarter - , DATE_TRUNC(listings_latest_src_28000.created_at, year) AS ds__year + , DATETIME_TRUNC(listings_latest_src_28000.created_at, day) AS ds__day + , DATETIME_TRUNC(listings_latest_src_28000.created_at, isoweek) AS ds__week + , DATETIME_TRUNC(listings_latest_src_28000.created_at, month) AS ds__month + , DATETIME_TRUNC(listings_latest_src_28000.created_at, quarter) AS ds__quarter + , DATETIME_TRUNC(listings_latest_src_28000.created_at, year) AS ds__year , EXTRACT(year FROM listings_latest_src_28000.created_at) AS ds__extract_year , EXTRACT(quarter FROM listings_latest_src_28000.created_at) AS ds__extract_quarter , EXTRACT(month FROM listings_latest_src_28000.created_at) AS ds__extract_month , EXTRACT(day FROM listings_latest_src_28000.created_at) AS ds__extract_day , IF(EXTRACT(dayofweek FROM listings_latest_src_28000.created_at) = 1, 7, EXTRACT(dayofweek FROM listings_latest_src_28000.created_at) - 1) AS ds__extract_dow , EXTRACT(dayofyear FROM listings_latest_src_28000.created_at) AS ds__extract_doy - , DATE_TRUNC(listings_latest_src_28000.created_at, day) AS created_at__day - , DATE_TRUNC(listings_latest_src_28000.created_at, isoweek) AS created_at__week - , DATE_TRUNC(listings_latest_src_28000.created_at, month) AS created_at__month - , DATE_TRUNC(listings_latest_src_28000.created_at, quarter) AS created_at__quarter - , DATE_TRUNC(listings_latest_src_28000.created_at, year) AS created_at__year + , DATETIME_TRUNC(listings_latest_src_28000.created_at, day) AS created_at__day + , DATETIME_TRUNC(listings_latest_src_28000.created_at, isoweek) AS created_at__week + , DATETIME_TRUNC(listings_latest_src_28000.created_at, month) AS created_at__month + , DATETIME_TRUNC(listings_latest_src_28000.created_at, quarter) AS created_at__quarter + , DATETIME_TRUNC(listings_latest_src_28000.created_at, year) AS created_at__year , EXTRACT(year FROM listings_latest_src_28000.created_at) AS created_at__extract_year , EXTRACT(quarter FROM listings_latest_src_28000.created_at) AS created_at__extract_quarter , EXTRACT(month FROM listings_latest_src_28000.created_at) AS created_at__extract_month @@ -131,22 +131,22 @@ FROM ( , listings_latest_src_28000.country AS country_latest , listings_latest_src_28000.is_lux AS is_lux_latest , listings_latest_src_28000.capacity AS capacity_latest - , DATE_TRUNC(listings_latest_src_28000.created_at, day) AS listing__ds__day - , DATE_TRUNC(listings_latest_src_28000.created_at, isoweek) AS listing__ds__week - , DATE_TRUNC(listings_latest_src_28000.created_at, month) AS listing__ds__month - , DATE_TRUNC(listings_latest_src_28000.created_at, quarter) AS listing__ds__quarter - , DATE_TRUNC(listings_latest_src_28000.created_at, year) AS listing__ds__year + , DATETIME_TRUNC(listings_latest_src_28000.created_at, day) AS listing__ds__day + , DATETIME_TRUNC(listings_latest_src_28000.created_at, isoweek) AS listing__ds__week + , DATETIME_TRUNC(listings_latest_src_28000.created_at, month) AS listing__ds__month + , DATETIME_TRUNC(listings_latest_src_28000.created_at, quarter) AS listing__ds__quarter + , DATETIME_TRUNC(listings_latest_src_28000.created_at, year) AS listing__ds__year , EXTRACT(year FROM listings_latest_src_28000.created_at) AS listing__ds__extract_year , EXTRACT(quarter FROM listings_latest_src_28000.created_at) AS listing__ds__extract_quarter , EXTRACT(month FROM listings_latest_src_28000.created_at) AS listing__ds__extract_month , EXTRACT(day FROM listings_latest_src_28000.created_at) AS listing__ds__extract_day , IF(EXTRACT(dayofweek FROM listings_latest_src_28000.created_at) = 1, 7, EXTRACT(dayofweek FROM listings_latest_src_28000.created_at) - 1) AS listing__ds__extract_dow , EXTRACT(dayofyear FROM listings_latest_src_28000.created_at) AS listing__ds__extract_doy - , DATE_TRUNC(listings_latest_src_28000.created_at, day) AS listing__created_at__day - , DATE_TRUNC(listings_latest_src_28000.created_at, isoweek) AS listing__created_at__week - , DATE_TRUNC(listings_latest_src_28000.created_at, month) AS listing__created_at__month - , DATE_TRUNC(listings_latest_src_28000.created_at, quarter) AS listing__created_at__quarter - , DATE_TRUNC(listings_latest_src_28000.created_at, year) AS listing__created_at__year + , DATETIME_TRUNC(listings_latest_src_28000.created_at, day) AS listing__created_at__day + , DATETIME_TRUNC(listings_latest_src_28000.created_at, isoweek) AS listing__created_at__week + , DATETIME_TRUNC(listings_latest_src_28000.created_at, month) AS listing__created_at__month + , DATETIME_TRUNC(listings_latest_src_28000.created_at, quarter) AS listing__created_at__quarter + , DATETIME_TRUNC(listings_latest_src_28000.created_at, year) AS listing__created_at__year , EXTRACT(year FROM listings_latest_src_28000.created_at) AS listing__created_at__extract_year , EXTRACT(quarter FROM listings_latest_src_28000.created_at) AS listing__created_at__extract_quarter , EXTRACT(month FROM listings_latest_src_28000.created_at) AS listing__created_at__extract_month @@ -313,33 +313,33 @@ FROM ( , bookings_source_src_28000.booking_value AS approximate_continuous_booking_value_p99 , bookings_source_src_28000.booking_value AS approximate_discrete_booking_value_p99 , bookings_source_src_28000.is_instant - , DATE_TRUNC(bookings_source_src_28000.ds, day) AS ds__day - , DATE_TRUNC(bookings_source_src_28000.ds, isoweek) AS ds__week - , DATE_TRUNC(bookings_source_src_28000.ds, month) AS ds__month - , DATE_TRUNC(bookings_source_src_28000.ds, quarter) AS ds__quarter - , DATE_TRUNC(bookings_source_src_28000.ds, year) AS ds__year + , DATETIME_TRUNC(bookings_source_src_28000.ds, day) AS ds__day + , DATETIME_TRUNC(bookings_source_src_28000.ds, isoweek) AS ds__week + , DATETIME_TRUNC(bookings_source_src_28000.ds, month) AS ds__month + , DATETIME_TRUNC(bookings_source_src_28000.ds, quarter) AS ds__quarter + , DATETIME_TRUNC(bookings_source_src_28000.ds, year) AS ds__year , EXTRACT(year FROM bookings_source_src_28000.ds) AS ds__extract_year , EXTRACT(quarter FROM bookings_source_src_28000.ds) AS ds__extract_quarter , EXTRACT(month FROM bookings_source_src_28000.ds) AS ds__extract_month , EXTRACT(day FROM bookings_source_src_28000.ds) AS ds__extract_day , IF(EXTRACT(dayofweek FROM bookings_source_src_28000.ds) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_28000.ds) - 1) AS ds__extract_dow , EXTRACT(dayofyear FROM bookings_source_src_28000.ds) AS ds__extract_doy - , DATE_TRUNC(bookings_source_src_28000.ds_partitioned, day) AS ds_partitioned__day - , DATE_TRUNC(bookings_source_src_28000.ds_partitioned, isoweek) AS ds_partitioned__week - , DATE_TRUNC(bookings_source_src_28000.ds_partitioned, month) AS ds_partitioned__month - , DATE_TRUNC(bookings_source_src_28000.ds_partitioned, quarter) AS ds_partitioned__quarter - , DATE_TRUNC(bookings_source_src_28000.ds_partitioned, year) AS ds_partitioned__year + , DATETIME_TRUNC(bookings_source_src_28000.ds_partitioned, day) AS ds_partitioned__day + , DATETIME_TRUNC(bookings_source_src_28000.ds_partitioned, isoweek) AS ds_partitioned__week + , DATETIME_TRUNC(bookings_source_src_28000.ds_partitioned, month) AS ds_partitioned__month + , DATETIME_TRUNC(bookings_source_src_28000.ds_partitioned, quarter) AS ds_partitioned__quarter + , DATETIME_TRUNC(bookings_source_src_28000.ds_partitioned, year) AS ds_partitioned__year , EXTRACT(year FROM bookings_source_src_28000.ds_partitioned) AS ds_partitioned__extract_year , EXTRACT(quarter FROM bookings_source_src_28000.ds_partitioned) AS ds_partitioned__extract_quarter , EXTRACT(month FROM bookings_source_src_28000.ds_partitioned) AS ds_partitioned__extract_month , EXTRACT(day FROM bookings_source_src_28000.ds_partitioned) AS ds_partitioned__extract_day , IF(EXTRACT(dayofweek FROM bookings_source_src_28000.ds_partitioned) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_28000.ds_partitioned) - 1) AS ds_partitioned__extract_dow , EXTRACT(dayofyear FROM bookings_source_src_28000.ds_partitioned) AS ds_partitioned__extract_doy - , DATE_TRUNC(bookings_source_src_28000.paid_at, day) AS paid_at__day - , DATE_TRUNC(bookings_source_src_28000.paid_at, isoweek) AS paid_at__week - , DATE_TRUNC(bookings_source_src_28000.paid_at, month) AS paid_at__month - , DATE_TRUNC(bookings_source_src_28000.paid_at, quarter) AS paid_at__quarter - , DATE_TRUNC(bookings_source_src_28000.paid_at, year) AS paid_at__year + , DATETIME_TRUNC(bookings_source_src_28000.paid_at, day) AS paid_at__day + , DATETIME_TRUNC(bookings_source_src_28000.paid_at, isoweek) AS paid_at__week + , DATETIME_TRUNC(bookings_source_src_28000.paid_at, month) AS paid_at__month + , DATETIME_TRUNC(bookings_source_src_28000.paid_at, quarter) AS paid_at__quarter + , DATETIME_TRUNC(bookings_source_src_28000.paid_at, year) AS paid_at__year , EXTRACT(year FROM bookings_source_src_28000.paid_at) AS paid_at__extract_year , EXTRACT(quarter FROM bookings_source_src_28000.paid_at) AS paid_at__extract_quarter , EXTRACT(month FROM bookings_source_src_28000.paid_at) AS paid_at__extract_month @@ -347,33 +347,33 @@ FROM ( , IF(EXTRACT(dayofweek FROM bookings_source_src_28000.paid_at) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_28000.paid_at) - 1) AS paid_at__extract_dow , EXTRACT(dayofyear FROM bookings_source_src_28000.paid_at) AS paid_at__extract_doy , bookings_source_src_28000.is_instant AS booking__is_instant - , DATE_TRUNC(bookings_source_src_28000.ds, day) AS booking__ds__day - , DATE_TRUNC(bookings_source_src_28000.ds, isoweek) AS booking__ds__week - , DATE_TRUNC(bookings_source_src_28000.ds, month) AS booking__ds__month - , DATE_TRUNC(bookings_source_src_28000.ds, quarter) AS booking__ds__quarter - , DATE_TRUNC(bookings_source_src_28000.ds, year) AS booking__ds__year + , DATETIME_TRUNC(bookings_source_src_28000.ds, day) AS booking__ds__day + , DATETIME_TRUNC(bookings_source_src_28000.ds, isoweek) AS booking__ds__week + , DATETIME_TRUNC(bookings_source_src_28000.ds, month) AS booking__ds__month + , DATETIME_TRUNC(bookings_source_src_28000.ds, quarter) AS booking__ds__quarter + , DATETIME_TRUNC(bookings_source_src_28000.ds, year) AS booking__ds__year , EXTRACT(year FROM bookings_source_src_28000.ds) AS booking__ds__extract_year , EXTRACT(quarter FROM bookings_source_src_28000.ds) AS booking__ds__extract_quarter , EXTRACT(month FROM bookings_source_src_28000.ds) AS booking__ds__extract_month , EXTRACT(day FROM bookings_source_src_28000.ds) AS booking__ds__extract_day , IF(EXTRACT(dayofweek FROM bookings_source_src_28000.ds) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_28000.ds) - 1) AS booking__ds__extract_dow , EXTRACT(dayofyear FROM bookings_source_src_28000.ds) AS booking__ds__extract_doy - , DATE_TRUNC(bookings_source_src_28000.ds_partitioned, day) AS booking__ds_partitioned__day - , DATE_TRUNC(bookings_source_src_28000.ds_partitioned, isoweek) AS booking__ds_partitioned__week - , DATE_TRUNC(bookings_source_src_28000.ds_partitioned, month) AS booking__ds_partitioned__month - , DATE_TRUNC(bookings_source_src_28000.ds_partitioned, quarter) AS booking__ds_partitioned__quarter - , DATE_TRUNC(bookings_source_src_28000.ds_partitioned, year) AS booking__ds_partitioned__year + , DATETIME_TRUNC(bookings_source_src_28000.ds_partitioned, day) AS booking__ds_partitioned__day + , DATETIME_TRUNC(bookings_source_src_28000.ds_partitioned, isoweek) AS booking__ds_partitioned__week + , DATETIME_TRUNC(bookings_source_src_28000.ds_partitioned, month) AS booking__ds_partitioned__month + , DATETIME_TRUNC(bookings_source_src_28000.ds_partitioned, quarter) AS booking__ds_partitioned__quarter + , DATETIME_TRUNC(bookings_source_src_28000.ds_partitioned, year) AS booking__ds_partitioned__year , EXTRACT(year FROM bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__extract_year , EXTRACT(quarter FROM bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__extract_quarter , EXTRACT(month FROM bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__extract_month , EXTRACT(day FROM bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__extract_day , IF(EXTRACT(dayofweek FROM bookings_source_src_28000.ds_partitioned) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_28000.ds_partitioned) - 1) AS booking__ds_partitioned__extract_dow , EXTRACT(dayofyear FROM bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__extract_doy - , DATE_TRUNC(bookings_source_src_28000.paid_at, day) AS booking__paid_at__day - , DATE_TRUNC(bookings_source_src_28000.paid_at, isoweek) AS booking__paid_at__week - , DATE_TRUNC(bookings_source_src_28000.paid_at, month) AS booking__paid_at__month - , DATE_TRUNC(bookings_source_src_28000.paid_at, quarter) AS booking__paid_at__quarter - , DATE_TRUNC(bookings_source_src_28000.paid_at, year) AS booking__paid_at__year + , DATETIME_TRUNC(bookings_source_src_28000.paid_at, day) AS booking__paid_at__day + , DATETIME_TRUNC(bookings_source_src_28000.paid_at, isoweek) AS booking__paid_at__week + , DATETIME_TRUNC(bookings_source_src_28000.paid_at, month) AS booking__paid_at__month + , DATETIME_TRUNC(bookings_source_src_28000.paid_at, quarter) AS booking__paid_at__quarter + , DATETIME_TRUNC(bookings_source_src_28000.paid_at, year) AS booking__paid_at__year , EXTRACT(year FROM bookings_source_src_28000.paid_at) AS booking__paid_at__extract_year , EXTRACT(quarter FROM bookings_source_src_28000.paid_at) AS booking__paid_at__extract_quarter , EXTRACT(month FROM bookings_source_src_28000.paid_at) AS booking__paid_at__extract_month @@ -528,33 +528,33 @@ FROM ( , bookings_source_src_28000.booking_value AS approximate_continuous_booking_value_p99 , bookings_source_src_28000.booking_value AS approximate_discrete_booking_value_p99 , bookings_source_src_28000.is_instant - , DATE_TRUNC(bookings_source_src_28000.ds, day) AS ds__day - , DATE_TRUNC(bookings_source_src_28000.ds, isoweek) AS ds__week - , DATE_TRUNC(bookings_source_src_28000.ds, month) AS ds__month - , DATE_TRUNC(bookings_source_src_28000.ds, quarter) AS ds__quarter - , DATE_TRUNC(bookings_source_src_28000.ds, year) AS ds__year + , DATETIME_TRUNC(bookings_source_src_28000.ds, day) AS ds__day + , DATETIME_TRUNC(bookings_source_src_28000.ds, isoweek) AS ds__week + , DATETIME_TRUNC(bookings_source_src_28000.ds, month) AS ds__month + , DATETIME_TRUNC(bookings_source_src_28000.ds, quarter) AS ds__quarter + , DATETIME_TRUNC(bookings_source_src_28000.ds, year) AS ds__year , EXTRACT(year FROM bookings_source_src_28000.ds) AS ds__extract_year , EXTRACT(quarter FROM bookings_source_src_28000.ds) AS ds__extract_quarter , EXTRACT(month FROM bookings_source_src_28000.ds) AS ds__extract_month , EXTRACT(day FROM bookings_source_src_28000.ds) AS ds__extract_day , IF(EXTRACT(dayofweek FROM bookings_source_src_28000.ds) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_28000.ds) - 1) AS ds__extract_dow , EXTRACT(dayofyear FROM bookings_source_src_28000.ds) AS ds__extract_doy - , DATE_TRUNC(bookings_source_src_28000.ds_partitioned, day) AS ds_partitioned__day - , DATE_TRUNC(bookings_source_src_28000.ds_partitioned, isoweek) AS ds_partitioned__week - , DATE_TRUNC(bookings_source_src_28000.ds_partitioned, month) AS ds_partitioned__month - , DATE_TRUNC(bookings_source_src_28000.ds_partitioned, quarter) AS ds_partitioned__quarter - , DATE_TRUNC(bookings_source_src_28000.ds_partitioned, year) AS ds_partitioned__year + , DATETIME_TRUNC(bookings_source_src_28000.ds_partitioned, day) AS ds_partitioned__day + , DATETIME_TRUNC(bookings_source_src_28000.ds_partitioned, isoweek) AS ds_partitioned__week + , DATETIME_TRUNC(bookings_source_src_28000.ds_partitioned, month) AS ds_partitioned__month + , DATETIME_TRUNC(bookings_source_src_28000.ds_partitioned, quarter) AS ds_partitioned__quarter + , DATETIME_TRUNC(bookings_source_src_28000.ds_partitioned, year) AS ds_partitioned__year , EXTRACT(year FROM bookings_source_src_28000.ds_partitioned) AS ds_partitioned__extract_year , EXTRACT(quarter FROM bookings_source_src_28000.ds_partitioned) AS ds_partitioned__extract_quarter , EXTRACT(month FROM bookings_source_src_28000.ds_partitioned) AS ds_partitioned__extract_month , EXTRACT(day FROM bookings_source_src_28000.ds_partitioned) AS ds_partitioned__extract_day , IF(EXTRACT(dayofweek FROM bookings_source_src_28000.ds_partitioned) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_28000.ds_partitioned) - 1) AS ds_partitioned__extract_dow , EXTRACT(dayofyear FROM bookings_source_src_28000.ds_partitioned) AS ds_partitioned__extract_doy - , DATE_TRUNC(bookings_source_src_28000.paid_at, day) AS paid_at__day - , DATE_TRUNC(bookings_source_src_28000.paid_at, isoweek) AS paid_at__week - , DATE_TRUNC(bookings_source_src_28000.paid_at, month) AS paid_at__month - , DATE_TRUNC(bookings_source_src_28000.paid_at, quarter) AS paid_at__quarter - , DATE_TRUNC(bookings_source_src_28000.paid_at, year) AS paid_at__year + , DATETIME_TRUNC(bookings_source_src_28000.paid_at, day) AS paid_at__day + , DATETIME_TRUNC(bookings_source_src_28000.paid_at, isoweek) AS paid_at__week + , DATETIME_TRUNC(bookings_source_src_28000.paid_at, month) AS paid_at__month + , DATETIME_TRUNC(bookings_source_src_28000.paid_at, quarter) AS paid_at__quarter + , DATETIME_TRUNC(bookings_source_src_28000.paid_at, year) AS paid_at__year , EXTRACT(year FROM bookings_source_src_28000.paid_at) AS paid_at__extract_year , EXTRACT(quarter FROM bookings_source_src_28000.paid_at) AS paid_at__extract_quarter , EXTRACT(month FROM bookings_source_src_28000.paid_at) AS paid_at__extract_month @@ -562,33 +562,33 @@ FROM ( , IF(EXTRACT(dayofweek FROM bookings_source_src_28000.paid_at) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_28000.paid_at) - 1) AS paid_at__extract_dow , EXTRACT(dayofyear FROM bookings_source_src_28000.paid_at) AS paid_at__extract_doy , bookings_source_src_28000.is_instant AS booking__is_instant - , DATE_TRUNC(bookings_source_src_28000.ds, day) AS booking__ds__day - , DATE_TRUNC(bookings_source_src_28000.ds, isoweek) AS booking__ds__week - , DATE_TRUNC(bookings_source_src_28000.ds, month) AS booking__ds__month - , DATE_TRUNC(bookings_source_src_28000.ds, quarter) AS booking__ds__quarter - , DATE_TRUNC(bookings_source_src_28000.ds, year) AS booking__ds__year + , DATETIME_TRUNC(bookings_source_src_28000.ds, day) AS booking__ds__day + , DATETIME_TRUNC(bookings_source_src_28000.ds, isoweek) AS booking__ds__week + , DATETIME_TRUNC(bookings_source_src_28000.ds, month) AS booking__ds__month + , DATETIME_TRUNC(bookings_source_src_28000.ds, quarter) AS booking__ds__quarter + , DATETIME_TRUNC(bookings_source_src_28000.ds, year) AS booking__ds__year , EXTRACT(year FROM bookings_source_src_28000.ds) AS booking__ds__extract_year , EXTRACT(quarter FROM bookings_source_src_28000.ds) AS booking__ds__extract_quarter , EXTRACT(month FROM bookings_source_src_28000.ds) AS booking__ds__extract_month , EXTRACT(day FROM bookings_source_src_28000.ds) AS booking__ds__extract_day , IF(EXTRACT(dayofweek FROM bookings_source_src_28000.ds) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_28000.ds) - 1) AS booking__ds__extract_dow , EXTRACT(dayofyear FROM bookings_source_src_28000.ds) AS booking__ds__extract_doy - , DATE_TRUNC(bookings_source_src_28000.ds_partitioned, day) AS booking__ds_partitioned__day - , DATE_TRUNC(bookings_source_src_28000.ds_partitioned, isoweek) AS booking__ds_partitioned__week - , DATE_TRUNC(bookings_source_src_28000.ds_partitioned, month) AS booking__ds_partitioned__month - , DATE_TRUNC(bookings_source_src_28000.ds_partitioned, quarter) AS booking__ds_partitioned__quarter - , DATE_TRUNC(bookings_source_src_28000.ds_partitioned, year) AS booking__ds_partitioned__year + , DATETIME_TRUNC(bookings_source_src_28000.ds_partitioned, day) AS booking__ds_partitioned__day + , DATETIME_TRUNC(bookings_source_src_28000.ds_partitioned, isoweek) AS booking__ds_partitioned__week + , DATETIME_TRUNC(bookings_source_src_28000.ds_partitioned, month) AS booking__ds_partitioned__month + , DATETIME_TRUNC(bookings_source_src_28000.ds_partitioned, quarter) AS booking__ds_partitioned__quarter + , DATETIME_TRUNC(bookings_source_src_28000.ds_partitioned, year) AS booking__ds_partitioned__year , EXTRACT(year FROM bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__extract_year , EXTRACT(quarter FROM bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__extract_quarter , EXTRACT(month FROM bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__extract_month , EXTRACT(day FROM bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__extract_day , IF(EXTRACT(dayofweek FROM bookings_source_src_28000.ds_partitioned) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_28000.ds_partitioned) - 1) AS booking__ds_partitioned__extract_dow , EXTRACT(dayofyear FROM bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__extract_doy - , DATE_TRUNC(bookings_source_src_28000.paid_at, day) AS booking__paid_at__day - , DATE_TRUNC(bookings_source_src_28000.paid_at, isoweek) AS booking__paid_at__week - , DATE_TRUNC(bookings_source_src_28000.paid_at, month) AS booking__paid_at__month - , DATE_TRUNC(bookings_source_src_28000.paid_at, quarter) AS booking__paid_at__quarter - , DATE_TRUNC(bookings_source_src_28000.paid_at, year) AS booking__paid_at__year + , DATETIME_TRUNC(bookings_source_src_28000.paid_at, day) AS booking__paid_at__day + , DATETIME_TRUNC(bookings_source_src_28000.paid_at, isoweek) AS booking__paid_at__week + , DATETIME_TRUNC(bookings_source_src_28000.paid_at, month) AS booking__paid_at__month + , DATETIME_TRUNC(bookings_source_src_28000.paid_at, quarter) AS booking__paid_at__quarter + , DATETIME_TRUNC(bookings_source_src_28000.paid_at, year) AS booking__paid_at__year , EXTRACT(year FROM bookings_source_src_28000.paid_at) AS booking__paid_at__extract_year , EXTRACT(quarter FROM bookings_source_src_28000.paid_at) AS booking__paid_at__extract_quarter , EXTRACT(month FROM bookings_source_src_28000.paid_at) AS booking__paid_at__extract_month diff --git a/tests_metricflow/snapshots/test_metric_filter_rendering.py/SqlQueryPlan/BigQuery/test_query_with_simple_metric_in_where_filter__plan0.sql b/tests_metricflow/snapshots/test_metric_filter_rendering.py/SqlQueryPlan/BigQuery/test_query_with_simple_metric_in_where_filter__plan0.sql index 41ade821a0..b942daec60 100644 --- a/tests_metricflow/snapshots/test_metric_filter_rendering.py/SqlQueryPlan/BigQuery/test_query_with_simple_metric_in_where_filter__plan0.sql +++ b/tests_metricflow/snapshots/test_metric_filter_rendering.py/SqlQueryPlan/BigQuery/test_query_with_simple_metric_in_where_filter__plan0.sql @@ -106,22 +106,22 @@ FROM ( 1 AS listings , listings_latest_src_28000.capacity AS largest_listing , listings_latest_src_28000.capacity AS smallest_listing - , DATE_TRUNC(listings_latest_src_28000.created_at, day) AS ds__day - , DATE_TRUNC(listings_latest_src_28000.created_at, isoweek) AS ds__week - , DATE_TRUNC(listings_latest_src_28000.created_at, month) AS ds__month - , DATE_TRUNC(listings_latest_src_28000.created_at, quarter) AS ds__quarter - , DATE_TRUNC(listings_latest_src_28000.created_at, year) AS ds__year + , DATETIME_TRUNC(listings_latest_src_28000.created_at, day) AS ds__day + , DATETIME_TRUNC(listings_latest_src_28000.created_at, isoweek) AS ds__week + , DATETIME_TRUNC(listings_latest_src_28000.created_at, month) AS ds__month + , DATETIME_TRUNC(listings_latest_src_28000.created_at, quarter) AS ds__quarter + , DATETIME_TRUNC(listings_latest_src_28000.created_at, year) AS ds__year , EXTRACT(year FROM listings_latest_src_28000.created_at) AS ds__extract_year , EXTRACT(quarter FROM listings_latest_src_28000.created_at) AS ds__extract_quarter , EXTRACT(month FROM listings_latest_src_28000.created_at) AS ds__extract_month , EXTRACT(day FROM listings_latest_src_28000.created_at) AS ds__extract_day , IF(EXTRACT(dayofweek FROM listings_latest_src_28000.created_at) = 1, 7, EXTRACT(dayofweek FROM listings_latest_src_28000.created_at) - 1) AS ds__extract_dow , EXTRACT(dayofyear FROM listings_latest_src_28000.created_at) AS ds__extract_doy - , DATE_TRUNC(listings_latest_src_28000.created_at, day) AS created_at__day - , DATE_TRUNC(listings_latest_src_28000.created_at, isoweek) AS created_at__week - , DATE_TRUNC(listings_latest_src_28000.created_at, month) AS created_at__month - , DATE_TRUNC(listings_latest_src_28000.created_at, quarter) AS created_at__quarter - , DATE_TRUNC(listings_latest_src_28000.created_at, year) AS created_at__year + , DATETIME_TRUNC(listings_latest_src_28000.created_at, day) AS created_at__day + , DATETIME_TRUNC(listings_latest_src_28000.created_at, isoweek) AS created_at__week + , DATETIME_TRUNC(listings_latest_src_28000.created_at, month) AS created_at__month + , DATETIME_TRUNC(listings_latest_src_28000.created_at, quarter) AS created_at__quarter + , DATETIME_TRUNC(listings_latest_src_28000.created_at, year) AS created_at__year , EXTRACT(year FROM listings_latest_src_28000.created_at) AS created_at__extract_year , EXTRACT(quarter FROM listings_latest_src_28000.created_at) AS created_at__extract_quarter , EXTRACT(month FROM listings_latest_src_28000.created_at) AS created_at__extract_month @@ -131,22 +131,22 @@ FROM ( , listings_latest_src_28000.country AS country_latest , listings_latest_src_28000.is_lux AS is_lux_latest , listings_latest_src_28000.capacity AS capacity_latest - , DATE_TRUNC(listings_latest_src_28000.created_at, day) AS listing__ds__day - , DATE_TRUNC(listings_latest_src_28000.created_at, isoweek) AS listing__ds__week - , DATE_TRUNC(listings_latest_src_28000.created_at, month) AS listing__ds__month - , DATE_TRUNC(listings_latest_src_28000.created_at, quarter) AS listing__ds__quarter - , DATE_TRUNC(listings_latest_src_28000.created_at, year) AS listing__ds__year + , DATETIME_TRUNC(listings_latest_src_28000.created_at, day) AS listing__ds__day + , DATETIME_TRUNC(listings_latest_src_28000.created_at, isoweek) AS listing__ds__week + , DATETIME_TRUNC(listings_latest_src_28000.created_at, month) AS listing__ds__month + , DATETIME_TRUNC(listings_latest_src_28000.created_at, quarter) AS listing__ds__quarter + , DATETIME_TRUNC(listings_latest_src_28000.created_at, year) AS listing__ds__year , EXTRACT(year FROM listings_latest_src_28000.created_at) AS listing__ds__extract_year , EXTRACT(quarter FROM listings_latest_src_28000.created_at) AS listing__ds__extract_quarter , EXTRACT(month FROM listings_latest_src_28000.created_at) AS listing__ds__extract_month , EXTRACT(day FROM listings_latest_src_28000.created_at) AS listing__ds__extract_day , IF(EXTRACT(dayofweek FROM listings_latest_src_28000.created_at) = 1, 7, EXTRACT(dayofweek FROM listings_latest_src_28000.created_at) - 1) AS listing__ds__extract_dow , EXTRACT(dayofyear FROM listings_latest_src_28000.created_at) AS listing__ds__extract_doy - , DATE_TRUNC(listings_latest_src_28000.created_at, day) AS listing__created_at__day - , DATE_TRUNC(listings_latest_src_28000.created_at, isoweek) AS listing__created_at__week - , DATE_TRUNC(listings_latest_src_28000.created_at, month) AS listing__created_at__month - , DATE_TRUNC(listings_latest_src_28000.created_at, quarter) AS listing__created_at__quarter - , DATE_TRUNC(listings_latest_src_28000.created_at, year) AS listing__created_at__year + , DATETIME_TRUNC(listings_latest_src_28000.created_at, day) AS listing__created_at__day + , DATETIME_TRUNC(listings_latest_src_28000.created_at, isoweek) AS listing__created_at__week + , DATETIME_TRUNC(listings_latest_src_28000.created_at, month) AS listing__created_at__month + , DATETIME_TRUNC(listings_latest_src_28000.created_at, quarter) AS listing__created_at__quarter + , DATETIME_TRUNC(listings_latest_src_28000.created_at, year) AS listing__created_at__year , EXTRACT(year FROM listings_latest_src_28000.created_at) AS listing__created_at__extract_year , EXTRACT(quarter FROM listings_latest_src_28000.created_at) AS listing__created_at__extract_quarter , EXTRACT(month FROM listings_latest_src_28000.created_at) AS listing__created_at__extract_month @@ -302,33 +302,33 @@ FROM ( , bookings_source_src_28000.booking_value AS approximate_continuous_booking_value_p99 , bookings_source_src_28000.booking_value AS approximate_discrete_booking_value_p99 , bookings_source_src_28000.is_instant - , DATE_TRUNC(bookings_source_src_28000.ds, day) AS ds__day - , DATE_TRUNC(bookings_source_src_28000.ds, isoweek) AS ds__week - , DATE_TRUNC(bookings_source_src_28000.ds, month) AS ds__month - , DATE_TRUNC(bookings_source_src_28000.ds, quarter) AS ds__quarter - , DATE_TRUNC(bookings_source_src_28000.ds, year) AS ds__year + , DATETIME_TRUNC(bookings_source_src_28000.ds, day) AS ds__day + , DATETIME_TRUNC(bookings_source_src_28000.ds, isoweek) AS ds__week + , DATETIME_TRUNC(bookings_source_src_28000.ds, month) AS ds__month + , DATETIME_TRUNC(bookings_source_src_28000.ds, quarter) AS ds__quarter + , DATETIME_TRUNC(bookings_source_src_28000.ds, year) AS ds__year , EXTRACT(year FROM bookings_source_src_28000.ds) AS ds__extract_year , EXTRACT(quarter FROM bookings_source_src_28000.ds) AS ds__extract_quarter , EXTRACT(month FROM bookings_source_src_28000.ds) AS ds__extract_month , EXTRACT(day FROM bookings_source_src_28000.ds) AS ds__extract_day , IF(EXTRACT(dayofweek FROM bookings_source_src_28000.ds) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_28000.ds) - 1) AS ds__extract_dow , EXTRACT(dayofyear FROM bookings_source_src_28000.ds) AS ds__extract_doy - , DATE_TRUNC(bookings_source_src_28000.ds_partitioned, day) AS ds_partitioned__day - , DATE_TRUNC(bookings_source_src_28000.ds_partitioned, isoweek) AS ds_partitioned__week - , DATE_TRUNC(bookings_source_src_28000.ds_partitioned, month) AS ds_partitioned__month - , DATE_TRUNC(bookings_source_src_28000.ds_partitioned, quarter) AS ds_partitioned__quarter - , DATE_TRUNC(bookings_source_src_28000.ds_partitioned, year) AS ds_partitioned__year + , DATETIME_TRUNC(bookings_source_src_28000.ds_partitioned, day) AS ds_partitioned__day + , DATETIME_TRUNC(bookings_source_src_28000.ds_partitioned, isoweek) AS ds_partitioned__week + , DATETIME_TRUNC(bookings_source_src_28000.ds_partitioned, month) AS ds_partitioned__month + , DATETIME_TRUNC(bookings_source_src_28000.ds_partitioned, quarter) AS ds_partitioned__quarter + , DATETIME_TRUNC(bookings_source_src_28000.ds_partitioned, year) AS ds_partitioned__year , EXTRACT(year FROM bookings_source_src_28000.ds_partitioned) AS ds_partitioned__extract_year , EXTRACT(quarter FROM bookings_source_src_28000.ds_partitioned) AS ds_partitioned__extract_quarter , EXTRACT(month FROM bookings_source_src_28000.ds_partitioned) AS ds_partitioned__extract_month , EXTRACT(day FROM bookings_source_src_28000.ds_partitioned) AS ds_partitioned__extract_day , IF(EXTRACT(dayofweek FROM bookings_source_src_28000.ds_partitioned) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_28000.ds_partitioned) - 1) AS ds_partitioned__extract_dow , EXTRACT(dayofyear FROM bookings_source_src_28000.ds_partitioned) AS ds_partitioned__extract_doy - , DATE_TRUNC(bookings_source_src_28000.paid_at, day) AS paid_at__day - , DATE_TRUNC(bookings_source_src_28000.paid_at, isoweek) AS paid_at__week - , DATE_TRUNC(bookings_source_src_28000.paid_at, month) AS paid_at__month - , DATE_TRUNC(bookings_source_src_28000.paid_at, quarter) AS paid_at__quarter - , DATE_TRUNC(bookings_source_src_28000.paid_at, year) AS paid_at__year + , DATETIME_TRUNC(bookings_source_src_28000.paid_at, day) AS paid_at__day + , DATETIME_TRUNC(bookings_source_src_28000.paid_at, isoweek) AS paid_at__week + , DATETIME_TRUNC(bookings_source_src_28000.paid_at, month) AS paid_at__month + , DATETIME_TRUNC(bookings_source_src_28000.paid_at, quarter) AS paid_at__quarter + , DATETIME_TRUNC(bookings_source_src_28000.paid_at, year) AS paid_at__year , EXTRACT(year FROM bookings_source_src_28000.paid_at) AS paid_at__extract_year , EXTRACT(quarter FROM bookings_source_src_28000.paid_at) AS paid_at__extract_quarter , EXTRACT(month FROM bookings_source_src_28000.paid_at) AS paid_at__extract_month @@ -336,33 +336,33 @@ FROM ( , IF(EXTRACT(dayofweek FROM bookings_source_src_28000.paid_at) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_28000.paid_at) - 1) AS paid_at__extract_dow , EXTRACT(dayofyear FROM bookings_source_src_28000.paid_at) AS paid_at__extract_doy , bookings_source_src_28000.is_instant AS booking__is_instant - , DATE_TRUNC(bookings_source_src_28000.ds, day) AS booking__ds__day - , DATE_TRUNC(bookings_source_src_28000.ds, isoweek) AS booking__ds__week - , DATE_TRUNC(bookings_source_src_28000.ds, month) AS booking__ds__month - , DATE_TRUNC(bookings_source_src_28000.ds, quarter) AS booking__ds__quarter - , DATE_TRUNC(bookings_source_src_28000.ds, year) AS booking__ds__year + , DATETIME_TRUNC(bookings_source_src_28000.ds, day) AS booking__ds__day + , DATETIME_TRUNC(bookings_source_src_28000.ds, isoweek) AS booking__ds__week + , DATETIME_TRUNC(bookings_source_src_28000.ds, month) AS booking__ds__month + , DATETIME_TRUNC(bookings_source_src_28000.ds, quarter) AS booking__ds__quarter + , DATETIME_TRUNC(bookings_source_src_28000.ds, year) AS booking__ds__year , EXTRACT(year FROM bookings_source_src_28000.ds) AS booking__ds__extract_year , EXTRACT(quarter FROM bookings_source_src_28000.ds) AS booking__ds__extract_quarter , EXTRACT(month FROM bookings_source_src_28000.ds) AS booking__ds__extract_month , EXTRACT(day FROM bookings_source_src_28000.ds) AS booking__ds__extract_day , IF(EXTRACT(dayofweek FROM bookings_source_src_28000.ds) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_28000.ds) - 1) AS booking__ds__extract_dow , EXTRACT(dayofyear FROM bookings_source_src_28000.ds) AS booking__ds__extract_doy - , DATE_TRUNC(bookings_source_src_28000.ds_partitioned, day) AS booking__ds_partitioned__day - , DATE_TRUNC(bookings_source_src_28000.ds_partitioned, isoweek) AS booking__ds_partitioned__week - , DATE_TRUNC(bookings_source_src_28000.ds_partitioned, month) AS booking__ds_partitioned__month - , DATE_TRUNC(bookings_source_src_28000.ds_partitioned, quarter) AS booking__ds_partitioned__quarter - , DATE_TRUNC(bookings_source_src_28000.ds_partitioned, year) AS booking__ds_partitioned__year + , DATETIME_TRUNC(bookings_source_src_28000.ds_partitioned, day) AS booking__ds_partitioned__day + , DATETIME_TRUNC(bookings_source_src_28000.ds_partitioned, isoweek) AS booking__ds_partitioned__week + , DATETIME_TRUNC(bookings_source_src_28000.ds_partitioned, month) AS booking__ds_partitioned__month + , DATETIME_TRUNC(bookings_source_src_28000.ds_partitioned, quarter) AS booking__ds_partitioned__quarter + , DATETIME_TRUNC(bookings_source_src_28000.ds_partitioned, year) AS booking__ds_partitioned__year , EXTRACT(year FROM bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__extract_year , EXTRACT(quarter FROM bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__extract_quarter , EXTRACT(month FROM bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__extract_month , EXTRACT(day FROM bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__extract_day , IF(EXTRACT(dayofweek FROM bookings_source_src_28000.ds_partitioned) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_28000.ds_partitioned) - 1) AS booking__ds_partitioned__extract_dow , EXTRACT(dayofyear FROM bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__extract_doy - , DATE_TRUNC(bookings_source_src_28000.paid_at, day) AS booking__paid_at__day - , DATE_TRUNC(bookings_source_src_28000.paid_at, isoweek) AS booking__paid_at__week - , DATE_TRUNC(bookings_source_src_28000.paid_at, month) AS booking__paid_at__month - , DATE_TRUNC(bookings_source_src_28000.paid_at, quarter) AS booking__paid_at__quarter - , DATE_TRUNC(bookings_source_src_28000.paid_at, year) AS booking__paid_at__year + , DATETIME_TRUNC(bookings_source_src_28000.paid_at, day) AS booking__paid_at__day + , DATETIME_TRUNC(bookings_source_src_28000.paid_at, isoweek) AS booking__paid_at__week + , DATETIME_TRUNC(bookings_source_src_28000.paid_at, month) AS booking__paid_at__month + , DATETIME_TRUNC(bookings_source_src_28000.paid_at, quarter) AS booking__paid_at__quarter + , DATETIME_TRUNC(bookings_source_src_28000.paid_at, year) AS booking__paid_at__year , EXTRACT(year FROM bookings_source_src_28000.paid_at) AS booking__paid_at__extract_year , EXTRACT(quarter FROM bookings_source_src_28000.paid_at) AS booking__paid_at__extract_quarter , EXTRACT(month FROM bookings_source_src_28000.paid_at) AS booking__paid_at__extract_month diff --git a/tests_metricflow/snapshots/test_metric_time_dimension_to_sql.py/SqlQueryPlan/BigQuery/test_metric_time_dimension_transform_node_using_non_primary_time__plan0.sql b/tests_metricflow/snapshots/test_metric_time_dimension_to_sql.py/SqlQueryPlan/BigQuery/test_metric_time_dimension_transform_node_using_non_primary_time__plan0.sql index 4ba8023fdb..0f4d7a261b 100644 --- a/tests_metricflow/snapshots/test_metric_time_dimension_to_sql.py/SqlQueryPlan/BigQuery/test_metric_time_dimension_transform_node_using_non_primary_time__plan0.sql +++ b/tests_metricflow/snapshots/test_metric_time_dimension_to_sql.py/SqlQueryPlan/BigQuery/test_metric_time_dimension_transform_node_using_non_primary_time__plan0.sql @@ -104,33 +104,33 @@ FROM ( , bookings_source_src_28000.booking_value AS approximate_continuous_booking_value_p99 , bookings_source_src_28000.booking_value AS approximate_discrete_booking_value_p99 , bookings_source_src_28000.is_instant - , DATE_TRUNC(bookings_source_src_28000.ds, day) AS ds__day - , DATE_TRUNC(bookings_source_src_28000.ds, isoweek) AS ds__week - , DATE_TRUNC(bookings_source_src_28000.ds, month) AS ds__month - , DATE_TRUNC(bookings_source_src_28000.ds, quarter) AS ds__quarter - , DATE_TRUNC(bookings_source_src_28000.ds, year) AS ds__year + , DATETIME_TRUNC(bookings_source_src_28000.ds, day) AS ds__day + , DATETIME_TRUNC(bookings_source_src_28000.ds, isoweek) AS ds__week + , DATETIME_TRUNC(bookings_source_src_28000.ds, month) AS ds__month + , DATETIME_TRUNC(bookings_source_src_28000.ds, quarter) AS ds__quarter + , DATETIME_TRUNC(bookings_source_src_28000.ds, year) AS ds__year , EXTRACT(year FROM bookings_source_src_28000.ds) AS ds__extract_year , EXTRACT(quarter FROM bookings_source_src_28000.ds) AS ds__extract_quarter , EXTRACT(month FROM bookings_source_src_28000.ds) AS ds__extract_month , EXTRACT(day FROM bookings_source_src_28000.ds) AS ds__extract_day , IF(EXTRACT(dayofweek FROM bookings_source_src_28000.ds) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_28000.ds) - 1) AS ds__extract_dow , EXTRACT(dayofyear FROM bookings_source_src_28000.ds) AS ds__extract_doy - , DATE_TRUNC(bookings_source_src_28000.ds_partitioned, day) AS ds_partitioned__day - , DATE_TRUNC(bookings_source_src_28000.ds_partitioned, isoweek) AS ds_partitioned__week - , DATE_TRUNC(bookings_source_src_28000.ds_partitioned, month) AS ds_partitioned__month - , DATE_TRUNC(bookings_source_src_28000.ds_partitioned, quarter) AS ds_partitioned__quarter - , DATE_TRUNC(bookings_source_src_28000.ds_partitioned, year) AS ds_partitioned__year + , DATETIME_TRUNC(bookings_source_src_28000.ds_partitioned, day) AS ds_partitioned__day + , DATETIME_TRUNC(bookings_source_src_28000.ds_partitioned, isoweek) AS ds_partitioned__week + , DATETIME_TRUNC(bookings_source_src_28000.ds_partitioned, month) AS ds_partitioned__month + , DATETIME_TRUNC(bookings_source_src_28000.ds_partitioned, quarter) AS ds_partitioned__quarter + , DATETIME_TRUNC(bookings_source_src_28000.ds_partitioned, year) AS ds_partitioned__year , EXTRACT(year FROM bookings_source_src_28000.ds_partitioned) AS ds_partitioned__extract_year , EXTRACT(quarter FROM bookings_source_src_28000.ds_partitioned) AS ds_partitioned__extract_quarter , EXTRACT(month FROM bookings_source_src_28000.ds_partitioned) AS ds_partitioned__extract_month , EXTRACT(day FROM bookings_source_src_28000.ds_partitioned) AS ds_partitioned__extract_day , IF(EXTRACT(dayofweek FROM bookings_source_src_28000.ds_partitioned) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_28000.ds_partitioned) - 1) AS ds_partitioned__extract_dow , EXTRACT(dayofyear FROM bookings_source_src_28000.ds_partitioned) AS ds_partitioned__extract_doy - , DATE_TRUNC(bookings_source_src_28000.paid_at, day) AS paid_at__day - , DATE_TRUNC(bookings_source_src_28000.paid_at, isoweek) AS paid_at__week - , DATE_TRUNC(bookings_source_src_28000.paid_at, month) AS paid_at__month - , DATE_TRUNC(bookings_source_src_28000.paid_at, quarter) AS paid_at__quarter - , DATE_TRUNC(bookings_source_src_28000.paid_at, year) AS paid_at__year + , DATETIME_TRUNC(bookings_source_src_28000.paid_at, day) AS paid_at__day + , DATETIME_TRUNC(bookings_source_src_28000.paid_at, isoweek) AS paid_at__week + , DATETIME_TRUNC(bookings_source_src_28000.paid_at, month) AS paid_at__month + , DATETIME_TRUNC(bookings_source_src_28000.paid_at, quarter) AS paid_at__quarter + , DATETIME_TRUNC(bookings_source_src_28000.paid_at, year) AS paid_at__year , EXTRACT(year FROM bookings_source_src_28000.paid_at) AS paid_at__extract_year , EXTRACT(quarter FROM bookings_source_src_28000.paid_at) AS paid_at__extract_quarter , EXTRACT(month FROM bookings_source_src_28000.paid_at) AS paid_at__extract_month @@ -138,33 +138,33 @@ FROM ( , IF(EXTRACT(dayofweek FROM bookings_source_src_28000.paid_at) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_28000.paid_at) - 1) AS paid_at__extract_dow , EXTRACT(dayofyear FROM bookings_source_src_28000.paid_at) AS paid_at__extract_doy , bookings_source_src_28000.is_instant AS booking__is_instant - , DATE_TRUNC(bookings_source_src_28000.ds, day) AS booking__ds__day - , DATE_TRUNC(bookings_source_src_28000.ds, isoweek) AS booking__ds__week - , DATE_TRUNC(bookings_source_src_28000.ds, month) AS booking__ds__month - , DATE_TRUNC(bookings_source_src_28000.ds, quarter) AS booking__ds__quarter - , DATE_TRUNC(bookings_source_src_28000.ds, year) AS booking__ds__year + , DATETIME_TRUNC(bookings_source_src_28000.ds, day) AS booking__ds__day + , DATETIME_TRUNC(bookings_source_src_28000.ds, isoweek) AS booking__ds__week + , DATETIME_TRUNC(bookings_source_src_28000.ds, month) AS booking__ds__month + , DATETIME_TRUNC(bookings_source_src_28000.ds, quarter) AS booking__ds__quarter + , DATETIME_TRUNC(bookings_source_src_28000.ds, year) AS booking__ds__year , EXTRACT(year FROM bookings_source_src_28000.ds) AS booking__ds__extract_year , EXTRACT(quarter FROM bookings_source_src_28000.ds) AS booking__ds__extract_quarter , EXTRACT(month FROM bookings_source_src_28000.ds) AS booking__ds__extract_month , EXTRACT(day FROM bookings_source_src_28000.ds) AS booking__ds__extract_day , IF(EXTRACT(dayofweek FROM bookings_source_src_28000.ds) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_28000.ds) - 1) AS booking__ds__extract_dow , EXTRACT(dayofyear FROM bookings_source_src_28000.ds) AS booking__ds__extract_doy - , DATE_TRUNC(bookings_source_src_28000.ds_partitioned, day) AS booking__ds_partitioned__day - , DATE_TRUNC(bookings_source_src_28000.ds_partitioned, isoweek) AS booking__ds_partitioned__week - , DATE_TRUNC(bookings_source_src_28000.ds_partitioned, month) AS booking__ds_partitioned__month - , DATE_TRUNC(bookings_source_src_28000.ds_partitioned, quarter) AS booking__ds_partitioned__quarter - , DATE_TRUNC(bookings_source_src_28000.ds_partitioned, year) AS booking__ds_partitioned__year + , DATETIME_TRUNC(bookings_source_src_28000.ds_partitioned, day) AS booking__ds_partitioned__day + , DATETIME_TRUNC(bookings_source_src_28000.ds_partitioned, isoweek) AS booking__ds_partitioned__week + , DATETIME_TRUNC(bookings_source_src_28000.ds_partitioned, month) AS booking__ds_partitioned__month + , DATETIME_TRUNC(bookings_source_src_28000.ds_partitioned, quarter) AS booking__ds_partitioned__quarter + , DATETIME_TRUNC(bookings_source_src_28000.ds_partitioned, year) AS booking__ds_partitioned__year , EXTRACT(year FROM bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__extract_year , EXTRACT(quarter FROM bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__extract_quarter , EXTRACT(month FROM bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__extract_month , EXTRACT(day FROM bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__extract_day , IF(EXTRACT(dayofweek FROM bookings_source_src_28000.ds_partitioned) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_28000.ds_partitioned) - 1) AS booking__ds_partitioned__extract_dow , EXTRACT(dayofyear FROM bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__extract_doy - , DATE_TRUNC(bookings_source_src_28000.paid_at, day) AS booking__paid_at__day - , DATE_TRUNC(bookings_source_src_28000.paid_at, isoweek) AS booking__paid_at__week - , DATE_TRUNC(bookings_source_src_28000.paid_at, month) AS booking__paid_at__month - , DATE_TRUNC(bookings_source_src_28000.paid_at, quarter) AS booking__paid_at__quarter - , DATE_TRUNC(bookings_source_src_28000.paid_at, year) AS booking__paid_at__year + , DATETIME_TRUNC(bookings_source_src_28000.paid_at, day) AS booking__paid_at__day + , DATETIME_TRUNC(bookings_source_src_28000.paid_at, isoweek) AS booking__paid_at__week + , DATETIME_TRUNC(bookings_source_src_28000.paid_at, month) AS booking__paid_at__month + , DATETIME_TRUNC(bookings_source_src_28000.paid_at, quarter) AS booking__paid_at__quarter + , DATETIME_TRUNC(bookings_source_src_28000.paid_at, year) AS booking__paid_at__year , EXTRACT(year FROM bookings_source_src_28000.paid_at) AS booking__paid_at__extract_year , EXTRACT(quarter FROM bookings_source_src_28000.paid_at) AS booking__paid_at__extract_quarter , EXTRACT(month FROM bookings_source_src_28000.paid_at) AS booking__paid_at__extract_month diff --git a/tests_metricflow/snapshots/test_metric_time_dimension_to_sql.py/SqlQueryPlan/BigQuery/test_metric_time_dimension_transform_node_using_non_primary_time__plan0_optimized.sql b/tests_metricflow/snapshots/test_metric_time_dimension_to_sql.py/SqlQueryPlan/BigQuery/test_metric_time_dimension_transform_node_using_non_primary_time__plan0_optimized.sql index e3b37eb1a3..4765363716 100644 --- a/tests_metricflow/snapshots/test_metric_time_dimension_to_sql.py/SqlQueryPlan/BigQuery/test_metric_time_dimension_transform_node_using_non_primary_time__plan0_optimized.sql +++ b/tests_metricflow/snapshots/test_metric_time_dimension_to_sql.py/SqlQueryPlan/BigQuery/test_metric_time_dimension_transform_node_using_non_primary_time__plan0_optimized.sql @@ -1,77 +1,77 @@ -- Read Elements From Semantic Model 'bookings_source' -- Metric Time Dimension 'paid_at' SELECT - DATE_TRUNC(ds, day) AS ds__day - , DATE_TRUNC(ds, isoweek) AS ds__week - , DATE_TRUNC(ds, month) AS ds__month - , DATE_TRUNC(ds, quarter) AS ds__quarter - , DATE_TRUNC(ds, year) AS ds__year + DATETIME_TRUNC(ds, day) AS ds__day + , DATETIME_TRUNC(ds, isoweek) AS ds__week + , DATETIME_TRUNC(ds, month) AS ds__month + , DATETIME_TRUNC(ds, quarter) AS ds__quarter + , DATETIME_TRUNC(ds, year) AS ds__year , EXTRACT(year FROM ds) AS ds__extract_year , EXTRACT(quarter FROM ds) AS ds__extract_quarter , EXTRACT(month FROM ds) AS ds__extract_month , EXTRACT(day FROM ds) AS ds__extract_day , IF(EXTRACT(dayofweek FROM ds) = 1, 7, EXTRACT(dayofweek FROM ds) - 1) AS ds__extract_dow , EXTRACT(dayofyear FROM ds) AS ds__extract_doy - , DATE_TRUNC(ds_partitioned, day) AS ds_partitioned__day - , DATE_TRUNC(ds_partitioned, isoweek) AS ds_partitioned__week - , DATE_TRUNC(ds_partitioned, month) AS ds_partitioned__month - , DATE_TRUNC(ds_partitioned, quarter) AS ds_partitioned__quarter - , DATE_TRUNC(ds_partitioned, year) AS ds_partitioned__year + , DATETIME_TRUNC(ds_partitioned, day) AS ds_partitioned__day + , DATETIME_TRUNC(ds_partitioned, isoweek) AS ds_partitioned__week + , DATETIME_TRUNC(ds_partitioned, month) AS ds_partitioned__month + , DATETIME_TRUNC(ds_partitioned, quarter) AS ds_partitioned__quarter + , DATETIME_TRUNC(ds_partitioned, year) AS ds_partitioned__year , EXTRACT(year FROM ds_partitioned) AS ds_partitioned__extract_year , EXTRACT(quarter FROM ds_partitioned) AS ds_partitioned__extract_quarter , EXTRACT(month FROM ds_partitioned) AS ds_partitioned__extract_month , EXTRACT(day FROM ds_partitioned) AS ds_partitioned__extract_day , IF(EXTRACT(dayofweek FROM ds_partitioned) = 1, 7, EXTRACT(dayofweek FROM ds_partitioned) - 1) AS ds_partitioned__extract_dow , EXTRACT(dayofyear FROM ds_partitioned) AS ds_partitioned__extract_doy - , DATE_TRUNC(paid_at, day) AS paid_at__day - , DATE_TRUNC(paid_at, isoweek) AS paid_at__week - , DATE_TRUNC(paid_at, month) AS paid_at__month - , DATE_TRUNC(paid_at, quarter) AS paid_at__quarter - , DATE_TRUNC(paid_at, year) AS paid_at__year + , DATETIME_TRUNC(paid_at, day) AS paid_at__day + , DATETIME_TRUNC(paid_at, isoweek) AS paid_at__week + , DATETIME_TRUNC(paid_at, month) AS paid_at__month + , DATETIME_TRUNC(paid_at, quarter) AS paid_at__quarter + , DATETIME_TRUNC(paid_at, year) AS paid_at__year , EXTRACT(year FROM paid_at) AS paid_at__extract_year , EXTRACT(quarter FROM paid_at) AS paid_at__extract_quarter , EXTRACT(month FROM paid_at) AS paid_at__extract_month , EXTRACT(day FROM paid_at) AS paid_at__extract_day , IF(EXTRACT(dayofweek FROM paid_at) = 1, 7, EXTRACT(dayofweek FROM paid_at) - 1) AS paid_at__extract_dow , EXTRACT(dayofyear FROM paid_at) AS paid_at__extract_doy - , DATE_TRUNC(ds, day) AS booking__ds__day - , DATE_TRUNC(ds, isoweek) AS booking__ds__week - , DATE_TRUNC(ds, month) AS booking__ds__month - , DATE_TRUNC(ds, quarter) AS booking__ds__quarter - , DATE_TRUNC(ds, year) AS booking__ds__year + , DATETIME_TRUNC(ds, day) AS booking__ds__day + , DATETIME_TRUNC(ds, isoweek) AS booking__ds__week + , DATETIME_TRUNC(ds, month) AS booking__ds__month + , DATETIME_TRUNC(ds, quarter) AS booking__ds__quarter + , DATETIME_TRUNC(ds, year) AS booking__ds__year , EXTRACT(year FROM ds) AS booking__ds__extract_year , EXTRACT(quarter FROM ds) AS booking__ds__extract_quarter , EXTRACT(month FROM ds) AS booking__ds__extract_month , EXTRACT(day FROM ds) AS booking__ds__extract_day , IF(EXTRACT(dayofweek FROM ds) = 1, 7, EXTRACT(dayofweek FROM ds) - 1) AS booking__ds__extract_dow , EXTRACT(dayofyear FROM ds) AS booking__ds__extract_doy - , DATE_TRUNC(ds_partitioned, day) AS booking__ds_partitioned__day - , DATE_TRUNC(ds_partitioned, isoweek) AS booking__ds_partitioned__week - , DATE_TRUNC(ds_partitioned, month) AS booking__ds_partitioned__month - , DATE_TRUNC(ds_partitioned, quarter) AS booking__ds_partitioned__quarter - , DATE_TRUNC(ds_partitioned, year) AS booking__ds_partitioned__year + , DATETIME_TRUNC(ds_partitioned, day) AS booking__ds_partitioned__day + , DATETIME_TRUNC(ds_partitioned, isoweek) AS booking__ds_partitioned__week + , DATETIME_TRUNC(ds_partitioned, month) AS booking__ds_partitioned__month + , DATETIME_TRUNC(ds_partitioned, quarter) AS booking__ds_partitioned__quarter + , DATETIME_TRUNC(ds_partitioned, year) AS booking__ds_partitioned__year , EXTRACT(year FROM ds_partitioned) AS booking__ds_partitioned__extract_year , EXTRACT(quarter FROM ds_partitioned) AS booking__ds_partitioned__extract_quarter , EXTRACT(month FROM ds_partitioned) AS booking__ds_partitioned__extract_month , EXTRACT(day FROM ds_partitioned) AS booking__ds_partitioned__extract_day , IF(EXTRACT(dayofweek FROM ds_partitioned) = 1, 7, EXTRACT(dayofweek FROM ds_partitioned) - 1) AS booking__ds_partitioned__extract_dow , EXTRACT(dayofyear FROM ds_partitioned) AS booking__ds_partitioned__extract_doy - , DATE_TRUNC(paid_at, day) AS booking__paid_at__day - , DATE_TRUNC(paid_at, isoweek) AS booking__paid_at__week - , DATE_TRUNC(paid_at, month) AS booking__paid_at__month - , DATE_TRUNC(paid_at, quarter) AS booking__paid_at__quarter - , DATE_TRUNC(paid_at, year) AS booking__paid_at__year + , DATETIME_TRUNC(paid_at, day) AS booking__paid_at__day + , DATETIME_TRUNC(paid_at, isoweek) AS booking__paid_at__week + , DATETIME_TRUNC(paid_at, month) AS booking__paid_at__month + , DATETIME_TRUNC(paid_at, quarter) AS booking__paid_at__quarter + , DATETIME_TRUNC(paid_at, year) AS booking__paid_at__year , EXTRACT(year FROM paid_at) AS booking__paid_at__extract_year , EXTRACT(quarter FROM paid_at) AS booking__paid_at__extract_quarter , EXTRACT(month FROM paid_at) AS booking__paid_at__extract_month , EXTRACT(day FROM paid_at) AS booking__paid_at__extract_day , IF(EXTRACT(dayofweek FROM paid_at) = 1, 7, EXTRACT(dayofweek FROM paid_at) - 1) AS booking__paid_at__extract_dow , EXTRACT(dayofyear FROM paid_at) AS booking__paid_at__extract_doy - , DATE_TRUNC(paid_at, day) AS metric_time__day - , DATE_TRUNC(paid_at, isoweek) AS metric_time__week - , DATE_TRUNC(paid_at, month) AS metric_time__month - , DATE_TRUNC(paid_at, quarter) AS metric_time__quarter - , DATE_TRUNC(paid_at, year) AS metric_time__year + , DATETIME_TRUNC(paid_at, day) AS metric_time__day + , DATETIME_TRUNC(paid_at, isoweek) AS metric_time__week + , DATETIME_TRUNC(paid_at, month) AS metric_time__month + , DATETIME_TRUNC(paid_at, quarter) AS metric_time__quarter + , DATETIME_TRUNC(paid_at, year) AS metric_time__year , EXTRACT(year FROM paid_at) AS metric_time__extract_year , EXTRACT(quarter FROM paid_at) AS metric_time__extract_quarter , EXTRACT(month FROM paid_at) AS metric_time__extract_month diff --git a/tests_metricflow/snapshots/test_metric_time_dimension_to_sql.py/SqlQueryPlan/BigQuery/test_metric_time_dimension_transform_node_using_primary_time__plan0.sql b/tests_metricflow/snapshots/test_metric_time_dimension_to_sql.py/SqlQueryPlan/BigQuery/test_metric_time_dimension_transform_node_using_primary_time__plan0.sql index 2701d256a9..b37cf45f23 100644 --- a/tests_metricflow/snapshots/test_metric_time_dimension_to_sql.py/SqlQueryPlan/BigQuery/test_metric_time_dimension_transform_node_using_primary_time__plan0.sql +++ b/tests_metricflow/snapshots/test_metric_time_dimension_to_sql.py/SqlQueryPlan/BigQuery/test_metric_time_dimension_transform_node_using_primary_time__plan0.sql @@ -116,33 +116,33 @@ FROM ( , bookings_source_src_28000.booking_value AS approximate_continuous_booking_value_p99 , bookings_source_src_28000.booking_value AS approximate_discrete_booking_value_p99 , bookings_source_src_28000.is_instant - , DATE_TRUNC(bookings_source_src_28000.ds, day) AS ds__day - , DATE_TRUNC(bookings_source_src_28000.ds, isoweek) AS ds__week - , DATE_TRUNC(bookings_source_src_28000.ds, month) AS ds__month - , DATE_TRUNC(bookings_source_src_28000.ds, quarter) AS ds__quarter - , DATE_TRUNC(bookings_source_src_28000.ds, year) AS ds__year + , DATETIME_TRUNC(bookings_source_src_28000.ds, day) AS ds__day + , DATETIME_TRUNC(bookings_source_src_28000.ds, isoweek) AS ds__week + , DATETIME_TRUNC(bookings_source_src_28000.ds, month) AS ds__month + , DATETIME_TRUNC(bookings_source_src_28000.ds, quarter) AS ds__quarter + , DATETIME_TRUNC(bookings_source_src_28000.ds, year) AS ds__year , EXTRACT(year FROM bookings_source_src_28000.ds) AS ds__extract_year , EXTRACT(quarter FROM bookings_source_src_28000.ds) AS ds__extract_quarter , EXTRACT(month FROM bookings_source_src_28000.ds) AS ds__extract_month , EXTRACT(day FROM bookings_source_src_28000.ds) AS ds__extract_day , IF(EXTRACT(dayofweek FROM bookings_source_src_28000.ds) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_28000.ds) - 1) AS ds__extract_dow , EXTRACT(dayofyear FROM bookings_source_src_28000.ds) AS ds__extract_doy - , DATE_TRUNC(bookings_source_src_28000.ds_partitioned, day) AS ds_partitioned__day - , DATE_TRUNC(bookings_source_src_28000.ds_partitioned, isoweek) AS ds_partitioned__week - , DATE_TRUNC(bookings_source_src_28000.ds_partitioned, month) AS ds_partitioned__month - , DATE_TRUNC(bookings_source_src_28000.ds_partitioned, quarter) AS ds_partitioned__quarter - , DATE_TRUNC(bookings_source_src_28000.ds_partitioned, year) AS ds_partitioned__year + , DATETIME_TRUNC(bookings_source_src_28000.ds_partitioned, day) AS ds_partitioned__day + , DATETIME_TRUNC(bookings_source_src_28000.ds_partitioned, isoweek) AS ds_partitioned__week + , DATETIME_TRUNC(bookings_source_src_28000.ds_partitioned, month) AS ds_partitioned__month + , DATETIME_TRUNC(bookings_source_src_28000.ds_partitioned, quarter) AS ds_partitioned__quarter + , DATETIME_TRUNC(bookings_source_src_28000.ds_partitioned, year) AS ds_partitioned__year , EXTRACT(year FROM bookings_source_src_28000.ds_partitioned) AS ds_partitioned__extract_year , EXTRACT(quarter FROM bookings_source_src_28000.ds_partitioned) AS ds_partitioned__extract_quarter , EXTRACT(month FROM bookings_source_src_28000.ds_partitioned) AS ds_partitioned__extract_month , EXTRACT(day FROM bookings_source_src_28000.ds_partitioned) AS ds_partitioned__extract_day , IF(EXTRACT(dayofweek FROM bookings_source_src_28000.ds_partitioned) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_28000.ds_partitioned) - 1) AS ds_partitioned__extract_dow , EXTRACT(dayofyear FROM bookings_source_src_28000.ds_partitioned) AS ds_partitioned__extract_doy - , DATE_TRUNC(bookings_source_src_28000.paid_at, day) AS paid_at__day - , DATE_TRUNC(bookings_source_src_28000.paid_at, isoweek) AS paid_at__week - , DATE_TRUNC(bookings_source_src_28000.paid_at, month) AS paid_at__month - , DATE_TRUNC(bookings_source_src_28000.paid_at, quarter) AS paid_at__quarter - , DATE_TRUNC(bookings_source_src_28000.paid_at, year) AS paid_at__year + , DATETIME_TRUNC(bookings_source_src_28000.paid_at, day) AS paid_at__day + , DATETIME_TRUNC(bookings_source_src_28000.paid_at, isoweek) AS paid_at__week + , DATETIME_TRUNC(bookings_source_src_28000.paid_at, month) AS paid_at__month + , DATETIME_TRUNC(bookings_source_src_28000.paid_at, quarter) AS paid_at__quarter + , DATETIME_TRUNC(bookings_source_src_28000.paid_at, year) AS paid_at__year , EXTRACT(year FROM bookings_source_src_28000.paid_at) AS paid_at__extract_year , EXTRACT(quarter FROM bookings_source_src_28000.paid_at) AS paid_at__extract_quarter , EXTRACT(month FROM bookings_source_src_28000.paid_at) AS paid_at__extract_month @@ -150,33 +150,33 @@ FROM ( , IF(EXTRACT(dayofweek FROM bookings_source_src_28000.paid_at) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_28000.paid_at) - 1) AS paid_at__extract_dow , EXTRACT(dayofyear FROM bookings_source_src_28000.paid_at) AS paid_at__extract_doy , bookings_source_src_28000.is_instant AS booking__is_instant - , DATE_TRUNC(bookings_source_src_28000.ds, day) AS booking__ds__day - , DATE_TRUNC(bookings_source_src_28000.ds, isoweek) AS booking__ds__week - , DATE_TRUNC(bookings_source_src_28000.ds, month) AS booking__ds__month - , DATE_TRUNC(bookings_source_src_28000.ds, quarter) AS booking__ds__quarter - , DATE_TRUNC(bookings_source_src_28000.ds, year) AS booking__ds__year + , DATETIME_TRUNC(bookings_source_src_28000.ds, day) AS booking__ds__day + , DATETIME_TRUNC(bookings_source_src_28000.ds, isoweek) AS booking__ds__week + , DATETIME_TRUNC(bookings_source_src_28000.ds, month) AS booking__ds__month + , DATETIME_TRUNC(bookings_source_src_28000.ds, quarter) AS booking__ds__quarter + , DATETIME_TRUNC(bookings_source_src_28000.ds, year) AS booking__ds__year , EXTRACT(year FROM bookings_source_src_28000.ds) AS booking__ds__extract_year , EXTRACT(quarter FROM bookings_source_src_28000.ds) AS booking__ds__extract_quarter , EXTRACT(month FROM bookings_source_src_28000.ds) AS booking__ds__extract_month , EXTRACT(day FROM bookings_source_src_28000.ds) AS booking__ds__extract_day , IF(EXTRACT(dayofweek FROM bookings_source_src_28000.ds) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_28000.ds) - 1) AS booking__ds__extract_dow , EXTRACT(dayofyear FROM bookings_source_src_28000.ds) AS booking__ds__extract_doy - , DATE_TRUNC(bookings_source_src_28000.ds_partitioned, day) AS booking__ds_partitioned__day - , DATE_TRUNC(bookings_source_src_28000.ds_partitioned, isoweek) AS booking__ds_partitioned__week - , DATE_TRUNC(bookings_source_src_28000.ds_partitioned, month) AS booking__ds_partitioned__month - , DATE_TRUNC(bookings_source_src_28000.ds_partitioned, quarter) AS booking__ds_partitioned__quarter - , DATE_TRUNC(bookings_source_src_28000.ds_partitioned, year) AS booking__ds_partitioned__year + , DATETIME_TRUNC(bookings_source_src_28000.ds_partitioned, day) AS booking__ds_partitioned__day + , DATETIME_TRUNC(bookings_source_src_28000.ds_partitioned, isoweek) AS booking__ds_partitioned__week + , DATETIME_TRUNC(bookings_source_src_28000.ds_partitioned, month) AS booking__ds_partitioned__month + , DATETIME_TRUNC(bookings_source_src_28000.ds_partitioned, quarter) AS booking__ds_partitioned__quarter + , DATETIME_TRUNC(bookings_source_src_28000.ds_partitioned, year) AS booking__ds_partitioned__year , EXTRACT(year FROM bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__extract_year , EXTRACT(quarter FROM bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__extract_quarter , EXTRACT(month FROM bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__extract_month , EXTRACT(day FROM bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__extract_day , IF(EXTRACT(dayofweek FROM bookings_source_src_28000.ds_partitioned) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_28000.ds_partitioned) - 1) AS booking__ds_partitioned__extract_dow , EXTRACT(dayofyear FROM bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__extract_doy - , DATE_TRUNC(bookings_source_src_28000.paid_at, day) AS booking__paid_at__day - , DATE_TRUNC(bookings_source_src_28000.paid_at, isoweek) AS booking__paid_at__week - , DATE_TRUNC(bookings_source_src_28000.paid_at, month) AS booking__paid_at__month - , DATE_TRUNC(bookings_source_src_28000.paid_at, quarter) AS booking__paid_at__quarter - , DATE_TRUNC(bookings_source_src_28000.paid_at, year) AS booking__paid_at__year + , DATETIME_TRUNC(bookings_source_src_28000.paid_at, day) AS booking__paid_at__day + , DATETIME_TRUNC(bookings_source_src_28000.paid_at, isoweek) AS booking__paid_at__week + , DATETIME_TRUNC(bookings_source_src_28000.paid_at, month) AS booking__paid_at__month + , DATETIME_TRUNC(bookings_source_src_28000.paid_at, quarter) AS booking__paid_at__quarter + , DATETIME_TRUNC(bookings_source_src_28000.paid_at, year) AS booking__paid_at__year , EXTRACT(year FROM bookings_source_src_28000.paid_at) AS booking__paid_at__extract_year , EXTRACT(quarter FROM bookings_source_src_28000.paid_at) AS booking__paid_at__extract_quarter , EXTRACT(month FROM bookings_source_src_28000.paid_at) AS booking__paid_at__extract_month diff --git a/tests_metricflow/snapshots/test_metric_time_dimension_to_sql.py/SqlQueryPlan/BigQuery/test_metric_time_dimension_transform_node_using_primary_time__plan0_optimized.sql b/tests_metricflow/snapshots/test_metric_time_dimension_to_sql.py/SqlQueryPlan/BigQuery/test_metric_time_dimension_transform_node_using_primary_time__plan0_optimized.sql index 9f74629f56..9a2bef3638 100644 --- a/tests_metricflow/snapshots/test_metric_time_dimension_to_sql.py/SqlQueryPlan/BigQuery/test_metric_time_dimension_transform_node_using_primary_time__plan0_optimized.sql +++ b/tests_metricflow/snapshots/test_metric_time_dimension_to_sql.py/SqlQueryPlan/BigQuery/test_metric_time_dimension_transform_node_using_primary_time__plan0_optimized.sql @@ -1,77 +1,77 @@ -- Read Elements From Semantic Model 'bookings_source' -- Metric Time Dimension 'ds' SELECT - DATE_TRUNC(ds, day) AS ds__day - , DATE_TRUNC(ds, isoweek) AS ds__week - , DATE_TRUNC(ds, month) AS ds__month - , DATE_TRUNC(ds, quarter) AS ds__quarter - , DATE_TRUNC(ds, year) AS ds__year + DATETIME_TRUNC(ds, day) AS ds__day + , DATETIME_TRUNC(ds, isoweek) AS ds__week + , DATETIME_TRUNC(ds, month) AS ds__month + , DATETIME_TRUNC(ds, quarter) AS ds__quarter + , DATETIME_TRUNC(ds, year) AS ds__year , EXTRACT(year FROM ds) AS ds__extract_year , EXTRACT(quarter FROM ds) AS ds__extract_quarter , EXTRACT(month FROM ds) AS ds__extract_month , EXTRACT(day FROM ds) AS ds__extract_day , IF(EXTRACT(dayofweek FROM ds) = 1, 7, EXTRACT(dayofweek FROM ds) - 1) AS ds__extract_dow , EXTRACT(dayofyear FROM ds) AS ds__extract_doy - , DATE_TRUNC(ds_partitioned, day) AS ds_partitioned__day - , DATE_TRUNC(ds_partitioned, isoweek) AS ds_partitioned__week - , DATE_TRUNC(ds_partitioned, month) AS ds_partitioned__month - , DATE_TRUNC(ds_partitioned, quarter) AS ds_partitioned__quarter - , DATE_TRUNC(ds_partitioned, year) AS ds_partitioned__year + , DATETIME_TRUNC(ds_partitioned, day) AS ds_partitioned__day + , DATETIME_TRUNC(ds_partitioned, isoweek) AS ds_partitioned__week + , DATETIME_TRUNC(ds_partitioned, month) AS ds_partitioned__month + , DATETIME_TRUNC(ds_partitioned, quarter) AS ds_partitioned__quarter + , DATETIME_TRUNC(ds_partitioned, year) AS ds_partitioned__year , EXTRACT(year FROM ds_partitioned) AS ds_partitioned__extract_year , EXTRACT(quarter FROM ds_partitioned) AS ds_partitioned__extract_quarter , EXTRACT(month FROM ds_partitioned) AS ds_partitioned__extract_month , EXTRACT(day FROM ds_partitioned) AS ds_partitioned__extract_day , IF(EXTRACT(dayofweek FROM ds_partitioned) = 1, 7, EXTRACT(dayofweek FROM ds_partitioned) - 1) AS ds_partitioned__extract_dow , EXTRACT(dayofyear FROM ds_partitioned) AS ds_partitioned__extract_doy - , DATE_TRUNC(paid_at, day) AS paid_at__day - , DATE_TRUNC(paid_at, isoweek) AS paid_at__week - , DATE_TRUNC(paid_at, month) AS paid_at__month - , DATE_TRUNC(paid_at, quarter) AS paid_at__quarter - , DATE_TRUNC(paid_at, year) AS paid_at__year + , DATETIME_TRUNC(paid_at, day) AS paid_at__day + , DATETIME_TRUNC(paid_at, isoweek) AS paid_at__week + , DATETIME_TRUNC(paid_at, month) AS paid_at__month + , DATETIME_TRUNC(paid_at, quarter) AS paid_at__quarter + , DATETIME_TRUNC(paid_at, year) AS paid_at__year , EXTRACT(year FROM paid_at) AS paid_at__extract_year , EXTRACT(quarter FROM paid_at) AS paid_at__extract_quarter , EXTRACT(month FROM paid_at) AS paid_at__extract_month , EXTRACT(day FROM paid_at) AS paid_at__extract_day , IF(EXTRACT(dayofweek FROM paid_at) = 1, 7, EXTRACT(dayofweek FROM paid_at) - 1) AS paid_at__extract_dow , EXTRACT(dayofyear FROM paid_at) AS paid_at__extract_doy - , DATE_TRUNC(ds, day) AS booking__ds__day - , DATE_TRUNC(ds, isoweek) AS booking__ds__week - , DATE_TRUNC(ds, month) AS booking__ds__month - , DATE_TRUNC(ds, quarter) AS booking__ds__quarter - , DATE_TRUNC(ds, year) AS booking__ds__year + , DATETIME_TRUNC(ds, day) AS booking__ds__day + , DATETIME_TRUNC(ds, isoweek) AS booking__ds__week + , DATETIME_TRUNC(ds, month) AS booking__ds__month + , DATETIME_TRUNC(ds, quarter) AS booking__ds__quarter + , DATETIME_TRUNC(ds, year) AS booking__ds__year , EXTRACT(year FROM ds) AS booking__ds__extract_year , EXTRACT(quarter FROM ds) AS booking__ds__extract_quarter , EXTRACT(month FROM ds) AS booking__ds__extract_month , EXTRACT(day FROM ds) AS booking__ds__extract_day , IF(EXTRACT(dayofweek FROM ds) = 1, 7, EXTRACT(dayofweek FROM ds) - 1) AS booking__ds__extract_dow , EXTRACT(dayofyear FROM ds) AS booking__ds__extract_doy - , DATE_TRUNC(ds_partitioned, day) AS booking__ds_partitioned__day - , DATE_TRUNC(ds_partitioned, isoweek) AS booking__ds_partitioned__week - , DATE_TRUNC(ds_partitioned, month) AS booking__ds_partitioned__month - , DATE_TRUNC(ds_partitioned, quarter) AS booking__ds_partitioned__quarter - , DATE_TRUNC(ds_partitioned, year) AS booking__ds_partitioned__year + , DATETIME_TRUNC(ds_partitioned, day) AS booking__ds_partitioned__day + , DATETIME_TRUNC(ds_partitioned, isoweek) AS booking__ds_partitioned__week + , DATETIME_TRUNC(ds_partitioned, month) AS booking__ds_partitioned__month + , DATETIME_TRUNC(ds_partitioned, quarter) AS booking__ds_partitioned__quarter + , DATETIME_TRUNC(ds_partitioned, year) AS booking__ds_partitioned__year , EXTRACT(year FROM ds_partitioned) AS booking__ds_partitioned__extract_year , EXTRACT(quarter FROM ds_partitioned) AS booking__ds_partitioned__extract_quarter , EXTRACT(month FROM ds_partitioned) AS booking__ds_partitioned__extract_month , EXTRACT(day FROM ds_partitioned) AS booking__ds_partitioned__extract_day , IF(EXTRACT(dayofweek FROM ds_partitioned) = 1, 7, EXTRACT(dayofweek FROM ds_partitioned) - 1) AS booking__ds_partitioned__extract_dow , EXTRACT(dayofyear FROM ds_partitioned) AS booking__ds_partitioned__extract_doy - , DATE_TRUNC(paid_at, day) AS booking__paid_at__day - , DATE_TRUNC(paid_at, isoweek) AS booking__paid_at__week - , DATE_TRUNC(paid_at, month) AS booking__paid_at__month - , DATE_TRUNC(paid_at, quarter) AS booking__paid_at__quarter - , DATE_TRUNC(paid_at, year) AS booking__paid_at__year + , DATETIME_TRUNC(paid_at, day) AS booking__paid_at__day + , DATETIME_TRUNC(paid_at, isoweek) AS booking__paid_at__week + , DATETIME_TRUNC(paid_at, month) AS booking__paid_at__month + , DATETIME_TRUNC(paid_at, quarter) AS booking__paid_at__quarter + , DATETIME_TRUNC(paid_at, year) AS booking__paid_at__year , EXTRACT(year FROM paid_at) AS booking__paid_at__extract_year , EXTRACT(quarter FROM paid_at) AS booking__paid_at__extract_quarter , EXTRACT(month FROM paid_at) AS booking__paid_at__extract_month , EXTRACT(day FROM paid_at) AS booking__paid_at__extract_day , IF(EXTRACT(dayofweek FROM paid_at) = 1, 7, EXTRACT(dayofweek FROM paid_at) - 1) AS booking__paid_at__extract_dow , EXTRACT(dayofyear FROM paid_at) AS booking__paid_at__extract_doy - , DATE_TRUNC(ds, day) AS metric_time__day - , DATE_TRUNC(ds, isoweek) AS metric_time__week - , DATE_TRUNC(ds, month) AS metric_time__month - , DATE_TRUNC(ds, quarter) AS metric_time__quarter - , DATE_TRUNC(ds, year) AS metric_time__year + , DATETIME_TRUNC(ds, day) AS metric_time__day + , DATETIME_TRUNC(ds, isoweek) AS metric_time__week + , DATETIME_TRUNC(ds, month) AS metric_time__month + , DATETIME_TRUNC(ds, quarter) AS metric_time__quarter + , DATETIME_TRUNC(ds, year) AS metric_time__year , EXTRACT(year FROM ds) AS metric_time__extract_year , EXTRACT(quarter FROM ds) AS metric_time__extract_quarter , EXTRACT(month FROM ds) AS metric_time__extract_month diff --git a/tests_metricflow/snapshots/test_metric_time_dimension_to_sql.py/SqlQueryPlan/BigQuery/test_simple_query_with_metric_time_dimension__plan0.sql b/tests_metricflow/snapshots/test_metric_time_dimension_to_sql.py/SqlQueryPlan/BigQuery/test_simple_query_with_metric_time_dimension__plan0.sql index 1c46441a0a..d1715520f5 100644 --- a/tests_metricflow/snapshots/test_metric_time_dimension_to_sql.py/SqlQueryPlan/BigQuery/test_simple_query_with_metric_time_dimension__plan0.sql +++ b/tests_metricflow/snapshots/test_metric_time_dimension_to_sql.py/SqlQueryPlan/BigQuery/test_simple_query_with_metric_time_dimension__plan0.sql @@ -137,33 +137,33 @@ FROM ( , bookings_source_src_28000.booking_value AS approximate_continuous_booking_value_p99 , bookings_source_src_28000.booking_value AS approximate_discrete_booking_value_p99 , bookings_source_src_28000.is_instant - , DATE_TRUNC(bookings_source_src_28000.ds, day) AS ds__day - , DATE_TRUNC(bookings_source_src_28000.ds, isoweek) AS ds__week - , DATE_TRUNC(bookings_source_src_28000.ds, month) AS ds__month - , DATE_TRUNC(bookings_source_src_28000.ds, quarter) AS ds__quarter - , DATE_TRUNC(bookings_source_src_28000.ds, year) AS ds__year + , DATETIME_TRUNC(bookings_source_src_28000.ds, day) AS ds__day + , DATETIME_TRUNC(bookings_source_src_28000.ds, isoweek) AS ds__week + , DATETIME_TRUNC(bookings_source_src_28000.ds, month) AS ds__month + , DATETIME_TRUNC(bookings_source_src_28000.ds, quarter) AS ds__quarter + , DATETIME_TRUNC(bookings_source_src_28000.ds, year) AS ds__year , EXTRACT(year FROM bookings_source_src_28000.ds) AS ds__extract_year , EXTRACT(quarter FROM bookings_source_src_28000.ds) AS ds__extract_quarter , EXTRACT(month FROM bookings_source_src_28000.ds) AS ds__extract_month , EXTRACT(day FROM bookings_source_src_28000.ds) AS ds__extract_day , IF(EXTRACT(dayofweek FROM bookings_source_src_28000.ds) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_28000.ds) - 1) AS ds__extract_dow , EXTRACT(dayofyear FROM bookings_source_src_28000.ds) AS ds__extract_doy - , DATE_TRUNC(bookings_source_src_28000.ds_partitioned, day) AS ds_partitioned__day - , DATE_TRUNC(bookings_source_src_28000.ds_partitioned, isoweek) AS ds_partitioned__week - , DATE_TRUNC(bookings_source_src_28000.ds_partitioned, month) AS ds_partitioned__month - , DATE_TRUNC(bookings_source_src_28000.ds_partitioned, quarter) AS ds_partitioned__quarter - , DATE_TRUNC(bookings_source_src_28000.ds_partitioned, year) AS ds_partitioned__year + , DATETIME_TRUNC(bookings_source_src_28000.ds_partitioned, day) AS ds_partitioned__day + , DATETIME_TRUNC(bookings_source_src_28000.ds_partitioned, isoweek) AS ds_partitioned__week + , DATETIME_TRUNC(bookings_source_src_28000.ds_partitioned, month) AS ds_partitioned__month + , DATETIME_TRUNC(bookings_source_src_28000.ds_partitioned, quarter) AS ds_partitioned__quarter + , DATETIME_TRUNC(bookings_source_src_28000.ds_partitioned, year) AS ds_partitioned__year , EXTRACT(year FROM bookings_source_src_28000.ds_partitioned) AS ds_partitioned__extract_year , EXTRACT(quarter FROM bookings_source_src_28000.ds_partitioned) AS ds_partitioned__extract_quarter , EXTRACT(month FROM bookings_source_src_28000.ds_partitioned) AS ds_partitioned__extract_month , EXTRACT(day FROM bookings_source_src_28000.ds_partitioned) AS ds_partitioned__extract_day , IF(EXTRACT(dayofweek FROM bookings_source_src_28000.ds_partitioned) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_28000.ds_partitioned) - 1) AS ds_partitioned__extract_dow , EXTRACT(dayofyear FROM bookings_source_src_28000.ds_partitioned) AS ds_partitioned__extract_doy - , DATE_TRUNC(bookings_source_src_28000.paid_at, day) AS paid_at__day - , DATE_TRUNC(bookings_source_src_28000.paid_at, isoweek) AS paid_at__week - , DATE_TRUNC(bookings_source_src_28000.paid_at, month) AS paid_at__month - , DATE_TRUNC(bookings_source_src_28000.paid_at, quarter) AS paid_at__quarter - , DATE_TRUNC(bookings_source_src_28000.paid_at, year) AS paid_at__year + , DATETIME_TRUNC(bookings_source_src_28000.paid_at, day) AS paid_at__day + , DATETIME_TRUNC(bookings_source_src_28000.paid_at, isoweek) AS paid_at__week + , DATETIME_TRUNC(bookings_source_src_28000.paid_at, month) AS paid_at__month + , DATETIME_TRUNC(bookings_source_src_28000.paid_at, quarter) AS paid_at__quarter + , DATETIME_TRUNC(bookings_source_src_28000.paid_at, year) AS paid_at__year , EXTRACT(year FROM bookings_source_src_28000.paid_at) AS paid_at__extract_year , EXTRACT(quarter FROM bookings_source_src_28000.paid_at) AS paid_at__extract_quarter , EXTRACT(month FROM bookings_source_src_28000.paid_at) AS paid_at__extract_month @@ -171,33 +171,33 @@ FROM ( , IF(EXTRACT(dayofweek FROM bookings_source_src_28000.paid_at) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_28000.paid_at) - 1) AS paid_at__extract_dow , EXTRACT(dayofyear FROM bookings_source_src_28000.paid_at) AS paid_at__extract_doy , bookings_source_src_28000.is_instant AS booking__is_instant - , DATE_TRUNC(bookings_source_src_28000.ds, day) AS booking__ds__day - , DATE_TRUNC(bookings_source_src_28000.ds, isoweek) AS booking__ds__week - , DATE_TRUNC(bookings_source_src_28000.ds, month) AS booking__ds__month - , DATE_TRUNC(bookings_source_src_28000.ds, quarter) AS booking__ds__quarter - , DATE_TRUNC(bookings_source_src_28000.ds, year) AS booking__ds__year + , DATETIME_TRUNC(bookings_source_src_28000.ds, day) AS booking__ds__day + , DATETIME_TRUNC(bookings_source_src_28000.ds, isoweek) AS booking__ds__week + , DATETIME_TRUNC(bookings_source_src_28000.ds, month) AS booking__ds__month + , DATETIME_TRUNC(bookings_source_src_28000.ds, quarter) AS booking__ds__quarter + , DATETIME_TRUNC(bookings_source_src_28000.ds, year) AS booking__ds__year , EXTRACT(year FROM bookings_source_src_28000.ds) AS booking__ds__extract_year , EXTRACT(quarter FROM bookings_source_src_28000.ds) AS booking__ds__extract_quarter , EXTRACT(month FROM bookings_source_src_28000.ds) AS booking__ds__extract_month , EXTRACT(day FROM bookings_source_src_28000.ds) AS booking__ds__extract_day , IF(EXTRACT(dayofweek FROM bookings_source_src_28000.ds) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_28000.ds) - 1) AS booking__ds__extract_dow , EXTRACT(dayofyear FROM bookings_source_src_28000.ds) AS booking__ds__extract_doy - , DATE_TRUNC(bookings_source_src_28000.ds_partitioned, day) AS booking__ds_partitioned__day - , DATE_TRUNC(bookings_source_src_28000.ds_partitioned, isoweek) AS booking__ds_partitioned__week - , DATE_TRUNC(bookings_source_src_28000.ds_partitioned, month) AS booking__ds_partitioned__month - , DATE_TRUNC(bookings_source_src_28000.ds_partitioned, quarter) AS booking__ds_partitioned__quarter - , DATE_TRUNC(bookings_source_src_28000.ds_partitioned, year) AS booking__ds_partitioned__year + , DATETIME_TRUNC(bookings_source_src_28000.ds_partitioned, day) AS booking__ds_partitioned__day + , DATETIME_TRUNC(bookings_source_src_28000.ds_partitioned, isoweek) AS booking__ds_partitioned__week + , DATETIME_TRUNC(bookings_source_src_28000.ds_partitioned, month) AS booking__ds_partitioned__month + , DATETIME_TRUNC(bookings_source_src_28000.ds_partitioned, quarter) AS booking__ds_partitioned__quarter + , DATETIME_TRUNC(bookings_source_src_28000.ds_partitioned, year) AS booking__ds_partitioned__year , EXTRACT(year FROM bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__extract_year , EXTRACT(quarter FROM bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__extract_quarter , EXTRACT(month FROM bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__extract_month , EXTRACT(day FROM bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__extract_day , IF(EXTRACT(dayofweek FROM bookings_source_src_28000.ds_partitioned) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_28000.ds_partitioned) - 1) AS booking__ds_partitioned__extract_dow , EXTRACT(dayofyear FROM bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__extract_doy - , DATE_TRUNC(bookings_source_src_28000.paid_at, day) AS booking__paid_at__day - , DATE_TRUNC(bookings_source_src_28000.paid_at, isoweek) AS booking__paid_at__week - , DATE_TRUNC(bookings_source_src_28000.paid_at, month) AS booking__paid_at__month - , DATE_TRUNC(bookings_source_src_28000.paid_at, quarter) AS booking__paid_at__quarter - , DATE_TRUNC(bookings_source_src_28000.paid_at, year) AS booking__paid_at__year + , DATETIME_TRUNC(bookings_source_src_28000.paid_at, day) AS booking__paid_at__day + , DATETIME_TRUNC(bookings_source_src_28000.paid_at, isoweek) AS booking__paid_at__week + , DATETIME_TRUNC(bookings_source_src_28000.paid_at, month) AS booking__paid_at__month + , DATETIME_TRUNC(bookings_source_src_28000.paid_at, quarter) AS booking__paid_at__quarter + , DATETIME_TRUNC(bookings_source_src_28000.paid_at, year) AS booking__paid_at__year , EXTRACT(year FROM bookings_source_src_28000.paid_at) AS booking__paid_at__extract_year , EXTRACT(quarter FROM bookings_source_src_28000.paid_at) AS booking__paid_at__extract_quarter , EXTRACT(month FROM bookings_source_src_28000.paid_at) AS booking__paid_at__extract_month @@ -340,33 +340,33 @@ FULL OUTER JOIN ( , bookings_source_src_28000.booking_value AS approximate_continuous_booking_value_p99 , bookings_source_src_28000.booking_value AS approximate_discrete_booking_value_p99 , bookings_source_src_28000.is_instant - , DATE_TRUNC(bookings_source_src_28000.ds, day) AS ds__day - , DATE_TRUNC(bookings_source_src_28000.ds, isoweek) AS ds__week - , DATE_TRUNC(bookings_source_src_28000.ds, month) AS ds__month - , DATE_TRUNC(bookings_source_src_28000.ds, quarter) AS ds__quarter - , DATE_TRUNC(bookings_source_src_28000.ds, year) AS ds__year + , DATETIME_TRUNC(bookings_source_src_28000.ds, day) AS ds__day + , DATETIME_TRUNC(bookings_source_src_28000.ds, isoweek) AS ds__week + , DATETIME_TRUNC(bookings_source_src_28000.ds, month) AS ds__month + , DATETIME_TRUNC(bookings_source_src_28000.ds, quarter) AS ds__quarter + , DATETIME_TRUNC(bookings_source_src_28000.ds, year) AS ds__year , EXTRACT(year FROM bookings_source_src_28000.ds) AS ds__extract_year , EXTRACT(quarter FROM bookings_source_src_28000.ds) AS ds__extract_quarter , EXTRACT(month FROM bookings_source_src_28000.ds) AS ds__extract_month , EXTRACT(day FROM bookings_source_src_28000.ds) AS ds__extract_day , IF(EXTRACT(dayofweek FROM bookings_source_src_28000.ds) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_28000.ds) - 1) AS ds__extract_dow , EXTRACT(dayofyear FROM bookings_source_src_28000.ds) AS ds__extract_doy - , DATE_TRUNC(bookings_source_src_28000.ds_partitioned, day) AS ds_partitioned__day - , DATE_TRUNC(bookings_source_src_28000.ds_partitioned, isoweek) AS ds_partitioned__week - , DATE_TRUNC(bookings_source_src_28000.ds_partitioned, month) AS ds_partitioned__month - , DATE_TRUNC(bookings_source_src_28000.ds_partitioned, quarter) AS ds_partitioned__quarter - , DATE_TRUNC(bookings_source_src_28000.ds_partitioned, year) AS ds_partitioned__year + , DATETIME_TRUNC(bookings_source_src_28000.ds_partitioned, day) AS ds_partitioned__day + , DATETIME_TRUNC(bookings_source_src_28000.ds_partitioned, isoweek) AS ds_partitioned__week + , DATETIME_TRUNC(bookings_source_src_28000.ds_partitioned, month) AS ds_partitioned__month + , DATETIME_TRUNC(bookings_source_src_28000.ds_partitioned, quarter) AS ds_partitioned__quarter + , DATETIME_TRUNC(bookings_source_src_28000.ds_partitioned, year) AS ds_partitioned__year , EXTRACT(year FROM bookings_source_src_28000.ds_partitioned) AS ds_partitioned__extract_year , EXTRACT(quarter FROM bookings_source_src_28000.ds_partitioned) AS ds_partitioned__extract_quarter , EXTRACT(month FROM bookings_source_src_28000.ds_partitioned) AS ds_partitioned__extract_month , EXTRACT(day FROM bookings_source_src_28000.ds_partitioned) AS ds_partitioned__extract_day , IF(EXTRACT(dayofweek FROM bookings_source_src_28000.ds_partitioned) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_28000.ds_partitioned) - 1) AS ds_partitioned__extract_dow , EXTRACT(dayofyear FROM bookings_source_src_28000.ds_partitioned) AS ds_partitioned__extract_doy - , DATE_TRUNC(bookings_source_src_28000.paid_at, day) AS paid_at__day - , DATE_TRUNC(bookings_source_src_28000.paid_at, isoweek) AS paid_at__week - , DATE_TRUNC(bookings_source_src_28000.paid_at, month) AS paid_at__month - , DATE_TRUNC(bookings_source_src_28000.paid_at, quarter) AS paid_at__quarter - , DATE_TRUNC(bookings_source_src_28000.paid_at, year) AS paid_at__year + , DATETIME_TRUNC(bookings_source_src_28000.paid_at, day) AS paid_at__day + , DATETIME_TRUNC(bookings_source_src_28000.paid_at, isoweek) AS paid_at__week + , DATETIME_TRUNC(bookings_source_src_28000.paid_at, month) AS paid_at__month + , DATETIME_TRUNC(bookings_source_src_28000.paid_at, quarter) AS paid_at__quarter + , DATETIME_TRUNC(bookings_source_src_28000.paid_at, year) AS paid_at__year , EXTRACT(year FROM bookings_source_src_28000.paid_at) AS paid_at__extract_year , EXTRACT(quarter FROM bookings_source_src_28000.paid_at) AS paid_at__extract_quarter , EXTRACT(month FROM bookings_source_src_28000.paid_at) AS paid_at__extract_month @@ -374,33 +374,33 @@ FULL OUTER JOIN ( , IF(EXTRACT(dayofweek FROM bookings_source_src_28000.paid_at) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_28000.paid_at) - 1) AS paid_at__extract_dow , EXTRACT(dayofyear FROM bookings_source_src_28000.paid_at) AS paid_at__extract_doy , bookings_source_src_28000.is_instant AS booking__is_instant - , DATE_TRUNC(bookings_source_src_28000.ds, day) AS booking__ds__day - , DATE_TRUNC(bookings_source_src_28000.ds, isoweek) AS booking__ds__week - , DATE_TRUNC(bookings_source_src_28000.ds, month) AS booking__ds__month - , DATE_TRUNC(bookings_source_src_28000.ds, quarter) AS booking__ds__quarter - , DATE_TRUNC(bookings_source_src_28000.ds, year) AS booking__ds__year + , DATETIME_TRUNC(bookings_source_src_28000.ds, day) AS booking__ds__day + , DATETIME_TRUNC(bookings_source_src_28000.ds, isoweek) AS booking__ds__week + , DATETIME_TRUNC(bookings_source_src_28000.ds, month) AS booking__ds__month + , DATETIME_TRUNC(bookings_source_src_28000.ds, quarter) AS booking__ds__quarter + , DATETIME_TRUNC(bookings_source_src_28000.ds, year) AS booking__ds__year , EXTRACT(year FROM bookings_source_src_28000.ds) AS booking__ds__extract_year , EXTRACT(quarter FROM bookings_source_src_28000.ds) AS booking__ds__extract_quarter , EXTRACT(month FROM bookings_source_src_28000.ds) AS booking__ds__extract_month , EXTRACT(day FROM bookings_source_src_28000.ds) AS booking__ds__extract_day , IF(EXTRACT(dayofweek FROM bookings_source_src_28000.ds) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_28000.ds) - 1) AS booking__ds__extract_dow , EXTRACT(dayofyear FROM bookings_source_src_28000.ds) AS booking__ds__extract_doy - , DATE_TRUNC(bookings_source_src_28000.ds_partitioned, day) AS booking__ds_partitioned__day - , DATE_TRUNC(bookings_source_src_28000.ds_partitioned, isoweek) AS booking__ds_partitioned__week - , DATE_TRUNC(bookings_source_src_28000.ds_partitioned, month) AS booking__ds_partitioned__month - , DATE_TRUNC(bookings_source_src_28000.ds_partitioned, quarter) AS booking__ds_partitioned__quarter - , DATE_TRUNC(bookings_source_src_28000.ds_partitioned, year) AS booking__ds_partitioned__year + , DATETIME_TRUNC(bookings_source_src_28000.ds_partitioned, day) AS booking__ds_partitioned__day + , DATETIME_TRUNC(bookings_source_src_28000.ds_partitioned, isoweek) AS booking__ds_partitioned__week + , DATETIME_TRUNC(bookings_source_src_28000.ds_partitioned, month) AS booking__ds_partitioned__month + , DATETIME_TRUNC(bookings_source_src_28000.ds_partitioned, quarter) AS booking__ds_partitioned__quarter + , DATETIME_TRUNC(bookings_source_src_28000.ds_partitioned, year) AS booking__ds_partitioned__year , EXTRACT(year FROM bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__extract_year , EXTRACT(quarter FROM bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__extract_quarter , EXTRACT(month FROM bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__extract_month , EXTRACT(day FROM bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__extract_day , IF(EXTRACT(dayofweek FROM bookings_source_src_28000.ds_partitioned) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_28000.ds_partitioned) - 1) AS booking__ds_partitioned__extract_dow , EXTRACT(dayofyear FROM bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__extract_doy - , DATE_TRUNC(bookings_source_src_28000.paid_at, day) AS booking__paid_at__day - , DATE_TRUNC(bookings_source_src_28000.paid_at, isoweek) AS booking__paid_at__week - , DATE_TRUNC(bookings_source_src_28000.paid_at, month) AS booking__paid_at__month - , DATE_TRUNC(bookings_source_src_28000.paid_at, quarter) AS booking__paid_at__quarter - , DATE_TRUNC(bookings_source_src_28000.paid_at, year) AS booking__paid_at__year + , DATETIME_TRUNC(bookings_source_src_28000.paid_at, day) AS booking__paid_at__day + , DATETIME_TRUNC(bookings_source_src_28000.paid_at, isoweek) AS booking__paid_at__week + , DATETIME_TRUNC(bookings_source_src_28000.paid_at, month) AS booking__paid_at__month + , DATETIME_TRUNC(bookings_source_src_28000.paid_at, quarter) AS booking__paid_at__quarter + , DATETIME_TRUNC(bookings_source_src_28000.paid_at, year) AS booking__paid_at__year , EXTRACT(year FROM bookings_source_src_28000.paid_at) AS booking__paid_at__extract_year , EXTRACT(quarter FROM bookings_source_src_28000.paid_at) AS booking__paid_at__extract_quarter , EXTRACT(month FROM bookings_source_src_28000.paid_at) AS booking__paid_at__extract_month diff --git a/tests_metricflow/snapshots/test_metric_time_dimension_to_sql.py/SqlQueryPlan/BigQuery/test_simple_query_with_metric_time_dimension__plan0_optimized.sql b/tests_metricflow/snapshots/test_metric_time_dimension_to_sql.py/SqlQueryPlan/BigQuery/test_simple_query_with_metric_time_dimension__plan0_optimized.sql index 3f77a84fb2..2c8a3982a3 100644 --- a/tests_metricflow/snapshots/test_metric_time_dimension_to_sql.py/SqlQueryPlan/BigQuery/test_simple_query_with_metric_time_dimension__plan0_optimized.sql +++ b/tests_metricflow/snapshots/test_metric_time_dimension_to_sql.py/SqlQueryPlan/BigQuery/test_simple_query_with_metric_time_dimension__plan0_optimized.sql @@ -14,7 +14,7 @@ FROM ( -- Metric Time Dimension 'ds' -- Pass Only Elements: ['bookings', 'metric_time__day'] SELECT - DATE_TRUNC(ds, day) AS metric_time__day + DATETIME_TRUNC(ds, day) AS metric_time__day , 1 AS bookings FROM ***************************.fct_bookings bookings_source_src_28000 ) subq_12 @@ -28,7 +28,7 @@ FULL OUTER JOIN ( -- Aggregate Measures -- Compute Metrics via Expressions SELECT - DATE_TRUNC(paid_at, day) AS metric_time__day + DATETIME_TRUNC(paid_at, day) AS metric_time__day , SUM(booking_value) AS booking_payments FROM ***************************.fct_bookings bookings_source_src_28000 GROUP BY diff --git a/tests_metricflow/snapshots/test_metric_time_without_metrics.py/SqlQueryPlan/BigQuery/test_dimensions_with_time_constraint__plan0.sql b/tests_metricflow/snapshots/test_metric_time_without_metrics.py/SqlQueryPlan/BigQuery/test_dimensions_with_time_constraint__plan0.sql index 928c4ff35d..9b3b0c4f8e 100644 --- a/tests_metricflow/snapshots/test_metric_time_without_metrics.py/SqlQueryPlan/BigQuery/test_dimensions_with_time_constraint__plan0.sql +++ b/tests_metricflow/snapshots/test_metric_time_without_metrics.py/SqlQueryPlan/BigQuery/test_dimensions_with_time_constraint__plan0.sql @@ -131,22 +131,22 @@ FROM ( 1 AS listings , listings_latest_src_28000.capacity AS largest_listing , listings_latest_src_28000.capacity AS smallest_listing - , DATE_TRUNC(listings_latest_src_28000.created_at, day) AS ds__day - , DATE_TRUNC(listings_latest_src_28000.created_at, isoweek) AS ds__week - , DATE_TRUNC(listings_latest_src_28000.created_at, month) AS ds__month - , DATE_TRUNC(listings_latest_src_28000.created_at, quarter) AS ds__quarter - , DATE_TRUNC(listings_latest_src_28000.created_at, year) AS ds__year + , DATETIME_TRUNC(listings_latest_src_28000.created_at, day) AS ds__day + , DATETIME_TRUNC(listings_latest_src_28000.created_at, isoweek) AS ds__week + , DATETIME_TRUNC(listings_latest_src_28000.created_at, month) AS ds__month + , DATETIME_TRUNC(listings_latest_src_28000.created_at, quarter) AS ds__quarter + , DATETIME_TRUNC(listings_latest_src_28000.created_at, year) AS ds__year , EXTRACT(year FROM listings_latest_src_28000.created_at) AS ds__extract_year , EXTRACT(quarter FROM listings_latest_src_28000.created_at) AS ds__extract_quarter , EXTRACT(month FROM listings_latest_src_28000.created_at) AS ds__extract_month , EXTRACT(day FROM listings_latest_src_28000.created_at) AS ds__extract_day , IF(EXTRACT(dayofweek FROM listings_latest_src_28000.created_at) = 1, 7, EXTRACT(dayofweek FROM listings_latest_src_28000.created_at) - 1) AS ds__extract_dow , EXTRACT(dayofyear FROM listings_latest_src_28000.created_at) AS ds__extract_doy - , DATE_TRUNC(listings_latest_src_28000.created_at, day) AS created_at__day - , DATE_TRUNC(listings_latest_src_28000.created_at, isoweek) AS created_at__week - , DATE_TRUNC(listings_latest_src_28000.created_at, month) AS created_at__month - , DATE_TRUNC(listings_latest_src_28000.created_at, quarter) AS created_at__quarter - , DATE_TRUNC(listings_latest_src_28000.created_at, year) AS created_at__year + , DATETIME_TRUNC(listings_latest_src_28000.created_at, day) AS created_at__day + , DATETIME_TRUNC(listings_latest_src_28000.created_at, isoweek) AS created_at__week + , DATETIME_TRUNC(listings_latest_src_28000.created_at, month) AS created_at__month + , DATETIME_TRUNC(listings_latest_src_28000.created_at, quarter) AS created_at__quarter + , DATETIME_TRUNC(listings_latest_src_28000.created_at, year) AS created_at__year , EXTRACT(year FROM listings_latest_src_28000.created_at) AS created_at__extract_year , EXTRACT(quarter FROM listings_latest_src_28000.created_at) AS created_at__extract_quarter , EXTRACT(month FROM listings_latest_src_28000.created_at) AS created_at__extract_month @@ -156,22 +156,22 @@ FROM ( , listings_latest_src_28000.country AS country_latest , listings_latest_src_28000.is_lux AS is_lux_latest , listings_latest_src_28000.capacity AS capacity_latest - , DATE_TRUNC(listings_latest_src_28000.created_at, day) AS listing__ds__day - , DATE_TRUNC(listings_latest_src_28000.created_at, isoweek) AS listing__ds__week - , DATE_TRUNC(listings_latest_src_28000.created_at, month) AS listing__ds__month - , DATE_TRUNC(listings_latest_src_28000.created_at, quarter) AS listing__ds__quarter - , DATE_TRUNC(listings_latest_src_28000.created_at, year) AS listing__ds__year + , DATETIME_TRUNC(listings_latest_src_28000.created_at, day) AS listing__ds__day + , DATETIME_TRUNC(listings_latest_src_28000.created_at, isoweek) AS listing__ds__week + , DATETIME_TRUNC(listings_latest_src_28000.created_at, month) AS listing__ds__month + , DATETIME_TRUNC(listings_latest_src_28000.created_at, quarter) AS listing__ds__quarter + , DATETIME_TRUNC(listings_latest_src_28000.created_at, year) AS listing__ds__year , EXTRACT(year FROM listings_latest_src_28000.created_at) AS listing__ds__extract_year , EXTRACT(quarter FROM listings_latest_src_28000.created_at) AS listing__ds__extract_quarter , EXTRACT(month FROM listings_latest_src_28000.created_at) AS listing__ds__extract_month , EXTRACT(day FROM listings_latest_src_28000.created_at) AS listing__ds__extract_day , IF(EXTRACT(dayofweek FROM listings_latest_src_28000.created_at) = 1, 7, EXTRACT(dayofweek FROM listings_latest_src_28000.created_at) - 1) AS listing__ds__extract_dow , EXTRACT(dayofyear FROM listings_latest_src_28000.created_at) AS listing__ds__extract_doy - , DATE_TRUNC(listings_latest_src_28000.created_at, day) AS listing__created_at__day - , DATE_TRUNC(listings_latest_src_28000.created_at, isoweek) AS listing__created_at__week - , DATE_TRUNC(listings_latest_src_28000.created_at, month) AS listing__created_at__month - , DATE_TRUNC(listings_latest_src_28000.created_at, quarter) AS listing__created_at__quarter - , DATE_TRUNC(listings_latest_src_28000.created_at, year) AS listing__created_at__year + , DATETIME_TRUNC(listings_latest_src_28000.created_at, day) AS listing__created_at__day + , DATETIME_TRUNC(listings_latest_src_28000.created_at, isoweek) AS listing__created_at__week + , DATETIME_TRUNC(listings_latest_src_28000.created_at, month) AS listing__created_at__month + , DATETIME_TRUNC(listings_latest_src_28000.created_at, quarter) AS listing__created_at__quarter + , DATETIME_TRUNC(listings_latest_src_28000.created_at, year) AS listing__created_at__year , EXTRACT(year FROM listings_latest_src_28000.created_at) AS listing__created_at__extract_year , EXTRACT(quarter FROM listings_latest_src_28000.created_at) AS listing__created_at__extract_quarter , EXTRACT(month FROM listings_latest_src_28000.created_at) AS listing__created_at__extract_month @@ -218,11 +218,11 @@ FROM ( FROM ( -- Time Spine SELECT - DATE_TRUNC(time_spine_src_28000.ds, day) AS ds__day - , DATE_TRUNC(time_spine_src_28000.ds, isoweek) AS ds__week - , DATE_TRUNC(time_spine_src_28000.ds, month) AS ds__month - , DATE_TRUNC(time_spine_src_28000.ds, quarter) AS ds__quarter - , DATE_TRUNC(time_spine_src_28000.ds, year) AS ds__year + DATETIME_TRUNC(time_spine_src_28000.ds, day) AS ds__day + , DATETIME_TRUNC(time_spine_src_28000.ds, isoweek) AS ds__week + , DATETIME_TRUNC(time_spine_src_28000.ds, month) AS ds__month + , DATETIME_TRUNC(time_spine_src_28000.ds, quarter) AS ds__quarter + , DATETIME_TRUNC(time_spine_src_28000.ds, year) AS ds__year , EXTRACT(year FROM time_spine_src_28000.ds) AS ds__extract_year , EXTRACT(quarter FROM time_spine_src_28000.ds) AS ds__extract_quarter , EXTRACT(month FROM time_spine_src_28000.ds) AS ds__extract_month @@ -241,11 +241,11 @@ FROM ( FROM ( -- Read Elements From Semantic Model 'users_latest' SELECT - DATE_TRUNC(users_latest_src_28000.ds, day) AS ds_latest__day - , DATE_TRUNC(users_latest_src_28000.ds, isoweek) AS ds_latest__week - , DATE_TRUNC(users_latest_src_28000.ds, month) AS ds_latest__month - , DATE_TRUNC(users_latest_src_28000.ds, quarter) AS ds_latest__quarter - , DATE_TRUNC(users_latest_src_28000.ds, year) AS ds_latest__year + DATETIME_TRUNC(users_latest_src_28000.ds, day) AS ds_latest__day + , DATETIME_TRUNC(users_latest_src_28000.ds, isoweek) AS ds_latest__week + , DATETIME_TRUNC(users_latest_src_28000.ds, month) AS ds_latest__month + , DATETIME_TRUNC(users_latest_src_28000.ds, quarter) AS ds_latest__quarter + , DATETIME_TRUNC(users_latest_src_28000.ds, year) AS ds_latest__year , EXTRACT(year FROM users_latest_src_28000.ds) AS ds_latest__extract_year , EXTRACT(quarter FROM users_latest_src_28000.ds) AS ds_latest__extract_quarter , EXTRACT(month FROM users_latest_src_28000.ds) AS ds_latest__extract_month @@ -253,11 +253,11 @@ FROM ( , IF(EXTRACT(dayofweek FROM users_latest_src_28000.ds) = 1, 7, EXTRACT(dayofweek FROM users_latest_src_28000.ds) - 1) AS ds_latest__extract_dow , EXTRACT(dayofyear FROM users_latest_src_28000.ds) AS ds_latest__extract_doy , users_latest_src_28000.home_state_latest - , DATE_TRUNC(users_latest_src_28000.ds, day) AS user__ds_latest__day - , DATE_TRUNC(users_latest_src_28000.ds, isoweek) AS user__ds_latest__week - , DATE_TRUNC(users_latest_src_28000.ds, month) AS user__ds_latest__month - , DATE_TRUNC(users_latest_src_28000.ds, quarter) AS user__ds_latest__quarter - , DATE_TRUNC(users_latest_src_28000.ds, year) AS user__ds_latest__year + , DATETIME_TRUNC(users_latest_src_28000.ds, day) AS user__ds_latest__day + , DATETIME_TRUNC(users_latest_src_28000.ds, isoweek) AS user__ds_latest__week + , DATETIME_TRUNC(users_latest_src_28000.ds, month) AS user__ds_latest__month + , DATETIME_TRUNC(users_latest_src_28000.ds, quarter) AS user__ds_latest__quarter + , DATETIME_TRUNC(users_latest_src_28000.ds, year) AS user__ds_latest__year , EXTRACT(year FROM users_latest_src_28000.ds) AS user__ds_latest__extract_year , EXTRACT(quarter FROM users_latest_src_28000.ds) AS user__ds_latest__extract_quarter , EXTRACT(month FROM users_latest_src_28000.ds) AS user__ds_latest__extract_month diff --git a/tests_metricflow/snapshots/test_metric_time_without_metrics.py/SqlQueryPlan/BigQuery/test_dimensions_with_time_constraint__plan0_optimized.sql b/tests_metricflow/snapshots/test_metric_time_without_metrics.py/SqlQueryPlan/BigQuery/test_dimensions_with_time_constraint__plan0_optimized.sql index fbf6589ace..e939afb66d 100644 --- a/tests_metricflow/snapshots/test_metric_time_without_metrics.py/SqlQueryPlan/BigQuery/test_dimensions_with_time_constraint__plan0_optimized.sql +++ b/tests_metricflow/snapshots/test_metric_time_without_metrics.py/SqlQueryPlan/BigQuery/test_dimensions_with_time_constraint__plan0_optimized.sql @@ -2,7 +2,7 @@ -- Constrain Time Range to [2020-01-01T00:00:00, 2020-01-03T00:00:00] -- Pass Only Elements: ['user__home_state_latest', 'listing__is_lux_latest', 'metric_time__day'] SELECT - DATE_TRUNC(time_spine_src_28000.ds, day) AS metric_time__day + DATETIME_TRUNC(time_spine_src_28000.ds, day) AS metric_time__day , listings_latest_src_28000.is_lux AS listing__is_lux_latest , users_latest_src_28000.home_state_latest AS user__home_state_latest FROM ***************************.dim_listings_latest listings_latest_src_28000 @@ -12,7 +12,7 @@ FULL OUTER JOIN ***************************.dim_users_latest users_latest_src_28000 ON listings_latest_src_28000.user_id = users_latest_src_28000.user_id -WHERE DATE_TRUNC(time_spine_src_28000.ds, day) BETWEEN '2020-01-01' AND '2020-01-03' +WHERE DATETIME_TRUNC(time_spine_src_28000.ds, day) BETWEEN '2020-01-01' AND '2020-01-03' GROUP BY metric_time__day , listing__is_lux_latest diff --git a/tests_metricflow/snapshots/test_metric_time_without_metrics.py/SqlQueryPlan/BigQuery/test_metric_time_only__plan0.sql b/tests_metricflow/snapshots/test_metric_time_without_metrics.py/SqlQueryPlan/BigQuery/test_metric_time_only__plan0.sql index 9ff898358e..a5ac99c303 100644 --- a/tests_metricflow/snapshots/test_metric_time_without_metrics.py/SqlQueryPlan/BigQuery/test_metric_time_only__plan0.sql +++ b/tests_metricflow/snapshots/test_metric_time_without_metrics.py/SqlQueryPlan/BigQuery/test_metric_time_only__plan0.sql @@ -29,11 +29,11 @@ FROM ( FROM ( -- Time Spine SELECT - DATE_TRUNC(time_spine_src_28000.ds, day) AS ds__day - , DATE_TRUNC(time_spine_src_28000.ds, isoweek) AS ds__week - , DATE_TRUNC(time_spine_src_28000.ds, month) AS ds__month - , DATE_TRUNC(time_spine_src_28000.ds, quarter) AS ds__quarter - , DATE_TRUNC(time_spine_src_28000.ds, year) AS ds__year + DATETIME_TRUNC(time_spine_src_28000.ds, day) AS ds__day + , DATETIME_TRUNC(time_spine_src_28000.ds, isoweek) AS ds__week + , DATETIME_TRUNC(time_spine_src_28000.ds, month) AS ds__month + , DATETIME_TRUNC(time_spine_src_28000.ds, quarter) AS ds__quarter + , DATETIME_TRUNC(time_spine_src_28000.ds, year) AS ds__year , EXTRACT(year FROM time_spine_src_28000.ds) AS ds__extract_year , EXTRACT(quarter FROM time_spine_src_28000.ds) AS ds__extract_quarter , EXTRACT(month FROM time_spine_src_28000.ds) AS ds__extract_month diff --git a/tests_metricflow/snapshots/test_metric_time_without_metrics.py/SqlQueryPlan/BigQuery/test_metric_time_only__plan0_optimized.sql b/tests_metricflow/snapshots/test_metric_time_without_metrics.py/SqlQueryPlan/BigQuery/test_metric_time_only__plan0_optimized.sql index 71bad5c6cf..e3d2c86221 100644 --- a/tests_metricflow/snapshots/test_metric_time_without_metrics.py/SqlQueryPlan/BigQuery/test_metric_time_only__plan0_optimized.sql +++ b/tests_metricflow/snapshots/test_metric_time_without_metrics.py/SqlQueryPlan/BigQuery/test_metric_time_only__plan0_optimized.sql @@ -2,7 +2,7 @@ -- Metric Time Dimension 'ds' -- Pass Only Elements: ['metric_time__day',] SELECT - DATE_TRUNC(ds, day) AS metric_time__day + DATETIME_TRUNC(ds, day) AS metric_time__day FROM ***************************.mf_time_spine time_spine_src_28000 GROUP BY metric_time__day diff --git a/tests_metricflow/snapshots/test_metric_time_without_metrics.py/SqlQueryPlan/BigQuery/test_metric_time_quarter_alone__plan0.sql b/tests_metricflow/snapshots/test_metric_time_without_metrics.py/SqlQueryPlan/BigQuery/test_metric_time_quarter_alone__plan0.sql index 1505b0002b..46093b139a 100644 --- a/tests_metricflow/snapshots/test_metric_time_without_metrics.py/SqlQueryPlan/BigQuery/test_metric_time_quarter_alone__plan0.sql +++ b/tests_metricflow/snapshots/test_metric_time_without_metrics.py/SqlQueryPlan/BigQuery/test_metric_time_quarter_alone__plan0.sql @@ -29,11 +29,11 @@ FROM ( FROM ( -- Time Spine SELECT - DATE_TRUNC(time_spine_src_28000.ds, day) AS ds__day - , DATE_TRUNC(time_spine_src_28000.ds, isoweek) AS ds__week - , DATE_TRUNC(time_spine_src_28000.ds, month) AS ds__month - , DATE_TRUNC(time_spine_src_28000.ds, quarter) AS ds__quarter - , DATE_TRUNC(time_spine_src_28000.ds, year) AS ds__year + DATETIME_TRUNC(time_spine_src_28000.ds, day) AS ds__day + , DATETIME_TRUNC(time_spine_src_28000.ds, isoweek) AS ds__week + , DATETIME_TRUNC(time_spine_src_28000.ds, month) AS ds__month + , DATETIME_TRUNC(time_spine_src_28000.ds, quarter) AS ds__quarter + , DATETIME_TRUNC(time_spine_src_28000.ds, year) AS ds__year , EXTRACT(year FROM time_spine_src_28000.ds) AS ds__extract_year , EXTRACT(quarter FROM time_spine_src_28000.ds) AS ds__extract_quarter , EXTRACT(month FROM time_spine_src_28000.ds) AS ds__extract_month diff --git a/tests_metricflow/snapshots/test_metric_time_without_metrics.py/SqlQueryPlan/BigQuery/test_metric_time_quarter_alone__plan0_optimized.sql b/tests_metricflow/snapshots/test_metric_time_without_metrics.py/SqlQueryPlan/BigQuery/test_metric_time_quarter_alone__plan0_optimized.sql index 1bc4a183cd..7f99e4d431 100644 --- a/tests_metricflow/snapshots/test_metric_time_without_metrics.py/SqlQueryPlan/BigQuery/test_metric_time_quarter_alone__plan0_optimized.sql +++ b/tests_metricflow/snapshots/test_metric_time_without_metrics.py/SqlQueryPlan/BigQuery/test_metric_time_quarter_alone__plan0_optimized.sql @@ -2,7 +2,7 @@ -- Metric Time Dimension 'ds' -- Pass Only Elements: ['metric_time__quarter',] SELECT - DATE_TRUNC(ds, quarter) AS metric_time__quarter + DATETIME_TRUNC(ds, quarter) AS metric_time__quarter FROM ***************************.mf_time_spine time_spine_src_28000 GROUP BY metric_time__quarter diff --git a/tests_metricflow/snapshots/test_metric_time_without_metrics.py/SqlQueryPlan/BigQuery/test_metric_time_with_other_dimensions__plan0.sql b/tests_metricflow/snapshots/test_metric_time_without_metrics.py/SqlQueryPlan/BigQuery/test_metric_time_with_other_dimensions__plan0.sql index 1cc5681017..f8d8755c47 100644 --- a/tests_metricflow/snapshots/test_metric_time_without_metrics.py/SqlQueryPlan/BigQuery/test_metric_time_with_other_dimensions__plan0.sql +++ b/tests_metricflow/snapshots/test_metric_time_without_metrics.py/SqlQueryPlan/BigQuery/test_metric_time_with_other_dimensions__plan0.sql @@ -70,22 +70,22 @@ FROM ( 1 AS listings , listings_latest_src_28000.capacity AS largest_listing , listings_latest_src_28000.capacity AS smallest_listing - , DATE_TRUNC(listings_latest_src_28000.created_at, day) AS ds__day - , DATE_TRUNC(listings_latest_src_28000.created_at, isoweek) AS ds__week - , DATE_TRUNC(listings_latest_src_28000.created_at, month) AS ds__month - , DATE_TRUNC(listings_latest_src_28000.created_at, quarter) AS ds__quarter - , DATE_TRUNC(listings_latest_src_28000.created_at, year) AS ds__year + , DATETIME_TRUNC(listings_latest_src_28000.created_at, day) AS ds__day + , DATETIME_TRUNC(listings_latest_src_28000.created_at, isoweek) AS ds__week + , DATETIME_TRUNC(listings_latest_src_28000.created_at, month) AS ds__month + , DATETIME_TRUNC(listings_latest_src_28000.created_at, quarter) AS ds__quarter + , DATETIME_TRUNC(listings_latest_src_28000.created_at, year) AS ds__year , EXTRACT(year FROM listings_latest_src_28000.created_at) AS ds__extract_year , EXTRACT(quarter FROM listings_latest_src_28000.created_at) AS ds__extract_quarter , EXTRACT(month FROM listings_latest_src_28000.created_at) AS ds__extract_month , EXTRACT(day FROM listings_latest_src_28000.created_at) AS ds__extract_day , IF(EXTRACT(dayofweek FROM listings_latest_src_28000.created_at) = 1, 7, EXTRACT(dayofweek FROM listings_latest_src_28000.created_at) - 1) AS ds__extract_dow , EXTRACT(dayofyear FROM listings_latest_src_28000.created_at) AS ds__extract_doy - , DATE_TRUNC(listings_latest_src_28000.created_at, day) AS created_at__day - , DATE_TRUNC(listings_latest_src_28000.created_at, isoweek) AS created_at__week - , DATE_TRUNC(listings_latest_src_28000.created_at, month) AS created_at__month - , DATE_TRUNC(listings_latest_src_28000.created_at, quarter) AS created_at__quarter - , DATE_TRUNC(listings_latest_src_28000.created_at, year) AS created_at__year + , DATETIME_TRUNC(listings_latest_src_28000.created_at, day) AS created_at__day + , DATETIME_TRUNC(listings_latest_src_28000.created_at, isoweek) AS created_at__week + , DATETIME_TRUNC(listings_latest_src_28000.created_at, month) AS created_at__month + , DATETIME_TRUNC(listings_latest_src_28000.created_at, quarter) AS created_at__quarter + , DATETIME_TRUNC(listings_latest_src_28000.created_at, year) AS created_at__year , EXTRACT(year FROM listings_latest_src_28000.created_at) AS created_at__extract_year , EXTRACT(quarter FROM listings_latest_src_28000.created_at) AS created_at__extract_quarter , EXTRACT(month FROM listings_latest_src_28000.created_at) AS created_at__extract_month @@ -95,22 +95,22 @@ FROM ( , listings_latest_src_28000.country AS country_latest , listings_latest_src_28000.is_lux AS is_lux_latest , listings_latest_src_28000.capacity AS capacity_latest - , DATE_TRUNC(listings_latest_src_28000.created_at, day) AS listing__ds__day - , DATE_TRUNC(listings_latest_src_28000.created_at, isoweek) AS listing__ds__week - , DATE_TRUNC(listings_latest_src_28000.created_at, month) AS listing__ds__month - , DATE_TRUNC(listings_latest_src_28000.created_at, quarter) AS listing__ds__quarter - , DATE_TRUNC(listings_latest_src_28000.created_at, year) AS listing__ds__year + , DATETIME_TRUNC(listings_latest_src_28000.created_at, day) AS listing__ds__day + , DATETIME_TRUNC(listings_latest_src_28000.created_at, isoweek) AS listing__ds__week + , DATETIME_TRUNC(listings_latest_src_28000.created_at, month) AS listing__ds__month + , DATETIME_TRUNC(listings_latest_src_28000.created_at, quarter) AS listing__ds__quarter + , DATETIME_TRUNC(listings_latest_src_28000.created_at, year) AS listing__ds__year , EXTRACT(year FROM listings_latest_src_28000.created_at) AS listing__ds__extract_year , EXTRACT(quarter FROM listings_latest_src_28000.created_at) AS listing__ds__extract_quarter , EXTRACT(month FROM listings_latest_src_28000.created_at) AS listing__ds__extract_month , EXTRACT(day FROM listings_latest_src_28000.created_at) AS listing__ds__extract_day , IF(EXTRACT(dayofweek FROM listings_latest_src_28000.created_at) = 1, 7, EXTRACT(dayofweek FROM listings_latest_src_28000.created_at) - 1) AS listing__ds__extract_dow , EXTRACT(dayofyear FROM listings_latest_src_28000.created_at) AS listing__ds__extract_doy - , DATE_TRUNC(listings_latest_src_28000.created_at, day) AS listing__created_at__day - , DATE_TRUNC(listings_latest_src_28000.created_at, isoweek) AS listing__created_at__week - , DATE_TRUNC(listings_latest_src_28000.created_at, month) AS listing__created_at__month - , DATE_TRUNC(listings_latest_src_28000.created_at, quarter) AS listing__created_at__quarter - , DATE_TRUNC(listings_latest_src_28000.created_at, year) AS listing__created_at__year + , DATETIME_TRUNC(listings_latest_src_28000.created_at, day) AS listing__created_at__day + , DATETIME_TRUNC(listings_latest_src_28000.created_at, isoweek) AS listing__created_at__week + , DATETIME_TRUNC(listings_latest_src_28000.created_at, month) AS listing__created_at__month + , DATETIME_TRUNC(listings_latest_src_28000.created_at, quarter) AS listing__created_at__quarter + , DATETIME_TRUNC(listings_latest_src_28000.created_at, year) AS listing__created_at__year , EXTRACT(year FROM listings_latest_src_28000.created_at) AS listing__created_at__extract_year , EXTRACT(quarter FROM listings_latest_src_28000.created_at) AS listing__created_at__extract_quarter , EXTRACT(month FROM listings_latest_src_28000.created_at) AS listing__created_at__extract_month @@ -157,11 +157,11 @@ FROM ( FROM ( -- Time Spine SELECT - DATE_TRUNC(time_spine_src_28000.ds, day) AS ds__day - , DATE_TRUNC(time_spine_src_28000.ds, isoweek) AS ds__week - , DATE_TRUNC(time_spine_src_28000.ds, month) AS ds__month - , DATE_TRUNC(time_spine_src_28000.ds, quarter) AS ds__quarter - , DATE_TRUNC(time_spine_src_28000.ds, year) AS ds__year + DATETIME_TRUNC(time_spine_src_28000.ds, day) AS ds__day + , DATETIME_TRUNC(time_spine_src_28000.ds, isoweek) AS ds__week + , DATETIME_TRUNC(time_spine_src_28000.ds, month) AS ds__month + , DATETIME_TRUNC(time_spine_src_28000.ds, quarter) AS ds__quarter + , DATETIME_TRUNC(time_spine_src_28000.ds, year) AS ds__year , EXTRACT(year FROM time_spine_src_28000.ds) AS ds__extract_year , EXTRACT(quarter FROM time_spine_src_28000.ds) AS ds__extract_quarter , EXTRACT(month FROM time_spine_src_28000.ds) AS ds__extract_month @@ -180,11 +180,11 @@ FROM ( FROM ( -- Read Elements From Semantic Model 'users_latest' SELECT - DATE_TRUNC(users_latest_src_28000.ds, day) AS ds_latest__day - , DATE_TRUNC(users_latest_src_28000.ds, isoweek) AS ds_latest__week - , DATE_TRUNC(users_latest_src_28000.ds, month) AS ds_latest__month - , DATE_TRUNC(users_latest_src_28000.ds, quarter) AS ds_latest__quarter - , DATE_TRUNC(users_latest_src_28000.ds, year) AS ds_latest__year + DATETIME_TRUNC(users_latest_src_28000.ds, day) AS ds_latest__day + , DATETIME_TRUNC(users_latest_src_28000.ds, isoweek) AS ds_latest__week + , DATETIME_TRUNC(users_latest_src_28000.ds, month) AS ds_latest__month + , DATETIME_TRUNC(users_latest_src_28000.ds, quarter) AS ds_latest__quarter + , DATETIME_TRUNC(users_latest_src_28000.ds, year) AS ds_latest__year , EXTRACT(year FROM users_latest_src_28000.ds) AS ds_latest__extract_year , EXTRACT(quarter FROM users_latest_src_28000.ds) AS ds_latest__extract_quarter , EXTRACT(month FROM users_latest_src_28000.ds) AS ds_latest__extract_month @@ -192,11 +192,11 @@ FROM ( , IF(EXTRACT(dayofweek FROM users_latest_src_28000.ds) = 1, 7, EXTRACT(dayofweek FROM users_latest_src_28000.ds) - 1) AS ds_latest__extract_dow , EXTRACT(dayofyear FROM users_latest_src_28000.ds) AS ds_latest__extract_doy , users_latest_src_28000.home_state_latest - , DATE_TRUNC(users_latest_src_28000.ds, day) AS user__ds_latest__day - , DATE_TRUNC(users_latest_src_28000.ds, isoweek) AS user__ds_latest__week - , DATE_TRUNC(users_latest_src_28000.ds, month) AS user__ds_latest__month - , DATE_TRUNC(users_latest_src_28000.ds, quarter) AS user__ds_latest__quarter - , DATE_TRUNC(users_latest_src_28000.ds, year) AS user__ds_latest__year + , DATETIME_TRUNC(users_latest_src_28000.ds, day) AS user__ds_latest__day + , DATETIME_TRUNC(users_latest_src_28000.ds, isoweek) AS user__ds_latest__week + , DATETIME_TRUNC(users_latest_src_28000.ds, month) AS user__ds_latest__month + , DATETIME_TRUNC(users_latest_src_28000.ds, quarter) AS user__ds_latest__quarter + , DATETIME_TRUNC(users_latest_src_28000.ds, year) AS user__ds_latest__year , EXTRACT(year FROM users_latest_src_28000.ds) AS user__ds_latest__extract_year , EXTRACT(quarter FROM users_latest_src_28000.ds) AS user__ds_latest__extract_quarter , EXTRACT(month FROM users_latest_src_28000.ds) AS user__ds_latest__extract_month diff --git a/tests_metricflow/snapshots/test_metric_time_without_metrics.py/SqlQueryPlan/BigQuery/test_metric_time_with_other_dimensions__plan0_optimized.sql b/tests_metricflow/snapshots/test_metric_time_without_metrics.py/SqlQueryPlan/BigQuery/test_metric_time_with_other_dimensions__plan0_optimized.sql index d1e55c763f..0ab00225f9 100644 --- a/tests_metricflow/snapshots/test_metric_time_without_metrics.py/SqlQueryPlan/BigQuery/test_metric_time_with_other_dimensions__plan0_optimized.sql +++ b/tests_metricflow/snapshots/test_metric_time_without_metrics.py/SqlQueryPlan/BigQuery/test_metric_time_with_other_dimensions__plan0_optimized.sql @@ -1,7 +1,7 @@ -- Join Standard Outputs -- Pass Only Elements: ['user__home_state_latest', 'listing__is_lux_latest', 'metric_time__day'] SELECT - DATE_TRUNC(time_spine_src_28000.ds, day) AS metric_time__day + DATETIME_TRUNC(time_spine_src_28000.ds, day) AS metric_time__day , listings_latest_src_28000.is_lux AS listing__is_lux_latest , users_latest_src_28000.home_state_latest AS user__home_state_latest FROM ***************************.dim_listings_latest listings_latest_src_28000 diff --git a/tests_metricflow/snapshots/test_query_rendering.py/SqlQueryPlan/BigQuery/test_common_semantic_model__plan0.sql b/tests_metricflow/snapshots/test_query_rendering.py/SqlQueryPlan/BigQuery/test_common_semantic_model__plan0.sql index 6af467474b..e0013d8e83 100644 --- a/tests_metricflow/snapshots/test_query_rendering.py/SqlQueryPlan/BigQuery/test_common_semantic_model__plan0.sql +++ b/tests_metricflow/snapshots/test_query_rendering.py/SqlQueryPlan/BigQuery/test_common_semantic_model__plan0.sql @@ -137,33 +137,33 @@ FROM ( , bookings_source_src_28000.booking_value AS approximate_continuous_booking_value_p99 , bookings_source_src_28000.booking_value AS approximate_discrete_booking_value_p99 , bookings_source_src_28000.is_instant - , DATE_TRUNC(bookings_source_src_28000.ds, day) AS ds__day - , DATE_TRUNC(bookings_source_src_28000.ds, isoweek) AS ds__week - , DATE_TRUNC(bookings_source_src_28000.ds, month) AS ds__month - , DATE_TRUNC(bookings_source_src_28000.ds, quarter) AS ds__quarter - , DATE_TRUNC(bookings_source_src_28000.ds, year) AS ds__year + , DATETIME_TRUNC(bookings_source_src_28000.ds, day) AS ds__day + , DATETIME_TRUNC(bookings_source_src_28000.ds, isoweek) AS ds__week + , DATETIME_TRUNC(bookings_source_src_28000.ds, month) AS ds__month + , DATETIME_TRUNC(bookings_source_src_28000.ds, quarter) AS ds__quarter + , DATETIME_TRUNC(bookings_source_src_28000.ds, year) AS ds__year , EXTRACT(year FROM bookings_source_src_28000.ds) AS ds__extract_year , EXTRACT(quarter FROM bookings_source_src_28000.ds) AS ds__extract_quarter , EXTRACT(month FROM bookings_source_src_28000.ds) AS ds__extract_month , EXTRACT(day FROM bookings_source_src_28000.ds) AS ds__extract_day , IF(EXTRACT(dayofweek FROM bookings_source_src_28000.ds) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_28000.ds) - 1) AS ds__extract_dow , EXTRACT(dayofyear FROM bookings_source_src_28000.ds) AS ds__extract_doy - , DATE_TRUNC(bookings_source_src_28000.ds_partitioned, day) AS ds_partitioned__day - , DATE_TRUNC(bookings_source_src_28000.ds_partitioned, isoweek) AS ds_partitioned__week - , DATE_TRUNC(bookings_source_src_28000.ds_partitioned, month) AS ds_partitioned__month - , DATE_TRUNC(bookings_source_src_28000.ds_partitioned, quarter) AS ds_partitioned__quarter - , DATE_TRUNC(bookings_source_src_28000.ds_partitioned, year) AS ds_partitioned__year + , DATETIME_TRUNC(bookings_source_src_28000.ds_partitioned, day) AS ds_partitioned__day + , DATETIME_TRUNC(bookings_source_src_28000.ds_partitioned, isoweek) AS ds_partitioned__week + , DATETIME_TRUNC(bookings_source_src_28000.ds_partitioned, month) AS ds_partitioned__month + , DATETIME_TRUNC(bookings_source_src_28000.ds_partitioned, quarter) AS ds_partitioned__quarter + , DATETIME_TRUNC(bookings_source_src_28000.ds_partitioned, year) AS ds_partitioned__year , EXTRACT(year FROM bookings_source_src_28000.ds_partitioned) AS ds_partitioned__extract_year , EXTRACT(quarter FROM bookings_source_src_28000.ds_partitioned) AS ds_partitioned__extract_quarter , EXTRACT(month FROM bookings_source_src_28000.ds_partitioned) AS ds_partitioned__extract_month , EXTRACT(day FROM bookings_source_src_28000.ds_partitioned) AS ds_partitioned__extract_day , IF(EXTRACT(dayofweek FROM bookings_source_src_28000.ds_partitioned) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_28000.ds_partitioned) - 1) AS ds_partitioned__extract_dow , EXTRACT(dayofyear FROM bookings_source_src_28000.ds_partitioned) AS ds_partitioned__extract_doy - , DATE_TRUNC(bookings_source_src_28000.paid_at, day) AS paid_at__day - , DATE_TRUNC(bookings_source_src_28000.paid_at, isoweek) AS paid_at__week - , DATE_TRUNC(bookings_source_src_28000.paid_at, month) AS paid_at__month - , DATE_TRUNC(bookings_source_src_28000.paid_at, quarter) AS paid_at__quarter - , DATE_TRUNC(bookings_source_src_28000.paid_at, year) AS paid_at__year + , DATETIME_TRUNC(bookings_source_src_28000.paid_at, day) AS paid_at__day + , DATETIME_TRUNC(bookings_source_src_28000.paid_at, isoweek) AS paid_at__week + , DATETIME_TRUNC(bookings_source_src_28000.paid_at, month) AS paid_at__month + , DATETIME_TRUNC(bookings_source_src_28000.paid_at, quarter) AS paid_at__quarter + , DATETIME_TRUNC(bookings_source_src_28000.paid_at, year) AS paid_at__year , EXTRACT(year FROM bookings_source_src_28000.paid_at) AS paid_at__extract_year , EXTRACT(quarter FROM bookings_source_src_28000.paid_at) AS paid_at__extract_quarter , EXTRACT(month FROM bookings_source_src_28000.paid_at) AS paid_at__extract_month @@ -171,33 +171,33 @@ FROM ( , IF(EXTRACT(dayofweek FROM bookings_source_src_28000.paid_at) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_28000.paid_at) - 1) AS paid_at__extract_dow , EXTRACT(dayofyear FROM bookings_source_src_28000.paid_at) AS paid_at__extract_doy , bookings_source_src_28000.is_instant AS booking__is_instant - , DATE_TRUNC(bookings_source_src_28000.ds, day) AS booking__ds__day - , DATE_TRUNC(bookings_source_src_28000.ds, isoweek) AS booking__ds__week - , DATE_TRUNC(bookings_source_src_28000.ds, month) AS booking__ds__month - , DATE_TRUNC(bookings_source_src_28000.ds, quarter) AS booking__ds__quarter - , DATE_TRUNC(bookings_source_src_28000.ds, year) AS booking__ds__year + , DATETIME_TRUNC(bookings_source_src_28000.ds, day) AS booking__ds__day + , DATETIME_TRUNC(bookings_source_src_28000.ds, isoweek) AS booking__ds__week + , DATETIME_TRUNC(bookings_source_src_28000.ds, month) AS booking__ds__month + , DATETIME_TRUNC(bookings_source_src_28000.ds, quarter) AS booking__ds__quarter + , DATETIME_TRUNC(bookings_source_src_28000.ds, year) AS booking__ds__year , EXTRACT(year FROM bookings_source_src_28000.ds) AS booking__ds__extract_year , EXTRACT(quarter FROM bookings_source_src_28000.ds) AS booking__ds__extract_quarter , EXTRACT(month FROM bookings_source_src_28000.ds) AS booking__ds__extract_month , EXTRACT(day FROM bookings_source_src_28000.ds) AS booking__ds__extract_day , IF(EXTRACT(dayofweek FROM bookings_source_src_28000.ds) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_28000.ds) - 1) AS booking__ds__extract_dow , EXTRACT(dayofyear FROM bookings_source_src_28000.ds) AS booking__ds__extract_doy - , DATE_TRUNC(bookings_source_src_28000.ds_partitioned, day) AS booking__ds_partitioned__day - , DATE_TRUNC(bookings_source_src_28000.ds_partitioned, isoweek) AS booking__ds_partitioned__week - , DATE_TRUNC(bookings_source_src_28000.ds_partitioned, month) AS booking__ds_partitioned__month - , DATE_TRUNC(bookings_source_src_28000.ds_partitioned, quarter) AS booking__ds_partitioned__quarter - , DATE_TRUNC(bookings_source_src_28000.ds_partitioned, year) AS booking__ds_partitioned__year + , DATETIME_TRUNC(bookings_source_src_28000.ds_partitioned, day) AS booking__ds_partitioned__day + , DATETIME_TRUNC(bookings_source_src_28000.ds_partitioned, isoweek) AS booking__ds_partitioned__week + , DATETIME_TRUNC(bookings_source_src_28000.ds_partitioned, month) AS booking__ds_partitioned__month + , DATETIME_TRUNC(bookings_source_src_28000.ds_partitioned, quarter) AS booking__ds_partitioned__quarter + , DATETIME_TRUNC(bookings_source_src_28000.ds_partitioned, year) AS booking__ds_partitioned__year , EXTRACT(year FROM bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__extract_year , EXTRACT(quarter FROM bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__extract_quarter , EXTRACT(month FROM bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__extract_month , EXTRACT(day FROM bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__extract_day , IF(EXTRACT(dayofweek FROM bookings_source_src_28000.ds_partitioned) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_28000.ds_partitioned) - 1) AS booking__ds_partitioned__extract_dow , EXTRACT(dayofyear FROM bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__extract_doy - , DATE_TRUNC(bookings_source_src_28000.paid_at, day) AS booking__paid_at__day - , DATE_TRUNC(bookings_source_src_28000.paid_at, isoweek) AS booking__paid_at__week - , DATE_TRUNC(bookings_source_src_28000.paid_at, month) AS booking__paid_at__month - , DATE_TRUNC(bookings_source_src_28000.paid_at, quarter) AS booking__paid_at__quarter - , DATE_TRUNC(bookings_source_src_28000.paid_at, year) AS booking__paid_at__year + , DATETIME_TRUNC(bookings_source_src_28000.paid_at, day) AS booking__paid_at__day + , DATETIME_TRUNC(bookings_source_src_28000.paid_at, isoweek) AS booking__paid_at__week + , DATETIME_TRUNC(bookings_source_src_28000.paid_at, month) AS booking__paid_at__month + , DATETIME_TRUNC(bookings_source_src_28000.paid_at, quarter) AS booking__paid_at__quarter + , DATETIME_TRUNC(bookings_source_src_28000.paid_at, year) AS booking__paid_at__year , EXTRACT(year FROM bookings_source_src_28000.paid_at) AS booking__paid_at__extract_year , EXTRACT(quarter FROM bookings_source_src_28000.paid_at) AS booking__paid_at__extract_quarter , EXTRACT(month FROM bookings_source_src_28000.paid_at) AS booking__paid_at__extract_month @@ -352,33 +352,33 @@ FULL OUTER JOIN ( , bookings_source_src_28000.booking_value AS approximate_continuous_booking_value_p99 , bookings_source_src_28000.booking_value AS approximate_discrete_booking_value_p99 , bookings_source_src_28000.is_instant - , DATE_TRUNC(bookings_source_src_28000.ds, day) AS ds__day - , DATE_TRUNC(bookings_source_src_28000.ds, isoweek) AS ds__week - , DATE_TRUNC(bookings_source_src_28000.ds, month) AS ds__month - , DATE_TRUNC(bookings_source_src_28000.ds, quarter) AS ds__quarter - , DATE_TRUNC(bookings_source_src_28000.ds, year) AS ds__year + , DATETIME_TRUNC(bookings_source_src_28000.ds, day) AS ds__day + , DATETIME_TRUNC(bookings_source_src_28000.ds, isoweek) AS ds__week + , DATETIME_TRUNC(bookings_source_src_28000.ds, month) AS ds__month + , DATETIME_TRUNC(bookings_source_src_28000.ds, quarter) AS ds__quarter + , DATETIME_TRUNC(bookings_source_src_28000.ds, year) AS ds__year , EXTRACT(year FROM bookings_source_src_28000.ds) AS ds__extract_year , EXTRACT(quarter FROM bookings_source_src_28000.ds) AS ds__extract_quarter , EXTRACT(month FROM bookings_source_src_28000.ds) AS ds__extract_month , EXTRACT(day FROM bookings_source_src_28000.ds) AS ds__extract_day , IF(EXTRACT(dayofweek FROM bookings_source_src_28000.ds) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_28000.ds) - 1) AS ds__extract_dow , EXTRACT(dayofyear FROM bookings_source_src_28000.ds) AS ds__extract_doy - , DATE_TRUNC(bookings_source_src_28000.ds_partitioned, day) AS ds_partitioned__day - , DATE_TRUNC(bookings_source_src_28000.ds_partitioned, isoweek) AS ds_partitioned__week - , DATE_TRUNC(bookings_source_src_28000.ds_partitioned, month) AS ds_partitioned__month - , DATE_TRUNC(bookings_source_src_28000.ds_partitioned, quarter) AS ds_partitioned__quarter - , DATE_TRUNC(bookings_source_src_28000.ds_partitioned, year) AS ds_partitioned__year + , DATETIME_TRUNC(bookings_source_src_28000.ds_partitioned, day) AS ds_partitioned__day + , DATETIME_TRUNC(bookings_source_src_28000.ds_partitioned, isoweek) AS ds_partitioned__week + , DATETIME_TRUNC(bookings_source_src_28000.ds_partitioned, month) AS ds_partitioned__month + , DATETIME_TRUNC(bookings_source_src_28000.ds_partitioned, quarter) AS ds_partitioned__quarter + , DATETIME_TRUNC(bookings_source_src_28000.ds_partitioned, year) AS ds_partitioned__year , EXTRACT(year FROM bookings_source_src_28000.ds_partitioned) AS ds_partitioned__extract_year , EXTRACT(quarter FROM bookings_source_src_28000.ds_partitioned) AS ds_partitioned__extract_quarter , EXTRACT(month FROM bookings_source_src_28000.ds_partitioned) AS ds_partitioned__extract_month , EXTRACT(day FROM bookings_source_src_28000.ds_partitioned) AS ds_partitioned__extract_day , IF(EXTRACT(dayofweek FROM bookings_source_src_28000.ds_partitioned) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_28000.ds_partitioned) - 1) AS ds_partitioned__extract_dow , EXTRACT(dayofyear FROM bookings_source_src_28000.ds_partitioned) AS ds_partitioned__extract_doy - , DATE_TRUNC(bookings_source_src_28000.paid_at, day) AS paid_at__day - , DATE_TRUNC(bookings_source_src_28000.paid_at, isoweek) AS paid_at__week - , DATE_TRUNC(bookings_source_src_28000.paid_at, month) AS paid_at__month - , DATE_TRUNC(bookings_source_src_28000.paid_at, quarter) AS paid_at__quarter - , DATE_TRUNC(bookings_source_src_28000.paid_at, year) AS paid_at__year + , DATETIME_TRUNC(bookings_source_src_28000.paid_at, day) AS paid_at__day + , DATETIME_TRUNC(bookings_source_src_28000.paid_at, isoweek) AS paid_at__week + , DATETIME_TRUNC(bookings_source_src_28000.paid_at, month) AS paid_at__month + , DATETIME_TRUNC(bookings_source_src_28000.paid_at, quarter) AS paid_at__quarter + , DATETIME_TRUNC(bookings_source_src_28000.paid_at, year) AS paid_at__year , EXTRACT(year FROM bookings_source_src_28000.paid_at) AS paid_at__extract_year , EXTRACT(quarter FROM bookings_source_src_28000.paid_at) AS paid_at__extract_quarter , EXTRACT(month FROM bookings_source_src_28000.paid_at) AS paid_at__extract_month @@ -386,33 +386,33 @@ FULL OUTER JOIN ( , IF(EXTRACT(dayofweek FROM bookings_source_src_28000.paid_at) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_28000.paid_at) - 1) AS paid_at__extract_dow , EXTRACT(dayofyear FROM bookings_source_src_28000.paid_at) AS paid_at__extract_doy , bookings_source_src_28000.is_instant AS booking__is_instant - , DATE_TRUNC(bookings_source_src_28000.ds, day) AS booking__ds__day - , DATE_TRUNC(bookings_source_src_28000.ds, isoweek) AS booking__ds__week - , DATE_TRUNC(bookings_source_src_28000.ds, month) AS booking__ds__month - , DATE_TRUNC(bookings_source_src_28000.ds, quarter) AS booking__ds__quarter - , DATE_TRUNC(bookings_source_src_28000.ds, year) AS booking__ds__year + , DATETIME_TRUNC(bookings_source_src_28000.ds, day) AS booking__ds__day + , DATETIME_TRUNC(bookings_source_src_28000.ds, isoweek) AS booking__ds__week + , DATETIME_TRUNC(bookings_source_src_28000.ds, month) AS booking__ds__month + , DATETIME_TRUNC(bookings_source_src_28000.ds, quarter) AS booking__ds__quarter + , DATETIME_TRUNC(bookings_source_src_28000.ds, year) AS booking__ds__year , EXTRACT(year FROM bookings_source_src_28000.ds) AS booking__ds__extract_year , EXTRACT(quarter FROM bookings_source_src_28000.ds) AS booking__ds__extract_quarter , EXTRACT(month FROM bookings_source_src_28000.ds) AS booking__ds__extract_month , EXTRACT(day FROM bookings_source_src_28000.ds) AS booking__ds__extract_day , IF(EXTRACT(dayofweek FROM bookings_source_src_28000.ds) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_28000.ds) - 1) AS booking__ds__extract_dow , EXTRACT(dayofyear FROM bookings_source_src_28000.ds) AS booking__ds__extract_doy - , DATE_TRUNC(bookings_source_src_28000.ds_partitioned, day) AS booking__ds_partitioned__day - , DATE_TRUNC(bookings_source_src_28000.ds_partitioned, isoweek) AS booking__ds_partitioned__week - , DATE_TRUNC(bookings_source_src_28000.ds_partitioned, month) AS booking__ds_partitioned__month - , DATE_TRUNC(bookings_source_src_28000.ds_partitioned, quarter) AS booking__ds_partitioned__quarter - , DATE_TRUNC(bookings_source_src_28000.ds_partitioned, year) AS booking__ds_partitioned__year + , DATETIME_TRUNC(bookings_source_src_28000.ds_partitioned, day) AS booking__ds_partitioned__day + , DATETIME_TRUNC(bookings_source_src_28000.ds_partitioned, isoweek) AS booking__ds_partitioned__week + , DATETIME_TRUNC(bookings_source_src_28000.ds_partitioned, month) AS booking__ds_partitioned__month + , DATETIME_TRUNC(bookings_source_src_28000.ds_partitioned, quarter) AS booking__ds_partitioned__quarter + , DATETIME_TRUNC(bookings_source_src_28000.ds_partitioned, year) AS booking__ds_partitioned__year , EXTRACT(year FROM bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__extract_year , EXTRACT(quarter FROM bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__extract_quarter , EXTRACT(month FROM bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__extract_month , EXTRACT(day FROM bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__extract_day , IF(EXTRACT(dayofweek FROM bookings_source_src_28000.ds_partitioned) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_28000.ds_partitioned) - 1) AS booking__ds_partitioned__extract_dow , EXTRACT(dayofyear FROM bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__extract_doy - , DATE_TRUNC(bookings_source_src_28000.paid_at, day) AS booking__paid_at__day - , DATE_TRUNC(bookings_source_src_28000.paid_at, isoweek) AS booking__paid_at__week - , DATE_TRUNC(bookings_source_src_28000.paid_at, month) AS booking__paid_at__month - , DATE_TRUNC(bookings_source_src_28000.paid_at, quarter) AS booking__paid_at__quarter - , DATE_TRUNC(bookings_source_src_28000.paid_at, year) AS booking__paid_at__year + , DATETIME_TRUNC(bookings_source_src_28000.paid_at, day) AS booking__paid_at__day + , DATETIME_TRUNC(bookings_source_src_28000.paid_at, isoweek) AS booking__paid_at__week + , DATETIME_TRUNC(bookings_source_src_28000.paid_at, month) AS booking__paid_at__month + , DATETIME_TRUNC(bookings_source_src_28000.paid_at, quarter) AS booking__paid_at__quarter + , DATETIME_TRUNC(bookings_source_src_28000.paid_at, year) AS booking__paid_at__year , EXTRACT(year FROM bookings_source_src_28000.paid_at) AS booking__paid_at__extract_year , EXTRACT(quarter FROM bookings_source_src_28000.paid_at) AS booking__paid_at__extract_quarter , EXTRACT(month FROM bookings_source_src_28000.paid_at) AS booking__paid_at__extract_month diff --git a/tests_metricflow/snapshots/test_query_rendering.py/SqlQueryPlan/BigQuery/test_common_semantic_model__plan0_optimized.sql b/tests_metricflow/snapshots/test_query_rendering.py/SqlQueryPlan/BigQuery/test_common_semantic_model__plan0_optimized.sql index 331767c8c8..71765d80b4 100644 --- a/tests_metricflow/snapshots/test_query_rendering.py/SqlQueryPlan/BigQuery/test_common_semantic_model__plan0_optimized.sql +++ b/tests_metricflow/snapshots/test_query_rendering.py/SqlQueryPlan/BigQuery/test_common_semantic_model__plan0_optimized.sql @@ -14,7 +14,7 @@ FROM ( -- Metric Time Dimension 'ds' -- Pass Only Elements: ['bookings', 'metric_time__day'] SELECT - DATE_TRUNC(ds, day) AS metric_time__day + DATETIME_TRUNC(ds, day) AS metric_time__day , 1 AS bookings FROM ***************************.fct_bookings bookings_source_src_28000 ) subq_12 @@ -28,7 +28,7 @@ FULL OUTER JOIN ( -- Aggregate Measures -- Compute Metrics via Expressions SELECT - DATE_TRUNC(ds, day) AS metric_time__day + DATETIME_TRUNC(ds, day) AS metric_time__day , SUM(booking_value) AS booking_value FROM ***************************.fct_bookings bookings_source_src_28000 GROUP BY diff --git a/tests_metricflow/snapshots/test_query_rendering.py/SqlQueryPlan/BigQuery/test_distinct_values__plan0.sql b/tests_metricflow/snapshots/test_query_rendering.py/SqlQueryPlan/BigQuery/test_distinct_values__plan0.sql index 64eedb3232..d6107b7b08 100644 --- a/tests_metricflow/snapshots/test_query_rendering.py/SqlQueryPlan/BigQuery/test_distinct_values__plan0.sql +++ b/tests_metricflow/snapshots/test_query_rendering.py/SqlQueryPlan/BigQuery/test_distinct_values__plan0.sql @@ -70,22 +70,22 @@ FROM ( 1 AS listings , listings_latest_src_28000.capacity AS largest_listing , listings_latest_src_28000.capacity AS smallest_listing - , DATE_TRUNC(listings_latest_src_28000.created_at, day) AS ds__day - , DATE_TRUNC(listings_latest_src_28000.created_at, isoweek) AS ds__week - , DATE_TRUNC(listings_latest_src_28000.created_at, month) AS ds__month - , DATE_TRUNC(listings_latest_src_28000.created_at, quarter) AS ds__quarter - , DATE_TRUNC(listings_latest_src_28000.created_at, year) AS ds__year + , DATETIME_TRUNC(listings_latest_src_28000.created_at, day) AS ds__day + , DATETIME_TRUNC(listings_latest_src_28000.created_at, isoweek) AS ds__week + , DATETIME_TRUNC(listings_latest_src_28000.created_at, month) AS ds__month + , DATETIME_TRUNC(listings_latest_src_28000.created_at, quarter) AS ds__quarter + , DATETIME_TRUNC(listings_latest_src_28000.created_at, year) AS ds__year , EXTRACT(year FROM listings_latest_src_28000.created_at) AS ds__extract_year , EXTRACT(quarter FROM listings_latest_src_28000.created_at) AS ds__extract_quarter , EXTRACT(month FROM listings_latest_src_28000.created_at) AS ds__extract_month , EXTRACT(day FROM listings_latest_src_28000.created_at) AS ds__extract_day , IF(EXTRACT(dayofweek FROM listings_latest_src_28000.created_at) = 1, 7, EXTRACT(dayofweek FROM listings_latest_src_28000.created_at) - 1) AS ds__extract_dow , EXTRACT(dayofyear FROM listings_latest_src_28000.created_at) AS ds__extract_doy - , DATE_TRUNC(listings_latest_src_28000.created_at, day) AS created_at__day - , DATE_TRUNC(listings_latest_src_28000.created_at, isoweek) AS created_at__week - , DATE_TRUNC(listings_latest_src_28000.created_at, month) AS created_at__month - , DATE_TRUNC(listings_latest_src_28000.created_at, quarter) AS created_at__quarter - , DATE_TRUNC(listings_latest_src_28000.created_at, year) AS created_at__year + , DATETIME_TRUNC(listings_latest_src_28000.created_at, day) AS created_at__day + , DATETIME_TRUNC(listings_latest_src_28000.created_at, isoweek) AS created_at__week + , DATETIME_TRUNC(listings_latest_src_28000.created_at, month) AS created_at__month + , DATETIME_TRUNC(listings_latest_src_28000.created_at, quarter) AS created_at__quarter + , DATETIME_TRUNC(listings_latest_src_28000.created_at, year) AS created_at__year , EXTRACT(year FROM listings_latest_src_28000.created_at) AS created_at__extract_year , EXTRACT(quarter FROM listings_latest_src_28000.created_at) AS created_at__extract_quarter , EXTRACT(month FROM listings_latest_src_28000.created_at) AS created_at__extract_month @@ -95,22 +95,22 @@ FROM ( , listings_latest_src_28000.country AS country_latest , listings_latest_src_28000.is_lux AS is_lux_latest , listings_latest_src_28000.capacity AS capacity_latest - , DATE_TRUNC(listings_latest_src_28000.created_at, day) AS listing__ds__day - , DATE_TRUNC(listings_latest_src_28000.created_at, isoweek) AS listing__ds__week - , DATE_TRUNC(listings_latest_src_28000.created_at, month) AS listing__ds__month - , DATE_TRUNC(listings_latest_src_28000.created_at, quarter) AS listing__ds__quarter - , DATE_TRUNC(listings_latest_src_28000.created_at, year) AS listing__ds__year + , DATETIME_TRUNC(listings_latest_src_28000.created_at, day) AS listing__ds__day + , DATETIME_TRUNC(listings_latest_src_28000.created_at, isoweek) AS listing__ds__week + , DATETIME_TRUNC(listings_latest_src_28000.created_at, month) AS listing__ds__month + , DATETIME_TRUNC(listings_latest_src_28000.created_at, quarter) AS listing__ds__quarter + , DATETIME_TRUNC(listings_latest_src_28000.created_at, year) AS listing__ds__year , EXTRACT(year FROM listings_latest_src_28000.created_at) AS listing__ds__extract_year , EXTRACT(quarter FROM listings_latest_src_28000.created_at) AS listing__ds__extract_quarter , EXTRACT(month FROM listings_latest_src_28000.created_at) AS listing__ds__extract_month , EXTRACT(day FROM listings_latest_src_28000.created_at) AS listing__ds__extract_day , IF(EXTRACT(dayofweek FROM listings_latest_src_28000.created_at) = 1, 7, EXTRACT(dayofweek FROM listings_latest_src_28000.created_at) - 1) AS listing__ds__extract_dow , EXTRACT(dayofyear FROM listings_latest_src_28000.created_at) AS listing__ds__extract_doy - , DATE_TRUNC(listings_latest_src_28000.created_at, day) AS listing__created_at__day - , DATE_TRUNC(listings_latest_src_28000.created_at, isoweek) AS listing__created_at__week - , DATE_TRUNC(listings_latest_src_28000.created_at, month) AS listing__created_at__month - , DATE_TRUNC(listings_latest_src_28000.created_at, quarter) AS listing__created_at__quarter - , DATE_TRUNC(listings_latest_src_28000.created_at, year) AS listing__created_at__year + , DATETIME_TRUNC(listings_latest_src_28000.created_at, day) AS listing__created_at__day + , DATETIME_TRUNC(listings_latest_src_28000.created_at, isoweek) AS listing__created_at__week + , DATETIME_TRUNC(listings_latest_src_28000.created_at, month) AS listing__created_at__month + , DATETIME_TRUNC(listings_latest_src_28000.created_at, quarter) AS listing__created_at__quarter + , DATETIME_TRUNC(listings_latest_src_28000.created_at, year) AS listing__created_at__year , EXTRACT(year FROM listings_latest_src_28000.created_at) AS listing__created_at__extract_year , EXTRACT(quarter FROM listings_latest_src_28000.created_at) AS listing__created_at__extract_quarter , EXTRACT(month FROM listings_latest_src_28000.created_at) AS listing__created_at__extract_month diff --git a/tests_metricflow/snapshots/test_query_rendering.py/SqlQueryPlan/BigQuery/test_filter_with_where_constraint_on_join_dim__plan0.sql b/tests_metricflow/snapshots/test_query_rendering.py/SqlQueryPlan/BigQuery/test_filter_with_where_constraint_on_join_dim__plan0.sql index e3b45dd3a3..f2721226e3 100644 --- a/tests_metricflow/snapshots/test_query_rendering.py/SqlQueryPlan/BigQuery/test_filter_with_where_constraint_on_join_dim__plan0.sql +++ b/tests_metricflow/snapshots/test_query_rendering.py/SqlQueryPlan/BigQuery/test_filter_with_where_constraint_on_join_dim__plan0.sql @@ -156,33 +156,33 @@ FROM ( , bookings_source_src_28000.booking_value AS approximate_continuous_booking_value_p99 , bookings_source_src_28000.booking_value AS approximate_discrete_booking_value_p99 , bookings_source_src_28000.is_instant - , DATE_TRUNC(bookings_source_src_28000.ds, day) AS ds__day - , DATE_TRUNC(bookings_source_src_28000.ds, isoweek) AS ds__week - , DATE_TRUNC(bookings_source_src_28000.ds, month) AS ds__month - , DATE_TRUNC(bookings_source_src_28000.ds, quarter) AS ds__quarter - , DATE_TRUNC(bookings_source_src_28000.ds, year) AS ds__year + , DATETIME_TRUNC(bookings_source_src_28000.ds, day) AS ds__day + , DATETIME_TRUNC(bookings_source_src_28000.ds, isoweek) AS ds__week + , DATETIME_TRUNC(bookings_source_src_28000.ds, month) AS ds__month + , DATETIME_TRUNC(bookings_source_src_28000.ds, quarter) AS ds__quarter + , DATETIME_TRUNC(bookings_source_src_28000.ds, year) AS ds__year , EXTRACT(year FROM bookings_source_src_28000.ds) AS ds__extract_year , EXTRACT(quarter FROM bookings_source_src_28000.ds) AS ds__extract_quarter , EXTRACT(month FROM bookings_source_src_28000.ds) AS ds__extract_month , EXTRACT(day FROM bookings_source_src_28000.ds) AS ds__extract_day , IF(EXTRACT(dayofweek FROM bookings_source_src_28000.ds) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_28000.ds) - 1) AS ds__extract_dow , EXTRACT(dayofyear FROM bookings_source_src_28000.ds) AS ds__extract_doy - , DATE_TRUNC(bookings_source_src_28000.ds_partitioned, day) AS ds_partitioned__day - , DATE_TRUNC(bookings_source_src_28000.ds_partitioned, isoweek) AS ds_partitioned__week - , DATE_TRUNC(bookings_source_src_28000.ds_partitioned, month) AS ds_partitioned__month - , DATE_TRUNC(bookings_source_src_28000.ds_partitioned, quarter) AS ds_partitioned__quarter - , DATE_TRUNC(bookings_source_src_28000.ds_partitioned, year) AS ds_partitioned__year + , DATETIME_TRUNC(bookings_source_src_28000.ds_partitioned, day) AS ds_partitioned__day + , DATETIME_TRUNC(bookings_source_src_28000.ds_partitioned, isoweek) AS ds_partitioned__week + , DATETIME_TRUNC(bookings_source_src_28000.ds_partitioned, month) AS ds_partitioned__month + , DATETIME_TRUNC(bookings_source_src_28000.ds_partitioned, quarter) AS ds_partitioned__quarter + , DATETIME_TRUNC(bookings_source_src_28000.ds_partitioned, year) AS ds_partitioned__year , EXTRACT(year FROM bookings_source_src_28000.ds_partitioned) AS ds_partitioned__extract_year , EXTRACT(quarter FROM bookings_source_src_28000.ds_partitioned) AS ds_partitioned__extract_quarter , EXTRACT(month FROM bookings_source_src_28000.ds_partitioned) AS ds_partitioned__extract_month , EXTRACT(day FROM bookings_source_src_28000.ds_partitioned) AS ds_partitioned__extract_day , IF(EXTRACT(dayofweek FROM bookings_source_src_28000.ds_partitioned) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_28000.ds_partitioned) - 1) AS ds_partitioned__extract_dow , EXTRACT(dayofyear FROM bookings_source_src_28000.ds_partitioned) AS ds_partitioned__extract_doy - , DATE_TRUNC(bookings_source_src_28000.paid_at, day) AS paid_at__day - , DATE_TRUNC(bookings_source_src_28000.paid_at, isoweek) AS paid_at__week - , DATE_TRUNC(bookings_source_src_28000.paid_at, month) AS paid_at__month - , DATE_TRUNC(bookings_source_src_28000.paid_at, quarter) AS paid_at__quarter - , DATE_TRUNC(bookings_source_src_28000.paid_at, year) AS paid_at__year + , DATETIME_TRUNC(bookings_source_src_28000.paid_at, day) AS paid_at__day + , DATETIME_TRUNC(bookings_source_src_28000.paid_at, isoweek) AS paid_at__week + , DATETIME_TRUNC(bookings_source_src_28000.paid_at, month) AS paid_at__month + , DATETIME_TRUNC(bookings_source_src_28000.paid_at, quarter) AS paid_at__quarter + , DATETIME_TRUNC(bookings_source_src_28000.paid_at, year) AS paid_at__year , EXTRACT(year FROM bookings_source_src_28000.paid_at) AS paid_at__extract_year , EXTRACT(quarter FROM bookings_source_src_28000.paid_at) AS paid_at__extract_quarter , EXTRACT(month FROM bookings_source_src_28000.paid_at) AS paid_at__extract_month @@ -190,33 +190,33 @@ FROM ( , IF(EXTRACT(dayofweek FROM bookings_source_src_28000.paid_at) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_28000.paid_at) - 1) AS paid_at__extract_dow , EXTRACT(dayofyear FROM bookings_source_src_28000.paid_at) AS paid_at__extract_doy , bookings_source_src_28000.is_instant AS booking__is_instant - , DATE_TRUNC(bookings_source_src_28000.ds, day) AS booking__ds__day - , DATE_TRUNC(bookings_source_src_28000.ds, isoweek) AS booking__ds__week - , DATE_TRUNC(bookings_source_src_28000.ds, month) AS booking__ds__month - , DATE_TRUNC(bookings_source_src_28000.ds, quarter) AS booking__ds__quarter - , DATE_TRUNC(bookings_source_src_28000.ds, year) AS booking__ds__year + , DATETIME_TRUNC(bookings_source_src_28000.ds, day) AS booking__ds__day + , DATETIME_TRUNC(bookings_source_src_28000.ds, isoweek) AS booking__ds__week + , DATETIME_TRUNC(bookings_source_src_28000.ds, month) AS booking__ds__month + , DATETIME_TRUNC(bookings_source_src_28000.ds, quarter) AS booking__ds__quarter + , DATETIME_TRUNC(bookings_source_src_28000.ds, year) AS booking__ds__year , EXTRACT(year FROM bookings_source_src_28000.ds) AS booking__ds__extract_year , EXTRACT(quarter FROM bookings_source_src_28000.ds) AS booking__ds__extract_quarter , EXTRACT(month FROM bookings_source_src_28000.ds) AS booking__ds__extract_month , EXTRACT(day FROM bookings_source_src_28000.ds) AS booking__ds__extract_day , IF(EXTRACT(dayofweek FROM bookings_source_src_28000.ds) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_28000.ds) - 1) AS booking__ds__extract_dow , EXTRACT(dayofyear FROM bookings_source_src_28000.ds) AS booking__ds__extract_doy - , DATE_TRUNC(bookings_source_src_28000.ds_partitioned, day) AS booking__ds_partitioned__day - , DATE_TRUNC(bookings_source_src_28000.ds_partitioned, isoweek) AS booking__ds_partitioned__week - , DATE_TRUNC(bookings_source_src_28000.ds_partitioned, month) AS booking__ds_partitioned__month - , DATE_TRUNC(bookings_source_src_28000.ds_partitioned, quarter) AS booking__ds_partitioned__quarter - , DATE_TRUNC(bookings_source_src_28000.ds_partitioned, year) AS booking__ds_partitioned__year + , DATETIME_TRUNC(bookings_source_src_28000.ds_partitioned, day) AS booking__ds_partitioned__day + , DATETIME_TRUNC(bookings_source_src_28000.ds_partitioned, isoweek) AS booking__ds_partitioned__week + , DATETIME_TRUNC(bookings_source_src_28000.ds_partitioned, month) AS booking__ds_partitioned__month + , DATETIME_TRUNC(bookings_source_src_28000.ds_partitioned, quarter) AS booking__ds_partitioned__quarter + , DATETIME_TRUNC(bookings_source_src_28000.ds_partitioned, year) AS booking__ds_partitioned__year , EXTRACT(year FROM bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__extract_year , EXTRACT(quarter FROM bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__extract_quarter , EXTRACT(month FROM bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__extract_month , EXTRACT(day FROM bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__extract_day , IF(EXTRACT(dayofweek FROM bookings_source_src_28000.ds_partitioned) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_28000.ds_partitioned) - 1) AS booking__ds_partitioned__extract_dow , EXTRACT(dayofyear FROM bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__extract_doy - , DATE_TRUNC(bookings_source_src_28000.paid_at, day) AS booking__paid_at__day - , DATE_TRUNC(bookings_source_src_28000.paid_at, isoweek) AS booking__paid_at__week - , DATE_TRUNC(bookings_source_src_28000.paid_at, month) AS booking__paid_at__month - , DATE_TRUNC(bookings_source_src_28000.paid_at, quarter) AS booking__paid_at__quarter - , DATE_TRUNC(bookings_source_src_28000.paid_at, year) AS booking__paid_at__year + , DATETIME_TRUNC(bookings_source_src_28000.paid_at, day) AS booking__paid_at__day + , DATETIME_TRUNC(bookings_source_src_28000.paid_at, isoweek) AS booking__paid_at__week + , DATETIME_TRUNC(bookings_source_src_28000.paid_at, month) AS booking__paid_at__month + , DATETIME_TRUNC(bookings_source_src_28000.paid_at, quarter) AS booking__paid_at__quarter + , DATETIME_TRUNC(bookings_source_src_28000.paid_at, year) AS booking__paid_at__year , EXTRACT(year FROM bookings_source_src_28000.paid_at) AS booking__paid_at__extract_year , EXTRACT(quarter FROM bookings_source_src_28000.paid_at) AS booking__paid_at__extract_quarter , EXTRACT(month FROM bookings_source_src_28000.paid_at) AS booking__paid_at__extract_month @@ -314,22 +314,22 @@ FROM ( 1 AS listings , listings_latest_src_28000.capacity AS largest_listing , listings_latest_src_28000.capacity AS smallest_listing - , DATE_TRUNC(listings_latest_src_28000.created_at, day) AS ds__day - , DATE_TRUNC(listings_latest_src_28000.created_at, isoweek) AS ds__week - , DATE_TRUNC(listings_latest_src_28000.created_at, month) AS ds__month - , DATE_TRUNC(listings_latest_src_28000.created_at, quarter) AS ds__quarter - , DATE_TRUNC(listings_latest_src_28000.created_at, year) AS ds__year + , DATETIME_TRUNC(listings_latest_src_28000.created_at, day) AS ds__day + , DATETIME_TRUNC(listings_latest_src_28000.created_at, isoweek) AS ds__week + , DATETIME_TRUNC(listings_latest_src_28000.created_at, month) AS ds__month + , DATETIME_TRUNC(listings_latest_src_28000.created_at, quarter) AS ds__quarter + , DATETIME_TRUNC(listings_latest_src_28000.created_at, year) AS ds__year , EXTRACT(year FROM listings_latest_src_28000.created_at) AS ds__extract_year , EXTRACT(quarter FROM listings_latest_src_28000.created_at) AS ds__extract_quarter , EXTRACT(month FROM listings_latest_src_28000.created_at) AS ds__extract_month , EXTRACT(day FROM listings_latest_src_28000.created_at) AS ds__extract_day , IF(EXTRACT(dayofweek FROM listings_latest_src_28000.created_at) = 1, 7, EXTRACT(dayofweek FROM listings_latest_src_28000.created_at) - 1) AS ds__extract_dow , EXTRACT(dayofyear FROM listings_latest_src_28000.created_at) AS ds__extract_doy - , DATE_TRUNC(listings_latest_src_28000.created_at, day) AS created_at__day - , DATE_TRUNC(listings_latest_src_28000.created_at, isoweek) AS created_at__week - , DATE_TRUNC(listings_latest_src_28000.created_at, month) AS created_at__month - , DATE_TRUNC(listings_latest_src_28000.created_at, quarter) AS created_at__quarter - , DATE_TRUNC(listings_latest_src_28000.created_at, year) AS created_at__year + , DATETIME_TRUNC(listings_latest_src_28000.created_at, day) AS created_at__day + , DATETIME_TRUNC(listings_latest_src_28000.created_at, isoweek) AS created_at__week + , DATETIME_TRUNC(listings_latest_src_28000.created_at, month) AS created_at__month + , DATETIME_TRUNC(listings_latest_src_28000.created_at, quarter) AS created_at__quarter + , DATETIME_TRUNC(listings_latest_src_28000.created_at, year) AS created_at__year , EXTRACT(year FROM listings_latest_src_28000.created_at) AS created_at__extract_year , EXTRACT(quarter FROM listings_latest_src_28000.created_at) AS created_at__extract_quarter , EXTRACT(month FROM listings_latest_src_28000.created_at) AS created_at__extract_month @@ -339,22 +339,22 @@ FROM ( , listings_latest_src_28000.country AS country_latest , listings_latest_src_28000.is_lux AS is_lux_latest , listings_latest_src_28000.capacity AS capacity_latest - , DATE_TRUNC(listings_latest_src_28000.created_at, day) AS listing__ds__day - , DATE_TRUNC(listings_latest_src_28000.created_at, isoweek) AS listing__ds__week - , DATE_TRUNC(listings_latest_src_28000.created_at, month) AS listing__ds__month - , DATE_TRUNC(listings_latest_src_28000.created_at, quarter) AS listing__ds__quarter - , DATE_TRUNC(listings_latest_src_28000.created_at, year) AS listing__ds__year + , DATETIME_TRUNC(listings_latest_src_28000.created_at, day) AS listing__ds__day + , DATETIME_TRUNC(listings_latest_src_28000.created_at, isoweek) AS listing__ds__week + , DATETIME_TRUNC(listings_latest_src_28000.created_at, month) AS listing__ds__month + , DATETIME_TRUNC(listings_latest_src_28000.created_at, quarter) AS listing__ds__quarter + , DATETIME_TRUNC(listings_latest_src_28000.created_at, year) AS listing__ds__year , EXTRACT(year FROM listings_latest_src_28000.created_at) AS listing__ds__extract_year , EXTRACT(quarter FROM listings_latest_src_28000.created_at) AS listing__ds__extract_quarter , EXTRACT(month FROM listings_latest_src_28000.created_at) AS listing__ds__extract_month , EXTRACT(day FROM listings_latest_src_28000.created_at) AS listing__ds__extract_day , IF(EXTRACT(dayofweek FROM listings_latest_src_28000.created_at) = 1, 7, EXTRACT(dayofweek FROM listings_latest_src_28000.created_at) - 1) AS listing__ds__extract_dow , EXTRACT(dayofyear FROM listings_latest_src_28000.created_at) AS listing__ds__extract_doy - , DATE_TRUNC(listings_latest_src_28000.created_at, day) AS listing__created_at__day - , DATE_TRUNC(listings_latest_src_28000.created_at, isoweek) AS listing__created_at__week - , DATE_TRUNC(listings_latest_src_28000.created_at, month) AS listing__created_at__month - , DATE_TRUNC(listings_latest_src_28000.created_at, quarter) AS listing__created_at__quarter - , DATE_TRUNC(listings_latest_src_28000.created_at, year) AS listing__created_at__year + , DATETIME_TRUNC(listings_latest_src_28000.created_at, day) AS listing__created_at__day + , DATETIME_TRUNC(listings_latest_src_28000.created_at, isoweek) AS listing__created_at__week + , DATETIME_TRUNC(listings_latest_src_28000.created_at, month) AS listing__created_at__month + , DATETIME_TRUNC(listings_latest_src_28000.created_at, quarter) AS listing__created_at__quarter + , DATETIME_TRUNC(listings_latest_src_28000.created_at, year) AS listing__created_at__year , EXTRACT(year FROM listings_latest_src_28000.created_at) AS listing__created_at__extract_year , EXTRACT(quarter FROM listings_latest_src_28000.created_at) AS listing__created_at__extract_quarter , EXTRACT(month FROM listings_latest_src_28000.created_at) AS listing__created_at__extract_month diff --git a/tests_metricflow/snapshots/test_query_rendering.py/SqlQueryPlan/BigQuery/test_join_to_scd_dimension__plan0.sql b/tests_metricflow/snapshots/test_query_rendering.py/SqlQueryPlan/BigQuery/test_join_to_scd_dimension__plan0.sql index 9ee56bdd1f..b2a9819846 100644 --- a/tests_metricflow/snapshots/test_query_rendering.py/SqlQueryPlan/BigQuery/test_join_to_scd_dimension__plan0.sql +++ b/tests_metricflow/snapshots/test_query_rendering.py/SqlQueryPlan/BigQuery/test_join_to_scd_dimension__plan0.sql @@ -144,33 +144,33 @@ FROM ( , bookings_source_src_26000.booking_value AS average_booking_value , bookings_source_src_26000.booking_value AS booking_payments , bookings_source_src_26000.is_instant - , DATE_TRUNC(bookings_source_src_26000.ds, day) AS ds__day - , DATE_TRUNC(bookings_source_src_26000.ds, isoweek) AS ds__week - , DATE_TRUNC(bookings_source_src_26000.ds, month) AS ds__month - , DATE_TRUNC(bookings_source_src_26000.ds, quarter) AS ds__quarter - , DATE_TRUNC(bookings_source_src_26000.ds, year) AS ds__year + , DATETIME_TRUNC(bookings_source_src_26000.ds, day) AS ds__day + , DATETIME_TRUNC(bookings_source_src_26000.ds, isoweek) AS ds__week + , DATETIME_TRUNC(bookings_source_src_26000.ds, month) AS ds__month + , DATETIME_TRUNC(bookings_source_src_26000.ds, quarter) AS ds__quarter + , DATETIME_TRUNC(bookings_source_src_26000.ds, year) AS ds__year , EXTRACT(year FROM bookings_source_src_26000.ds) AS ds__extract_year , EXTRACT(quarter FROM bookings_source_src_26000.ds) AS ds__extract_quarter , EXTRACT(month FROM bookings_source_src_26000.ds) AS ds__extract_month , EXTRACT(day FROM bookings_source_src_26000.ds) AS ds__extract_day , IF(EXTRACT(dayofweek FROM bookings_source_src_26000.ds) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_26000.ds) - 1) AS ds__extract_dow , EXTRACT(dayofyear FROM bookings_source_src_26000.ds) AS ds__extract_doy - , DATE_TRUNC(bookings_source_src_26000.ds_partitioned, day) AS ds_partitioned__day - , DATE_TRUNC(bookings_source_src_26000.ds_partitioned, isoweek) AS ds_partitioned__week - , DATE_TRUNC(bookings_source_src_26000.ds_partitioned, month) AS ds_partitioned__month - , DATE_TRUNC(bookings_source_src_26000.ds_partitioned, quarter) AS ds_partitioned__quarter - , DATE_TRUNC(bookings_source_src_26000.ds_partitioned, year) AS ds_partitioned__year + , DATETIME_TRUNC(bookings_source_src_26000.ds_partitioned, day) AS ds_partitioned__day + , DATETIME_TRUNC(bookings_source_src_26000.ds_partitioned, isoweek) AS ds_partitioned__week + , DATETIME_TRUNC(bookings_source_src_26000.ds_partitioned, month) AS ds_partitioned__month + , DATETIME_TRUNC(bookings_source_src_26000.ds_partitioned, quarter) AS ds_partitioned__quarter + , DATETIME_TRUNC(bookings_source_src_26000.ds_partitioned, year) AS ds_partitioned__year , EXTRACT(year FROM bookings_source_src_26000.ds_partitioned) AS ds_partitioned__extract_year , EXTRACT(quarter FROM bookings_source_src_26000.ds_partitioned) AS ds_partitioned__extract_quarter , EXTRACT(month FROM bookings_source_src_26000.ds_partitioned) AS ds_partitioned__extract_month , EXTRACT(day FROM bookings_source_src_26000.ds_partitioned) AS ds_partitioned__extract_day , IF(EXTRACT(dayofweek FROM bookings_source_src_26000.ds_partitioned) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_26000.ds_partitioned) - 1) AS ds_partitioned__extract_dow , EXTRACT(dayofyear FROM bookings_source_src_26000.ds_partitioned) AS ds_partitioned__extract_doy - , DATE_TRUNC(bookings_source_src_26000.paid_at, day) AS paid_at__day - , DATE_TRUNC(bookings_source_src_26000.paid_at, isoweek) AS paid_at__week - , DATE_TRUNC(bookings_source_src_26000.paid_at, month) AS paid_at__month - , DATE_TRUNC(bookings_source_src_26000.paid_at, quarter) AS paid_at__quarter - , DATE_TRUNC(bookings_source_src_26000.paid_at, year) AS paid_at__year + , DATETIME_TRUNC(bookings_source_src_26000.paid_at, day) AS paid_at__day + , DATETIME_TRUNC(bookings_source_src_26000.paid_at, isoweek) AS paid_at__week + , DATETIME_TRUNC(bookings_source_src_26000.paid_at, month) AS paid_at__month + , DATETIME_TRUNC(bookings_source_src_26000.paid_at, quarter) AS paid_at__quarter + , DATETIME_TRUNC(bookings_source_src_26000.paid_at, year) AS paid_at__year , EXTRACT(year FROM bookings_source_src_26000.paid_at) AS paid_at__extract_year , EXTRACT(quarter FROM bookings_source_src_26000.paid_at) AS paid_at__extract_quarter , EXTRACT(month FROM bookings_source_src_26000.paid_at) AS paid_at__extract_month @@ -178,33 +178,33 @@ FROM ( , IF(EXTRACT(dayofweek FROM bookings_source_src_26000.paid_at) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_26000.paid_at) - 1) AS paid_at__extract_dow , EXTRACT(dayofyear FROM bookings_source_src_26000.paid_at) AS paid_at__extract_doy , bookings_source_src_26000.is_instant AS booking__is_instant - , DATE_TRUNC(bookings_source_src_26000.ds, day) AS booking__ds__day - , DATE_TRUNC(bookings_source_src_26000.ds, isoweek) AS booking__ds__week - , DATE_TRUNC(bookings_source_src_26000.ds, month) AS booking__ds__month - , DATE_TRUNC(bookings_source_src_26000.ds, quarter) AS booking__ds__quarter - , DATE_TRUNC(bookings_source_src_26000.ds, year) AS booking__ds__year + , DATETIME_TRUNC(bookings_source_src_26000.ds, day) AS booking__ds__day + , DATETIME_TRUNC(bookings_source_src_26000.ds, isoweek) AS booking__ds__week + , DATETIME_TRUNC(bookings_source_src_26000.ds, month) AS booking__ds__month + , DATETIME_TRUNC(bookings_source_src_26000.ds, quarter) AS booking__ds__quarter + , DATETIME_TRUNC(bookings_source_src_26000.ds, year) AS booking__ds__year , EXTRACT(year FROM bookings_source_src_26000.ds) AS booking__ds__extract_year , EXTRACT(quarter FROM bookings_source_src_26000.ds) AS booking__ds__extract_quarter , EXTRACT(month FROM bookings_source_src_26000.ds) AS booking__ds__extract_month , EXTRACT(day FROM bookings_source_src_26000.ds) AS booking__ds__extract_day , IF(EXTRACT(dayofweek FROM bookings_source_src_26000.ds) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_26000.ds) - 1) AS booking__ds__extract_dow , EXTRACT(dayofyear FROM bookings_source_src_26000.ds) AS booking__ds__extract_doy - , DATE_TRUNC(bookings_source_src_26000.ds_partitioned, day) AS booking__ds_partitioned__day - , DATE_TRUNC(bookings_source_src_26000.ds_partitioned, isoweek) AS booking__ds_partitioned__week - , DATE_TRUNC(bookings_source_src_26000.ds_partitioned, month) AS booking__ds_partitioned__month - , DATE_TRUNC(bookings_source_src_26000.ds_partitioned, quarter) AS booking__ds_partitioned__quarter - , DATE_TRUNC(bookings_source_src_26000.ds_partitioned, year) AS booking__ds_partitioned__year + , DATETIME_TRUNC(bookings_source_src_26000.ds_partitioned, day) AS booking__ds_partitioned__day + , DATETIME_TRUNC(bookings_source_src_26000.ds_partitioned, isoweek) AS booking__ds_partitioned__week + , DATETIME_TRUNC(bookings_source_src_26000.ds_partitioned, month) AS booking__ds_partitioned__month + , DATETIME_TRUNC(bookings_source_src_26000.ds_partitioned, quarter) AS booking__ds_partitioned__quarter + , DATETIME_TRUNC(bookings_source_src_26000.ds_partitioned, year) AS booking__ds_partitioned__year , EXTRACT(year FROM bookings_source_src_26000.ds_partitioned) AS booking__ds_partitioned__extract_year , EXTRACT(quarter FROM bookings_source_src_26000.ds_partitioned) AS booking__ds_partitioned__extract_quarter , EXTRACT(month FROM bookings_source_src_26000.ds_partitioned) AS booking__ds_partitioned__extract_month , EXTRACT(day FROM bookings_source_src_26000.ds_partitioned) AS booking__ds_partitioned__extract_day , IF(EXTRACT(dayofweek FROM bookings_source_src_26000.ds_partitioned) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_26000.ds_partitioned) - 1) AS booking__ds_partitioned__extract_dow , EXTRACT(dayofyear FROM bookings_source_src_26000.ds_partitioned) AS booking__ds_partitioned__extract_doy - , DATE_TRUNC(bookings_source_src_26000.paid_at, day) AS booking__paid_at__day - , DATE_TRUNC(bookings_source_src_26000.paid_at, isoweek) AS booking__paid_at__week - , DATE_TRUNC(bookings_source_src_26000.paid_at, month) AS booking__paid_at__month - , DATE_TRUNC(bookings_source_src_26000.paid_at, quarter) AS booking__paid_at__quarter - , DATE_TRUNC(bookings_source_src_26000.paid_at, year) AS booking__paid_at__year + , DATETIME_TRUNC(bookings_source_src_26000.paid_at, day) AS booking__paid_at__day + , DATETIME_TRUNC(bookings_source_src_26000.paid_at, isoweek) AS booking__paid_at__week + , DATETIME_TRUNC(bookings_source_src_26000.paid_at, month) AS booking__paid_at__month + , DATETIME_TRUNC(bookings_source_src_26000.paid_at, quarter) AS booking__paid_at__quarter + , DATETIME_TRUNC(bookings_source_src_26000.paid_at, year) AS booking__paid_at__year , EXTRACT(year FROM bookings_source_src_26000.paid_at) AS booking__paid_at__extract_year , EXTRACT(quarter FROM bookings_source_src_26000.paid_at) AS booking__paid_at__extract_quarter , EXTRACT(month FROM bookings_source_src_26000.paid_at) AS booking__paid_at__extract_month @@ -234,10 +234,10 @@ FROM ( -- Read Elements From Semantic Model 'listings' SELECT listings_src_26000.active_from AS window_start__day - , DATE_TRUNC(listings_src_26000.active_from, isoweek) AS window_start__week - , DATE_TRUNC(listings_src_26000.active_from, month) AS window_start__month - , DATE_TRUNC(listings_src_26000.active_from, quarter) AS window_start__quarter - , DATE_TRUNC(listings_src_26000.active_from, year) AS window_start__year + , DATETIME_TRUNC(listings_src_26000.active_from, isoweek) AS window_start__week + , DATETIME_TRUNC(listings_src_26000.active_from, month) AS window_start__month + , DATETIME_TRUNC(listings_src_26000.active_from, quarter) AS window_start__quarter + , DATETIME_TRUNC(listings_src_26000.active_from, year) AS window_start__year , EXTRACT(year FROM listings_src_26000.active_from) AS window_start__extract_year , EXTRACT(quarter FROM listings_src_26000.active_from) AS window_start__extract_quarter , EXTRACT(month FROM listings_src_26000.active_from) AS window_start__extract_month @@ -245,10 +245,10 @@ FROM ( , IF(EXTRACT(dayofweek FROM listings_src_26000.active_from) = 1, 7, EXTRACT(dayofweek FROM listings_src_26000.active_from) - 1) AS window_start__extract_dow , EXTRACT(dayofyear FROM listings_src_26000.active_from) AS window_start__extract_doy , listings_src_26000.active_to AS window_end__day - , DATE_TRUNC(listings_src_26000.active_to, isoweek) AS window_end__week - , DATE_TRUNC(listings_src_26000.active_to, month) AS window_end__month - , DATE_TRUNC(listings_src_26000.active_to, quarter) AS window_end__quarter - , DATE_TRUNC(listings_src_26000.active_to, year) AS window_end__year + , DATETIME_TRUNC(listings_src_26000.active_to, isoweek) AS window_end__week + , DATETIME_TRUNC(listings_src_26000.active_to, month) AS window_end__month + , DATETIME_TRUNC(listings_src_26000.active_to, quarter) AS window_end__quarter + , DATETIME_TRUNC(listings_src_26000.active_to, year) AS window_end__year , EXTRACT(year FROM listings_src_26000.active_to) AS window_end__extract_year , EXTRACT(quarter FROM listings_src_26000.active_to) AS window_end__extract_quarter , EXTRACT(month FROM listings_src_26000.active_to) AS window_end__extract_month @@ -259,10 +259,10 @@ FROM ( , listings_src_26000.is_lux , listings_src_26000.capacity , listings_src_26000.active_from AS listing__window_start__day - , DATE_TRUNC(listings_src_26000.active_from, isoweek) AS listing__window_start__week - , DATE_TRUNC(listings_src_26000.active_from, month) AS listing__window_start__month - , DATE_TRUNC(listings_src_26000.active_from, quarter) AS listing__window_start__quarter - , DATE_TRUNC(listings_src_26000.active_from, year) AS listing__window_start__year + , DATETIME_TRUNC(listings_src_26000.active_from, isoweek) AS listing__window_start__week + , DATETIME_TRUNC(listings_src_26000.active_from, month) AS listing__window_start__month + , DATETIME_TRUNC(listings_src_26000.active_from, quarter) AS listing__window_start__quarter + , DATETIME_TRUNC(listings_src_26000.active_from, year) AS listing__window_start__year , EXTRACT(year FROM listings_src_26000.active_from) AS listing__window_start__extract_year , EXTRACT(quarter FROM listings_src_26000.active_from) AS listing__window_start__extract_quarter , EXTRACT(month FROM listings_src_26000.active_from) AS listing__window_start__extract_month @@ -270,10 +270,10 @@ FROM ( , IF(EXTRACT(dayofweek FROM listings_src_26000.active_from) = 1, 7, EXTRACT(dayofweek FROM listings_src_26000.active_from) - 1) AS listing__window_start__extract_dow , EXTRACT(dayofyear FROM listings_src_26000.active_from) AS listing__window_start__extract_doy , listings_src_26000.active_to AS listing__window_end__day - , DATE_TRUNC(listings_src_26000.active_to, isoweek) AS listing__window_end__week - , DATE_TRUNC(listings_src_26000.active_to, month) AS listing__window_end__month - , DATE_TRUNC(listings_src_26000.active_to, quarter) AS listing__window_end__quarter - , DATE_TRUNC(listings_src_26000.active_to, year) AS listing__window_end__year + , DATETIME_TRUNC(listings_src_26000.active_to, isoweek) AS listing__window_end__week + , DATETIME_TRUNC(listings_src_26000.active_to, month) AS listing__window_end__month + , DATETIME_TRUNC(listings_src_26000.active_to, quarter) AS listing__window_end__quarter + , DATETIME_TRUNC(listings_src_26000.active_to, year) AS listing__window_end__year , EXTRACT(year FROM listings_src_26000.active_to) AS listing__window_end__extract_year , EXTRACT(quarter FROM listings_src_26000.active_to) AS listing__window_end__extract_quarter , EXTRACT(month FROM listings_src_26000.active_to) AS listing__window_end__extract_month diff --git a/tests_metricflow/snapshots/test_query_rendering.py/SqlQueryPlan/BigQuery/test_join_to_scd_dimension__plan0_optimized.sql b/tests_metricflow/snapshots/test_query_rendering.py/SqlQueryPlan/BigQuery/test_join_to_scd_dimension__plan0_optimized.sql index b91247e493..6e165cd829 100644 --- a/tests_metricflow/snapshots/test_query_rendering.py/SqlQueryPlan/BigQuery/test_join_to_scd_dimension__plan0_optimized.sql +++ b/tests_metricflow/snapshots/test_query_rendering.py/SqlQueryPlan/BigQuery/test_join_to_scd_dimension__plan0_optimized.sql @@ -17,7 +17,7 @@ FROM ( -- Metric Time Dimension 'ds' -- Pass Only Elements: ['bookings', 'metric_time__day', 'listing'] SELECT - DATE_TRUNC(ds, day) AS metric_time__day + DATETIME_TRUNC(ds, day) AS metric_time__day , listing_id AS listing , 1 AS bookings FROM ***************************.fct_bookings bookings_source_src_26000 diff --git a/tests_metricflow/snapshots/test_query_rendering.py/SqlQueryPlan/BigQuery/test_limit_rows__plan0.sql b/tests_metricflow/snapshots/test_query_rendering.py/SqlQueryPlan/BigQuery/test_limit_rows__plan0.sql index 211e9a35c8..0695f376de 100644 --- a/tests_metricflow/snapshots/test_query_rendering.py/SqlQueryPlan/BigQuery/test_limit_rows__plan0.sql +++ b/tests_metricflow/snapshots/test_query_rendering.py/SqlQueryPlan/BigQuery/test_limit_rows__plan0.sql @@ -136,33 +136,33 @@ FROM ( , bookings_source_src_28000.booking_value AS approximate_continuous_booking_value_p99 , bookings_source_src_28000.booking_value AS approximate_discrete_booking_value_p99 , bookings_source_src_28000.is_instant - , DATE_TRUNC(bookings_source_src_28000.ds, day) AS ds__day - , DATE_TRUNC(bookings_source_src_28000.ds, isoweek) AS ds__week - , DATE_TRUNC(bookings_source_src_28000.ds, month) AS ds__month - , DATE_TRUNC(bookings_source_src_28000.ds, quarter) AS ds__quarter - , DATE_TRUNC(bookings_source_src_28000.ds, year) AS ds__year + , DATETIME_TRUNC(bookings_source_src_28000.ds, day) AS ds__day + , DATETIME_TRUNC(bookings_source_src_28000.ds, isoweek) AS ds__week + , DATETIME_TRUNC(bookings_source_src_28000.ds, month) AS ds__month + , DATETIME_TRUNC(bookings_source_src_28000.ds, quarter) AS ds__quarter + , DATETIME_TRUNC(bookings_source_src_28000.ds, year) AS ds__year , EXTRACT(year FROM bookings_source_src_28000.ds) AS ds__extract_year , EXTRACT(quarter FROM bookings_source_src_28000.ds) AS ds__extract_quarter , EXTRACT(month FROM bookings_source_src_28000.ds) AS ds__extract_month , EXTRACT(day FROM bookings_source_src_28000.ds) AS ds__extract_day , IF(EXTRACT(dayofweek FROM bookings_source_src_28000.ds) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_28000.ds) - 1) AS ds__extract_dow , EXTRACT(dayofyear FROM bookings_source_src_28000.ds) AS ds__extract_doy - , DATE_TRUNC(bookings_source_src_28000.ds_partitioned, day) AS ds_partitioned__day - , DATE_TRUNC(bookings_source_src_28000.ds_partitioned, isoweek) AS ds_partitioned__week - , DATE_TRUNC(bookings_source_src_28000.ds_partitioned, month) AS ds_partitioned__month - , DATE_TRUNC(bookings_source_src_28000.ds_partitioned, quarter) AS ds_partitioned__quarter - , DATE_TRUNC(bookings_source_src_28000.ds_partitioned, year) AS ds_partitioned__year + , DATETIME_TRUNC(bookings_source_src_28000.ds_partitioned, day) AS ds_partitioned__day + , DATETIME_TRUNC(bookings_source_src_28000.ds_partitioned, isoweek) AS ds_partitioned__week + , DATETIME_TRUNC(bookings_source_src_28000.ds_partitioned, month) AS ds_partitioned__month + , DATETIME_TRUNC(bookings_source_src_28000.ds_partitioned, quarter) AS ds_partitioned__quarter + , DATETIME_TRUNC(bookings_source_src_28000.ds_partitioned, year) AS ds_partitioned__year , EXTRACT(year FROM bookings_source_src_28000.ds_partitioned) AS ds_partitioned__extract_year , EXTRACT(quarter FROM bookings_source_src_28000.ds_partitioned) AS ds_partitioned__extract_quarter , EXTRACT(month FROM bookings_source_src_28000.ds_partitioned) AS ds_partitioned__extract_month , EXTRACT(day FROM bookings_source_src_28000.ds_partitioned) AS ds_partitioned__extract_day , IF(EXTRACT(dayofweek FROM bookings_source_src_28000.ds_partitioned) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_28000.ds_partitioned) - 1) AS ds_partitioned__extract_dow , EXTRACT(dayofyear FROM bookings_source_src_28000.ds_partitioned) AS ds_partitioned__extract_doy - , DATE_TRUNC(bookings_source_src_28000.paid_at, day) AS paid_at__day - , DATE_TRUNC(bookings_source_src_28000.paid_at, isoweek) AS paid_at__week - , DATE_TRUNC(bookings_source_src_28000.paid_at, month) AS paid_at__month - , DATE_TRUNC(bookings_source_src_28000.paid_at, quarter) AS paid_at__quarter - , DATE_TRUNC(bookings_source_src_28000.paid_at, year) AS paid_at__year + , DATETIME_TRUNC(bookings_source_src_28000.paid_at, day) AS paid_at__day + , DATETIME_TRUNC(bookings_source_src_28000.paid_at, isoweek) AS paid_at__week + , DATETIME_TRUNC(bookings_source_src_28000.paid_at, month) AS paid_at__month + , DATETIME_TRUNC(bookings_source_src_28000.paid_at, quarter) AS paid_at__quarter + , DATETIME_TRUNC(bookings_source_src_28000.paid_at, year) AS paid_at__year , EXTRACT(year FROM bookings_source_src_28000.paid_at) AS paid_at__extract_year , EXTRACT(quarter FROM bookings_source_src_28000.paid_at) AS paid_at__extract_quarter , EXTRACT(month FROM bookings_source_src_28000.paid_at) AS paid_at__extract_month @@ -170,33 +170,33 @@ FROM ( , IF(EXTRACT(dayofweek FROM bookings_source_src_28000.paid_at) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_28000.paid_at) - 1) AS paid_at__extract_dow , EXTRACT(dayofyear FROM bookings_source_src_28000.paid_at) AS paid_at__extract_doy , bookings_source_src_28000.is_instant AS booking__is_instant - , DATE_TRUNC(bookings_source_src_28000.ds, day) AS booking__ds__day - , DATE_TRUNC(bookings_source_src_28000.ds, isoweek) AS booking__ds__week - , DATE_TRUNC(bookings_source_src_28000.ds, month) AS booking__ds__month - , DATE_TRUNC(bookings_source_src_28000.ds, quarter) AS booking__ds__quarter - , DATE_TRUNC(bookings_source_src_28000.ds, year) AS booking__ds__year + , DATETIME_TRUNC(bookings_source_src_28000.ds, day) AS booking__ds__day + , DATETIME_TRUNC(bookings_source_src_28000.ds, isoweek) AS booking__ds__week + , DATETIME_TRUNC(bookings_source_src_28000.ds, month) AS booking__ds__month + , DATETIME_TRUNC(bookings_source_src_28000.ds, quarter) AS booking__ds__quarter + , DATETIME_TRUNC(bookings_source_src_28000.ds, year) AS booking__ds__year , EXTRACT(year FROM bookings_source_src_28000.ds) AS booking__ds__extract_year , EXTRACT(quarter FROM bookings_source_src_28000.ds) AS booking__ds__extract_quarter , EXTRACT(month FROM bookings_source_src_28000.ds) AS booking__ds__extract_month , EXTRACT(day FROM bookings_source_src_28000.ds) AS booking__ds__extract_day , IF(EXTRACT(dayofweek FROM bookings_source_src_28000.ds) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_28000.ds) - 1) AS booking__ds__extract_dow , EXTRACT(dayofyear FROM bookings_source_src_28000.ds) AS booking__ds__extract_doy - , DATE_TRUNC(bookings_source_src_28000.ds_partitioned, day) AS booking__ds_partitioned__day - , DATE_TRUNC(bookings_source_src_28000.ds_partitioned, isoweek) AS booking__ds_partitioned__week - , DATE_TRUNC(bookings_source_src_28000.ds_partitioned, month) AS booking__ds_partitioned__month - , DATE_TRUNC(bookings_source_src_28000.ds_partitioned, quarter) AS booking__ds_partitioned__quarter - , DATE_TRUNC(bookings_source_src_28000.ds_partitioned, year) AS booking__ds_partitioned__year + , DATETIME_TRUNC(bookings_source_src_28000.ds_partitioned, day) AS booking__ds_partitioned__day + , DATETIME_TRUNC(bookings_source_src_28000.ds_partitioned, isoweek) AS booking__ds_partitioned__week + , DATETIME_TRUNC(bookings_source_src_28000.ds_partitioned, month) AS booking__ds_partitioned__month + , DATETIME_TRUNC(bookings_source_src_28000.ds_partitioned, quarter) AS booking__ds_partitioned__quarter + , DATETIME_TRUNC(bookings_source_src_28000.ds_partitioned, year) AS booking__ds_partitioned__year , EXTRACT(year FROM bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__extract_year , EXTRACT(quarter FROM bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__extract_quarter , EXTRACT(month FROM bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__extract_month , EXTRACT(day FROM bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__extract_day , IF(EXTRACT(dayofweek FROM bookings_source_src_28000.ds_partitioned) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_28000.ds_partitioned) - 1) AS booking__ds_partitioned__extract_dow , EXTRACT(dayofyear FROM bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__extract_doy - , DATE_TRUNC(bookings_source_src_28000.paid_at, day) AS booking__paid_at__day - , DATE_TRUNC(bookings_source_src_28000.paid_at, isoweek) AS booking__paid_at__week - , DATE_TRUNC(bookings_source_src_28000.paid_at, month) AS booking__paid_at__month - , DATE_TRUNC(bookings_source_src_28000.paid_at, quarter) AS booking__paid_at__quarter - , DATE_TRUNC(bookings_source_src_28000.paid_at, year) AS booking__paid_at__year + , DATETIME_TRUNC(bookings_source_src_28000.paid_at, day) AS booking__paid_at__day + , DATETIME_TRUNC(bookings_source_src_28000.paid_at, isoweek) AS booking__paid_at__week + , DATETIME_TRUNC(bookings_source_src_28000.paid_at, month) AS booking__paid_at__month + , DATETIME_TRUNC(bookings_source_src_28000.paid_at, quarter) AS booking__paid_at__quarter + , DATETIME_TRUNC(bookings_source_src_28000.paid_at, year) AS booking__paid_at__year , EXTRACT(year FROM bookings_source_src_28000.paid_at) AS booking__paid_at__extract_year , EXTRACT(quarter FROM bookings_source_src_28000.paid_at) AS booking__paid_at__extract_quarter , EXTRACT(month FROM bookings_source_src_28000.paid_at) AS booking__paid_at__extract_month diff --git a/tests_metricflow/snapshots/test_query_rendering.py/SqlQueryPlan/BigQuery/test_limit_rows__plan0_optimized.sql b/tests_metricflow/snapshots/test_query_rendering.py/SqlQueryPlan/BigQuery/test_limit_rows__plan0_optimized.sql index 8a46b5e79c..c202cbf5d8 100644 --- a/tests_metricflow/snapshots/test_query_rendering.py/SqlQueryPlan/BigQuery/test_limit_rows__plan0_optimized.sql +++ b/tests_metricflow/snapshots/test_query_rendering.py/SqlQueryPlan/BigQuery/test_limit_rows__plan0_optimized.sql @@ -9,7 +9,7 @@ FROM ( -- Metric Time Dimension 'ds' -- Pass Only Elements: ['bookings', 'ds__day'] SELECT - DATE_TRUNC(ds, day) AS ds__day + DATETIME_TRUNC(ds, day) AS ds__day , 1 AS bookings FROM ***************************.fct_bookings bookings_source_src_28000 ) subq_7 diff --git a/tests_metricflow/snapshots/test_query_rendering.py/SqlQueryPlan/BigQuery/test_local_dimension_using_local_entity__plan0.sql b/tests_metricflow/snapshots/test_query_rendering.py/SqlQueryPlan/BigQuery/test_local_dimension_using_local_entity__plan0.sql index 33ffa37933..576ebf36a2 100644 --- a/tests_metricflow/snapshots/test_query_rendering.py/SqlQueryPlan/BigQuery/test_local_dimension_using_local_entity__plan0.sql +++ b/tests_metricflow/snapshots/test_query_rendering.py/SqlQueryPlan/BigQuery/test_local_dimension_using_local_entity__plan0.sql @@ -88,22 +88,22 @@ FROM ( 1 AS listings , listings_latest_src_28000.capacity AS largest_listing , listings_latest_src_28000.capacity AS smallest_listing - , DATE_TRUNC(listings_latest_src_28000.created_at, day) AS ds__day - , DATE_TRUNC(listings_latest_src_28000.created_at, isoweek) AS ds__week - , DATE_TRUNC(listings_latest_src_28000.created_at, month) AS ds__month - , DATE_TRUNC(listings_latest_src_28000.created_at, quarter) AS ds__quarter - , DATE_TRUNC(listings_latest_src_28000.created_at, year) AS ds__year + , DATETIME_TRUNC(listings_latest_src_28000.created_at, day) AS ds__day + , DATETIME_TRUNC(listings_latest_src_28000.created_at, isoweek) AS ds__week + , DATETIME_TRUNC(listings_latest_src_28000.created_at, month) AS ds__month + , DATETIME_TRUNC(listings_latest_src_28000.created_at, quarter) AS ds__quarter + , DATETIME_TRUNC(listings_latest_src_28000.created_at, year) AS ds__year , EXTRACT(year FROM listings_latest_src_28000.created_at) AS ds__extract_year , EXTRACT(quarter FROM listings_latest_src_28000.created_at) AS ds__extract_quarter , EXTRACT(month FROM listings_latest_src_28000.created_at) AS ds__extract_month , EXTRACT(day FROM listings_latest_src_28000.created_at) AS ds__extract_day , IF(EXTRACT(dayofweek FROM listings_latest_src_28000.created_at) = 1, 7, EXTRACT(dayofweek FROM listings_latest_src_28000.created_at) - 1) AS ds__extract_dow , EXTRACT(dayofyear FROM listings_latest_src_28000.created_at) AS ds__extract_doy - , DATE_TRUNC(listings_latest_src_28000.created_at, day) AS created_at__day - , DATE_TRUNC(listings_latest_src_28000.created_at, isoweek) AS created_at__week - , DATE_TRUNC(listings_latest_src_28000.created_at, month) AS created_at__month - , DATE_TRUNC(listings_latest_src_28000.created_at, quarter) AS created_at__quarter - , DATE_TRUNC(listings_latest_src_28000.created_at, year) AS created_at__year + , DATETIME_TRUNC(listings_latest_src_28000.created_at, day) AS created_at__day + , DATETIME_TRUNC(listings_latest_src_28000.created_at, isoweek) AS created_at__week + , DATETIME_TRUNC(listings_latest_src_28000.created_at, month) AS created_at__month + , DATETIME_TRUNC(listings_latest_src_28000.created_at, quarter) AS created_at__quarter + , DATETIME_TRUNC(listings_latest_src_28000.created_at, year) AS created_at__year , EXTRACT(year FROM listings_latest_src_28000.created_at) AS created_at__extract_year , EXTRACT(quarter FROM listings_latest_src_28000.created_at) AS created_at__extract_quarter , EXTRACT(month FROM listings_latest_src_28000.created_at) AS created_at__extract_month @@ -113,22 +113,22 @@ FROM ( , listings_latest_src_28000.country AS country_latest , listings_latest_src_28000.is_lux AS is_lux_latest , listings_latest_src_28000.capacity AS capacity_latest - , DATE_TRUNC(listings_latest_src_28000.created_at, day) AS listing__ds__day - , DATE_TRUNC(listings_latest_src_28000.created_at, isoweek) AS listing__ds__week - , DATE_TRUNC(listings_latest_src_28000.created_at, month) AS listing__ds__month - , DATE_TRUNC(listings_latest_src_28000.created_at, quarter) AS listing__ds__quarter - , DATE_TRUNC(listings_latest_src_28000.created_at, year) AS listing__ds__year + , DATETIME_TRUNC(listings_latest_src_28000.created_at, day) AS listing__ds__day + , DATETIME_TRUNC(listings_latest_src_28000.created_at, isoweek) AS listing__ds__week + , DATETIME_TRUNC(listings_latest_src_28000.created_at, month) AS listing__ds__month + , DATETIME_TRUNC(listings_latest_src_28000.created_at, quarter) AS listing__ds__quarter + , DATETIME_TRUNC(listings_latest_src_28000.created_at, year) AS listing__ds__year , EXTRACT(year FROM listings_latest_src_28000.created_at) AS listing__ds__extract_year , EXTRACT(quarter FROM listings_latest_src_28000.created_at) AS listing__ds__extract_quarter , EXTRACT(month FROM listings_latest_src_28000.created_at) AS listing__ds__extract_month , EXTRACT(day FROM listings_latest_src_28000.created_at) AS listing__ds__extract_day , IF(EXTRACT(dayofweek FROM listings_latest_src_28000.created_at) = 1, 7, EXTRACT(dayofweek FROM listings_latest_src_28000.created_at) - 1) AS listing__ds__extract_dow , EXTRACT(dayofyear FROM listings_latest_src_28000.created_at) AS listing__ds__extract_doy - , DATE_TRUNC(listings_latest_src_28000.created_at, day) AS listing__created_at__day - , DATE_TRUNC(listings_latest_src_28000.created_at, isoweek) AS listing__created_at__week - , DATE_TRUNC(listings_latest_src_28000.created_at, month) AS listing__created_at__month - , DATE_TRUNC(listings_latest_src_28000.created_at, quarter) AS listing__created_at__quarter - , DATE_TRUNC(listings_latest_src_28000.created_at, year) AS listing__created_at__year + , DATETIME_TRUNC(listings_latest_src_28000.created_at, day) AS listing__created_at__day + , DATETIME_TRUNC(listings_latest_src_28000.created_at, isoweek) AS listing__created_at__week + , DATETIME_TRUNC(listings_latest_src_28000.created_at, month) AS listing__created_at__month + , DATETIME_TRUNC(listings_latest_src_28000.created_at, quarter) AS listing__created_at__quarter + , DATETIME_TRUNC(listings_latest_src_28000.created_at, year) AS listing__created_at__year , EXTRACT(year FROM listings_latest_src_28000.created_at) AS listing__created_at__extract_year , EXTRACT(quarter FROM listings_latest_src_28000.created_at) AS listing__created_at__extract_quarter , EXTRACT(month FROM listings_latest_src_28000.created_at) AS listing__created_at__extract_month diff --git a/tests_metricflow/snapshots/test_query_rendering.py/SqlQueryPlan/BigQuery/test_measure_constraint__plan0.sql b/tests_metricflow/snapshots/test_query_rendering.py/SqlQueryPlan/BigQuery/test_measure_constraint__plan0.sql index bbe1d45b2e..027af7df06 100644 --- a/tests_metricflow/snapshots/test_query_rendering.py/SqlQueryPlan/BigQuery/test_measure_constraint__plan0.sql +++ b/tests_metricflow/snapshots/test_query_rendering.py/SqlQueryPlan/BigQuery/test_measure_constraint__plan0.sql @@ -168,33 +168,33 @@ FROM ( , bookings_source_src_28000.booking_value AS approximate_continuous_booking_value_p99 , bookings_source_src_28000.booking_value AS approximate_discrete_booking_value_p99 , bookings_source_src_28000.is_instant - , DATE_TRUNC(bookings_source_src_28000.ds, day) AS ds__day - , DATE_TRUNC(bookings_source_src_28000.ds, isoweek) AS ds__week - , DATE_TRUNC(bookings_source_src_28000.ds, month) AS ds__month - , DATE_TRUNC(bookings_source_src_28000.ds, quarter) AS ds__quarter - , DATE_TRUNC(bookings_source_src_28000.ds, year) AS ds__year + , DATETIME_TRUNC(bookings_source_src_28000.ds, day) AS ds__day + , DATETIME_TRUNC(bookings_source_src_28000.ds, isoweek) AS ds__week + , DATETIME_TRUNC(bookings_source_src_28000.ds, month) AS ds__month + , DATETIME_TRUNC(bookings_source_src_28000.ds, quarter) AS ds__quarter + , DATETIME_TRUNC(bookings_source_src_28000.ds, year) AS ds__year , EXTRACT(year FROM bookings_source_src_28000.ds) AS ds__extract_year , EXTRACT(quarter FROM bookings_source_src_28000.ds) AS ds__extract_quarter , EXTRACT(month FROM bookings_source_src_28000.ds) AS ds__extract_month , EXTRACT(day FROM bookings_source_src_28000.ds) AS ds__extract_day , IF(EXTRACT(dayofweek FROM bookings_source_src_28000.ds) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_28000.ds) - 1) AS ds__extract_dow , EXTRACT(dayofyear FROM bookings_source_src_28000.ds) AS ds__extract_doy - , DATE_TRUNC(bookings_source_src_28000.ds_partitioned, day) AS ds_partitioned__day - , DATE_TRUNC(bookings_source_src_28000.ds_partitioned, isoweek) AS ds_partitioned__week - , DATE_TRUNC(bookings_source_src_28000.ds_partitioned, month) AS ds_partitioned__month - , DATE_TRUNC(bookings_source_src_28000.ds_partitioned, quarter) AS ds_partitioned__quarter - , DATE_TRUNC(bookings_source_src_28000.ds_partitioned, year) AS ds_partitioned__year + , DATETIME_TRUNC(bookings_source_src_28000.ds_partitioned, day) AS ds_partitioned__day + , DATETIME_TRUNC(bookings_source_src_28000.ds_partitioned, isoweek) AS ds_partitioned__week + , DATETIME_TRUNC(bookings_source_src_28000.ds_partitioned, month) AS ds_partitioned__month + , DATETIME_TRUNC(bookings_source_src_28000.ds_partitioned, quarter) AS ds_partitioned__quarter + , DATETIME_TRUNC(bookings_source_src_28000.ds_partitioned, year) AS ds_partitioned__year , EXTRACT(year FROM bookings_source_src_28000.ds_partitioned) AS ds_partitioned__extract_year , EXTRACT(quarter FROM bookings_source_src_28000.ds_partitioned) AS ds_partitioned__extract_quarter , EXTRACT(month FROM bookings_source_src_28000.ds_partitioned) AS ds_partitioned__extract_month , EXTRACT(day FROM bookings_source_src_28000.ds_partitioned) AS ds_partitioned__extract_day , IF(EXTRACT(dayofweek FROM bookings_source_src_28000.ds_partitioned) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_28000.ds_partitioned) - 1) AS ds_partitioned__extract_dow , EXTRACT(dayofyear FROM bookings_source_src_28000.ds_partitioned) AS ds_partitioned__extract_doy - , DATE_TRUNC(bookings_source_src_28000.paid_at, day) AS paid_at__day - , DATE_TRUNC(bookings_source_src_28000.paid_at, isoweek) AS paid_at__week - , DATE_TRUNC(bookings_source_src_28000.paid_at, month) AS paid_at__month - , DATE_TRUNC(bookings_source_src_28000.paid_at, quarter) AS paid_at__quarter - , DATE_TRUNC(bookings_source_src_28000.paid_at, year) AS paid_at__year + , DATETIME_TRUNC(bookings_source_src_28000.paid_at, day) AS paid_at__day + , DATETIME_TRUNC(bookings_source_src_28000.paid_at, isoweek) AS paid_at__week + , DATETIME_TRUNC(bookings_source_src_28000.paid_at, month) AS paid_at__month + , DATETIME_TRUNC(bookings_source_src_28000.paid_at, quarter) AS paid_at__quarter + , DATETIME_TRUNC(bookings_source_src_28000.paid_at, year) AS paid_at__year , EXTRACT(year FROM bookings_source_src_28000.paid_at) AS paid_at__extract_year , EXTRACT(quarter FROM bookings_source_src_28000.paid_at) AS paid_at__extract_quarter , EXTRACT(month FROM bookings_source_src_28000.paid_at) AS paid_at__extract_month @@ -202,33 +202,33 @@ FROM ( , IF(EXTRACT(dayofweek FROM bookings_source_src_28000.paid_at) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_28000.paid_at) - 1) AS paid_at__extract_dow , EXTRACT(dayofyear FROM bookings_source_src_28000.paid_at) AS paid_at__extract_doy , bookings_source_src_28000.is_instant AS booking__is_instant - , DATE_TRUNC(bookings_source_src_28000.ds, day) AS booking__ds__day - , DATE_TRUNC(bookings_source_src_28000.ds, isoweek) AS booking__ds__week - , DATE_TRUNC(bookings_source_src_28000.ds, month) AS booking__ds__month - , DATE_TRUNC(bookings_source_src_28000.ds, quarter) AS booking__ds__quarter - , DATE_TRUNC(bookings_source_src_28000.ds, year) AS booking__ds__year + , DATETIME_TRUNC(bookings_source_src_28000.ds, day) AS booking__ds__day + , DATETIME_TRUNC(bookings_source_src_28000.ds, isoweek) AS booking__ds__week + , DATETIME_TRUNC(bookings_source_src_28000.ds, month) AS booking__ds__month + , DATETIME_TRUNC(bookings_source_src_28000.ds, quarter) AS booking__ds__quarter + , DATETIME_TRUNC(bookings_source_src_28000.ds, year) AS booking__ds__year , EXTRACT(year FROM bookings_source_src_28000.ds) AS booking__ds__extract_year , EXTRACT(quarter FROM bookings_source_src_28000.ds) AS booking__ds__extract_quarter , EXTRACT(month FROM bookings_source_src_28000.ds) AS booking__ds__extract_month , EXTRACT(day FROM bookings_source_src_28000.ds) AS booking__ds__extract_day , IF(EXTRACT(dayofweek FROM bookings_source_src_28000.ds) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_28000.ds) - 1) AS booking__ds__extract_dow , EXTRACT(dayofyear FROM bookings_source_src_28000.ds) AS booking__ds__extract_doy - , DATE_TRUNC(bookings_source_src_28000.ds_partitioned, day) AS booking__ds_partitioned__day - , DATE_TRUNC(bookings_source_src_28000.ds_partitioned, isoweek) AS booking__ds_partitioned__week - , DATE_TRUNC(bookings_source_src_28000.ds_partitioned, month) AS booking__ds_partitioned__month - , DATE_TRUNC(bookings_source_src_28000.ds_partitioned, quarter) AS booking__ds_partitioned__quarter - , DATE_TRUNC(bookings_source_src_28000.ds_partitioned, year) AS booking__ds_partitioned__year + , DATETIME_TRUNC(bookings_source_src_28000.ds_partitioned, day) AS booking__ds_partitioned__day + , DATETIME_TRUNC(bookings_source_src_28000.ds_partitioned, isoweek) AS booking__ds_partitioned__week + , DATETIME_TRUNC(bookings_source_src_28000.ds_partitioned, month) AS booking__ds_partitioned__month + , DATETIME_TRUNC(bookings_source_src_28000.ds_partitioned, quarter) AS booking__ds_partitioned__quarter + , DATETIME_TRUNC(bookings_source_src_28000.ds_partitioned, year) AS booking__ds_partitioned__year , EXTRACT(year FROM bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__extract_year , EXTRACT(quarter FROM bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__extract_quarter , EXTRACT(month FROM bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__extract_month , EXTRACT(day FROM bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__extract_day , IF(EXTRACT(dayofweek FROM bookings_source_src_28000.ds_partitioned) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_28000.ds_partitioned) - 1) AS booking__ds_partitioned__extract_dow , EXTRACT(dayofyear FROM bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__extract_doy - , DATE_TRUNC(bookings_source_src_28000.paid_at, day) AS booking__paid_at__day - , DATE_TRUNC(bookings_source_src_28000.paid_at, isoweek) AS booking__paid_at__week - , DATE_TRUNC(bookings_source_src_28000.paid_at, month) AS booking__paid_at__month - , DATE_TRUNC(bookings_source_src_28000.paid_at, quarter) AS booking__paid_at__quarter - , DATE_TRUNC(bookings_source_src_28000.paid_at, year) AS booking__paid_at__year + , DATETIME_TRUNC(bookings_source_src_28000.paid_at, day) AS booking__paid_at__day + , DATETIME_TRUNC(bookings_source_src_28000.paid_at, isoweek) AS booking__paid_at__week + , DATETIME_TRUNC(bookings_source_src_28000.paid_at, month) AS booking__paid_at__month + , DATETIME_TRUNC(bookings_source_src_28000.paid_at, quarter) AS booking__paid_at__quarter + , DATETIME_TRUNC(bookings_source_src_28000.paid_at, year) AS booking__paid_at__year , EXTRACT(year FROM bookings_source_src_28000.paid_at) AS booking__paid_at__extract_year , EXTRACT(quarter FROM bookings_source_src_28000.paid_at) AS booking__paid_at__extract_quarter , EXTRACT(month FROM bookings_source_src_28000.paid_at) AS booking__paid_at__extract_month @@ -326,22 +326,22 @@ FROM ( 1 AS listings , listings_latest_src_28000.capacity AS largest_listing , listings_latest_src_28000.capacity AS smallest_listing - , DATE_TRUNC(listings_latest_src_28000.created_at, day) AS ds__day - , DATE_TRUNC(listings_latest_src_28000.created_at, isoweek) AS ds__week - , DATE_TRUNC(listings_latest_src_28000.created_at, month) AS ds__month - , DATE_TRUNC(listings_latest_src_28000.created_at, quarter) AS ds__quarter - , DATE_TRUNC(listings_latest_src_28000.created_at, year) AS ds__year + , DATETIME_TRUNC(listings_latest_src_28000.created_at, day) AS ds__day + , DATETIME_TRUNC(listings_latest_src_28000.created_at, isoweek) AS ds__week + , DATETIME_TRUNC(listings_latest_src_28000.created_at, month) AS ds__month + , DATETIME_TRUNC(listings_latest_src_28000.created_at, quarter) AS ds__quarter + , DATETIME_TRUNC(listings_latest_src_28000.created_at, year) AS ds__year , EXTRACT(year FROM listings_latest_src_28000.created_at) AS ds__extract_year , EXTRACT(quarter FROM listings_latest_src_28000.created_at) AS ds__extract_quarter , EXTRACT(month FROM listings_latest_src_28000.created_at) AS ds__extract_month , EXTRACT(day FROM listings_latest_src_28000.created_at) AS ds__extract_day , IF(EXTRACT(dayofweek FROM listings_latest_src_28000.created_at) = 1, 7, EXTRACT(dayofweek FROM listings_latest_src_28000.created_at) - 1) AS ds__extract_dow , EXTRACT(dayofyear FROM listings_latest_src_28000.created_at) AS ds__extract_doy - , DATE_TRUNC(listings_latest_src_28000.created_at, day) AS created_at__day - , DATE_TRUNC(listings_latest_src_28000.created_at, isoweek) AS created_at__week - , DATE_TRUNC(listings_latest_src_28000.created_at, month) AS created_at__month - , DATE_TRUNC(listings_latest_src_28000.created_at, quarter) AS created_at__quarter - , DATE_TRUNC(listings_latest_src_28000.created_at, year) AS created_at__year + , DATETIME_TRUNC(listings_latest_src_28000.created_at, day) AS created_at__day + , DATETIME_TRUNC(listings_latest_src_28000.created_at, isoweek) AS created_at__week + , DATETIME_TRUNC(listings_latest_src_28000.created_at, month) AS created_at__month + , DATETIME_TRUNC(listings_latest_src_28000.created_at, quarter) AS created_at__quarter + , DATETIME_TRUNC(listings_latest_src_28000.created_at, year) AS created_at__year , EXTRACT(year FROM listings_latest_src_28000.created_at) AS created_at__extract_year , EXTRACT(quarter FROM listings_latest_src_28000.created_at) AS created_at__extract_quarter , EXTRACT(month FROM listings_latest_src_28000.created_at) AS created_at__extract_month @@ -351,22 +351,22 @@ FROM ( , listings_latest_src_28000.country AS country_latest , listings_latest_src_28000.is_lux AS is_lux_latest , listings_latest_src_28000.capacity AS capacity_latest - , DATE_TRUNC(listings_latest_src_28000.created_at, day) AS listing__ds__day - , DATE_TRUNC(listings_latest_src_28000.created_at, isoweek) AS listing__ds__week - , DATE_TRUNC(listings_latest_src_28000.created_at, month) AS listing__ds__month - , DATE_TRUNC(listings_latest_src_28000.created_at, quarter) AS listing__ds__quarter - , DATE_TRUNC(listings_latest_src_28000.created_at, year) AS listing__ds__year + , DATETIME_TRUNC(listings_latest_src_28000.created_at, day) AS listing__ds__day + , DATETIME_TRUNC(listings_latest_src_28000.created_at, isoweek) AS listing__ds__week + , DATETIME_TRUNC(listings_latest_src_28000.created_at, month) AS listing__ds__month + , DATETIME_TRUNC(listings_latest_src_28000.created_at, quarter) AS listing__ds__quarter + , DATETIME_TRUNC(listings_latest_src_28000.created_at, year) AS listing__ds__year , EXTRACT(year FROM listings_latest_src_28000.created_at) AS listing__ds__extract_year , EXTRACT(quarter FROM listings_latest_src_28000.created_at) AS listing__ds__extract_quarter , EXTRACT(month FROM listings_latest_src_28000.created_at) AS listing__ds__extract_month , EXTRACT(day FROM listings_latest_src_28000.created_at) AS listing__ds__extract_day , IF(EXTRACT(dayofweek FROM listings_latest_src_28000.created_at) = 1, 7, EXTRACT(dayofweek FROM listings_latest_src_28000.created_at) - 1) AS listing__ds__extract_dow , EXTRACT(dayofyear FROM listings_latest_src_28000.created_at) AS listing__ds__extract_doy - , DATE_TRUNC(listings_latest_src_28000.created_at, day) AS listing__created_at__day - , DATE_TRUNC(listings_latest_src_28000.created_at, isoweek) AS listing__created_at__week - , DATE_TRUNC(listings_latest_src_28000.created_at, month) AS listing__created_at__month - , DATE_TRUNC(listings_latest_src_28000.created_at, quarter) AS listing__created_at__quarter - , DATE_TRUNC(listings_latest_src_28000.created_at, year) AS listing__created_at__year + , DATETIME_TRUNC(listings_latest_src_28000.created_at, day) AS listing__created_at__day + , DATETIME_TRUNC(listings_latest_src_28000.created_at, isoweek) AS listing__created_at__week + , DATETIME_TRUNC(listings_latest_src_28000.created_at, month) AS listing__created_at__month + , DATETIME_TRUNC(listings_latest_src_28000.created_at, quarter) AS listing__created_at__quarter + , DATETIME_TRUNC(listings_latest_src_28000.created_at, year) AS listing__created_at__year , EXTRACT(year FROM listings_latest_src_28000.created_at) AS listing__created_at__extract_year , EXTRACT(quarter FROM listings_latest_src_28000.created_at) AS listing__created_at__extract_quarter , EXTRACT(month FROM listings_latest_src_28000.created_at) AS listing__created_at__extract_month @@ -553,33 +553,33 @@ FROM ( , bookings_source_src_28000.booking_value AS approximate_continuous_booking_value_p99 , bookings_source_src_28000.booking_value AS approximate_discrete_booking_value_p99 , bookings_source_src_28000.is_instant - , DATE_TRUNC(bookings_source_src_28000.ds, day) AS ds__day - , DATE_TRUNC(bookings_source_src_28000.ds, isoweek) AS ds__week - , DATE_TRUNC(bookings_source_src_28000.ds, month) AS ds__month - , DATE_TRUNC(bookings_source_src_28000.ds, quarter) AS ds__quarter - , DATE_TRUNC(bookings_source_src_28000.ds, year) AS ds__year + , DATETIME_TRUNC(bookings_source_src_28000.ds, day) AS ds__day + , DATETIME_TRUNC(bookings_source_src_28000.ds, isoweek) AS ds__week + , DATETIME_TRUNC(bookings_source_src_28000.ds, month) AS ds__month + , DATETIME_TRUNC(bookings_source_src_28000.ds, quarter) AS ds__quarter + , DATETIME_TRUNC(bookings_source_src_28000.ds, year) AS ds__year , EXTRACT(year FROM bookings_source_src_28000.ds) AS ds__extract_year , EXTRACT(quarter FROM bookings_source_src_28000.ds) AS ds__extract_quarter , EXTRACT(month FROM bookings_source_src_28000.ds) AS ds__extract_month , EXTRACT(day FROM bookings_source_src_28000.ds) AS ds__extract_day , IF(EXTRACT(dayofweek FROM bookings_source_src_28000.ds) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_28000.ds) - 1) AS ds__extract_dow , EXTRACT(dayofyear FROM bookings_source_src_28000.ds) AS ds__extract_doy - , DATE_TRUNC(bookings_source_src_28000.ds_partitioned, day) AS ds_partitioned__day - , DATE_TRUNC(bookings_source_src_28000.ds_partitioned, isoweek) AS ds_partitioned__week - , DATE_TRUNC(bookings_source_src_28000.ds_partitioned, month) AS ds_partitioned__month - , DATE_TRUNC(bookings_source_src_28000.ds_partitioned, quarter) AS ds_partitioned__quarter - , DATE_TRUNC(bookings_source_src_28000.ds_partitioned, year) AS ds_partitioned__year + , DATETIME_TRUNC(bookings_source_src_28000.ds_partitioned, day) AS ds_partitioned__day + , DATETIME_TRUNC(bookings_source_src_28000.ds_partitioned, isoweek) AS ds_partitioned__week + , DATETIME_TRUNC(bookings_source_src_28000.ds_partitioned, month) AS ds_partitioned__month + , DATETIME_TRUNC(bookings_source_src_28000.ds_partitioned, quarter) AS ds_partitioned__quarter + , DATETIME_TRUNC(bookings_source_src_28000.ds_partitioned, year) AS ds_partitioned__year , EXTRACT(year FROM bookings_source_src_28000.ds_partitioned) AS ds_partitioned__extract_year , EXTRACT(quarter FROM bookings_source_src_28000.ds_partitioned) AS ds_partitioned__extract_quarter , EXTRACT(month FROM bookings_source_src_28000.ds_partitioned) AS ds_partitioned__extract_month , EXTRACT(day FROM bookings_source_src_28000.ds_partitioned) AS ds_partitioned__extract_day , IF(EXTRACT(dayofweek FROM bookings_source_src_28000.ds_partitioned) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_28000.ds_partitioned) - 1) AS ds_partitioned__extract_dow , EXTRACT(dayofyear FROM bookings_source_src_28000.ds_partitioned) AS ds_partitioned__extract_doy - , DATE_TRUNC(bookings_source_src_28000.paid_at, day) AS paid_at__day - , DATE_TRUNC(bookings_source_src_28000.paid_at, isoweek) AS paid_at__week - , DATE_TRUNC(bookings_source_src_28000.paid_at, month) AS paid_at__month - , DATE_TRUNC(bookings_source_src_28000.paid_at, quarter) AS paid_at__quarter - , DATE_TRUNC(bookings_source_src_28000.paid_at, year) AS paid_at__year + , DATETIME_TRUNC(bookings_source_src_28000.paid_at, day) AS paid_at__day + , DATETIME_TRUNC(bookings_source_src_28000.paid_at, isoweek) AS paid_at__week + , DATETIME_TRUNC(bookings_source_src_28000.paid_at, month) AS paid_at__month + , DATETIME_TRUNC(bookings_source_src_28000.paid_at, quarter) AS paid_at__quarter + , DATETIME_TRUNC(bookings_source_src_28000.paid_at, year) AS paid_at__year , EXTRACT(year FROM bookings_source_src_28000.paid_at) AS paid_at__extract_year , EXTRACT(quarter FROM bookings_source_src_28000.paid_at) AS paid_at__extract_quarter , EXTRACT(month FROM bookings_source_src_28000.paid_at) AS paid_at__extract_month @@ -587,33 +587,33 @@ FROM ( , IF(EXTRACT(dayofweek FROM bookings_source_src_28000.paid_at) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_28000.paid_at) - 1) AS paid_at__extract_dow , EXTRACT(dayofyear FROM bookings_source_src_28000.paid_at) AS paid_at__extract_doy , bookings_source_src_28000.is_instant AS booking__is_instant - , DATE_TRUNC(bookings_source_src_28000.ds, day) AS booking__ds__day - , DATE_TRUNC(bookings_source_src_28000.ds, isoweek) AS booking__ds__week - , DATE_TRUNC(bookings_source_src_28000.ds, month) AS booking__ds__month - , DATE_TRUNC(bookings_source_src_28000.ds, quarter) AS booking__ds__quarter - , DATE_TRUNC(bookings_source_src_28000.ds, year) AS booking__ds__year + , DATETIME_TRUNC(bookings_source_src_28000.ds, day) AS booking__ds__day + , DATETIME_TRUNC(bookings_source_src_28000.ds, isoweek) AS booking__ds__week + , DATETIME_TRUNC(bookings_source_src_28000.ds, month) AS booking__ds__month + , DATETIME_TRUNC(bookings_source_src_28000.ds, quarter) AS booking__ds__quarter + , DATETIME_TRUNC(bookings_source_src_28000.ds, year) AS booking__ds__year , EXTRACT(year FROM bookings_source_src_28000.ds) AS booking__ds__extract_year , EXTRACT(quarter FROM bookings_source_src_28000.ds) AS booking__ds__extract_quarter , EXTRACT(month FROM bookings_source_src_28000.ds) AS booking__ds__extract_month , EXTRACT(day FROM bookings_source_src_28000.ds) AS booking__ds__extract_day , IF(EXTRACT(dayofweek FROM bookings_source_src_28000.ds) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_28000.ds) - 1) AS booking__ds__extract_dow , EXTRACT(dayofyear FROM bookings_source_src_28000.ds) AS booking__ds__extract_doy - , DATE_TRUNC(bookings_source_src_28000.ds_partitioned, day) AS booking__ds_partitioned__day - , DATE_TRUNC(bookings_source_src_28000.ds_partitioned, isoweek) AS booking__ds_partitioned__week - , DATE_TRUNC(bookings_source_src_28000.ds_partitioned, month) AS booking__ds_partitioned__month - , DATE_TRUNC(bookings_source_src_28000.ds_partitioned, quarter) AS booking__ds_partitioned__quarter - , DATE_TRUNC(bookings_source_src_28000.ds_partitioned, year) AS booking__ds_partitioned__year + , DATETIME_TRUNC(bookings_source_src_28000.ds_partitioned, day) AS booking__ds_partitioned__day + , DATETIME_TRUNC(bookings_source_src_28000.ds_partitioned, isoweek) AS booking__ds_partitioned__week + , DATETIME_TRUNC(bookings_source_src_28000.ds_partitioned, month) AS booking__ds_partitioned__month + , DATETIME_TRUNC(bookings_source_src_28000.ds_partitioned, quarter) AS booking__ds_partitioned__quarter + , DATETIME_TRUNC(bookings_source_src_28000.ds_partitioned, year) AS booking__ds_partitioned__year , EXTRACT(year FROM bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__extract_year , EXTRACT(quarter FROM bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__extract_quarter , EXTRACT(month FROM bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__extract_month , EXTRACT(day FROM bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__extract_day , IF(EXTRACT(dayofweek FROM bookings_source_src_28000.ds_partitioned) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_28000.ds_partitioned) - 1) AS booking__ds_partitioned__extract_dow , EXTRACT(dayofyear FROM bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__extract_doy - , DATE_TRUNC(bookings_source_src_28000.paid_at, day) AS booking__paid_at__day - , DATE_TRUNC(bookings_source_src_28000.paid_at, isoweek) AS booking__paid_at__week - , DATE_TRUNC(bookings_source_src_28000.paid_at, month) AS booking__paid_at__month - , DATE_TRUNC(bookings_source_src_28000.paid_at, quarter) AS booking__paid_at__quarter - , DATE_TRUNC(bookings_source_src_28000.paid_at, year) AS booking__paid_at__year + , DATETIME_TRUNC(bookings_source_src_28000.paid_at, day) AS booking__paid_at__day + , DATETIME_TRUNC(bookings_source_src_28000.paid_at, isoweek) AS booking__paid_at__week + , DATETIME_TRUNC(bookings_source_src_28000.paid_at, month) AS booking__paid_at__month + , DATETIME_TRUNC(bookings_source_src_28000.paid_at, quarter) AS booking__paid_at__quarter + , DATETIME_TRUNC(bookings_source_src_28000.paid_at, year) AS booking__paid_at__year , EXTRACT(year FROM bookings_source_src_28000.paid_at) AS booking__paid_at__extract_year , EXTRACT(quarter FROM bookings_source_src_28000.paid_at) AS booking__paid_at__extract_quarter , EXTRACT(month FROM bookings_source_src_28000.paid_at) AS booking__paid_at__extract_month @@ -711,22 +711,22 @@ FROM ( 1 AS listings , listings_latest_src_28000.capacity AS largest_listing , listings_latest_src_28000.capacity AS smallest_listing - , DATE_TRUNC(listings_latest_src_28000.created_at, day) AS ds__day - , DATE_TRUNC(listings_latest_src_28000.created_at, isoweek) AS ds__week - , DATE_TRUNC(listings_latest_src_28000.created_at, month) AS ds__month - , DATE_TRUNC(listings_latest_src_28000.created_at, quarter) AS ds__quarter - , DATE_TRUNC(listings_latest_src_28000.created_at, year) AS ds__year + , DATETIME_TRUNC(listings_latest_src_28000.created_at, day) AS ds__day + , DATETIME_TRUNC(listings_latest_src_28000.created_at, isoweek) AS ds__week + , DATETIME_TRUNC(listings_latest_src_28000.created_at, month) AS ds__month + , DATETIME_TRUNC(listings_latest_src_28000.created_at, quarter) AS ds__quarter + , DATETIME_TRUNC(listings_latest_src_28000.created_at, year) AS ds__year , EXTRACT(year FROM listings_latest_src_28000.created_at) AS ds__extract_year , EXTRACT(quarter FROM listings_latest_src_28000.created_at) AS ds__extract_quarter , EXTRACT(month FROM listings_latest_src_28000.created_at) AS ds__extract_month , EXTRACT(day FROM listings_latest_src_28000.created_at) AS ds__extract_day , IF(EXTRACT(dayofweek FROM listings_latest_src_28000.created_at) = 1, 7, EXTRACT(dayofweek FROM listings_latest_src_28000.created_at) - 1) AS ds__extract_dow , EXTRACT(dayofyear FROM listings_latest_src_28000.created_at) AS ds__extract_doy - , DATE_TRUNC(listings_latest_src_28000.created_at, day) AS created_at__day - , DATE_TRUNC(listings_latest_src_28000.created_at, isoweek) AS created_at__week - , DATE_TRUNC(listings_latest_src_28000.created_at, month) AS created_at__month - , DATE_TRUNC(listings_latest_src_28000.created_at, quarter) AS created_at__quarter - , DATE_TRUNC(listings_latest_src_28000.created_at, year) AS created_at__year + , DATETIME_TRUNC(listings_latest_src_28000.created_at, day) AS created_at__day + , DATETIME_TRUNC(listings_latest_src_28000.created_at, isoweek) AS created_at__week + , DATETIME_TRUNC(listings_latest_src_28000.created_at, month) AS created_at__month + , DATETIME_TRUNC(listings_latest_src_28000.created_at, quarter) AS created_at__quarter + , DATETIME_TRUNC(listings_latest_src_28000.created_at, year) AS created_at__year , EXTRACT(year FROM listings_latest_src_28000.created_at) AS created_at__extract_year , EXTRACT(quarter FROM listings_latest_src_28000.created_at) AS created_at__extract_quarter , EXTRACT(month FROM listings_latest_src_28000.created_at) AS created_at__extract_month @@ -736,22 +736,22 @@ FROM ( , listings_latest_src_28000.country AS country_latest , listings_latest_src_28000.is_lux AS is_lux_latest , listings_latest_src_28000.capacity AS capacity_latest - , DATE_TRUNC(listings_latest_src_28000.created_at, day) AS listing__ds__day - , DATE_TRUNC(listings_latest_src_28000.created_at, isoweek) AS listing__ds__week - , DATE_TRUNC(listings_latest_src_28000.created_at, month) AS listing__ds__month - , DATE_TRUNC(listings_latest_src_28000.created_at, quarter) AS listing__ds__quarter - , DATE_TRUNC(listings_latest_src_28000.created_at, year) AS listing__ds__year + , DATETIME_TRUNC(listings_latest_src_28000.created_at, day) AS listing__ds__day + , DATETIME_TRUNC(listings_latest_src_28000.created_at, isoweek) AS listing__ds__week + , DATETIME_TRUNC(listings_latest_src_28000.created_at, month) AS listing__ds__month + , DATETIME_TRUNC(listings_latest_src_28000.created_at, quarter) AS listing__ds__quarter + , DATETIME_TRUNC(listings_latest_src_28000.created_at, year) AS listing__ds__year , EXTRACT(year FROM listings_latest_src_28000.created_at) AS listing__ds__extract_year , EXTRACT(quarter FROM listings_latest_src_28000.created_at) AS listing__ds__extract_quarter , EXTRACT(month FROM listings_latest_src_28000.created_at) AS listing__ds__extract_month , EXTRACT(day FROM listings_latest_src_28000.created_at) AS listing__ds__extract_day , IF(EXTRACT(dayofweek FROM listings_latest_src_28000.created_at) = 1, 7, EXTRACT(dayofweek FROM listings_latest_src_28000.created_at) - 1) AS listing__ds__extract_dow , EXTRACT(dayofyear FROM listings_latest_src_28000.created_at) AS listing__ds__extract_doy - , DATE_TRUNC(listings_latest_src_28000.created_at, day) AS listing__created_at__day - , DATE_TRUNC(listings_latest_src_28000.created_at, isoweek) AS listing__created_at__week - , DATE_TRUNC(listings_latest_src_28000.created_at, month) AS listing__created_at__month - , DATE_TRUNC(listings_latest_src_28000.created_at, quarter) AS listing__created_at__quarter - , DATE_TRUNC(listings_latest_src_28000.created_at, year) AS listing__created_at__year + , DATETIME_TRUNC(listings_latest_src_28000.created_at, day) AS listing__created_at__day + , DATETIME_TRUNC(listings_latest_src_28000.created_at, isoweek) AS listing__created_at__week + , DATETIME_TRUNC(listings_latest_src_28000.created_at, month) AS listing__created_at__month + , DATETIME_TRUNC(listings_latest_src_28000.created_at, quarter) AS listing__created_at__quarter + , DATETIME_TRUNC(listings_latest_src_28000.created_at, year) AS listing__created_at__year , EXTRACT(year FROM listings_latest_src_28000.created_at) AS listing__created_at__extract_year , EXTRACT(quarter FROM listings_latest_src_28000.created_at) AS listing__created_at__extract_quarter , EXTRACT(month FROM listings_latest_src_28000.created_at) AS listing__created_at__extract_month @@ -915,33 +915,33 @@ FROM ( , bookings_source_src_28000.booking_value AS approximate_continuous_booking_value_p99 , bookings_source_src_28000.booking_value AS approximate_discrete_booking_value_p99 , bookings_source_src_28000.is_instant - , DATE_TRUNC(bookings_source_src_28000.ds, day) AS ds__day - , DATE_TRUNC(bookings_source_src_28000.ds, isoweek) AS ds__week - , DATE_TRUNC(bookings_source_src_28000.ds, month) AS ds__month - , DATE_TRUNC(bookings_source_src_28000.ds, quarter) AS ds__quarter - , DATE_TRUNC(bookings_source_src_28000.ds, year) AS ds__year + , DATETIME_TRUNC(bookings_source_src_28000.ds, day) AS ds__day + , DATETIME_TRUNC(bookings_source_src_28000.ds, isoweek) AS ds__week + , DATETIME_TRUNC(bookings_source_src_28000.ds, month) AS ds__month + , DATETIME_TRUNC(bookings_source_src_28000.ds, quarter) AS ds__quarter + , DATETIME_TRUNC(bookings_source_src_28000.ds, year) AS ds__year , EXTRACT(year FROM bookings_source_src_28000.ds) AS ds__extract_year , EXTRACT(quarter FROM bookings_source_src_28000.ds) AS ds__extract_quarter , EXTRACT(month FROM bookings_source_src_28000.ds) AS ds__extract_month , EXTRACT(day FROM bookings_source_src_28000.ds) AS ds__extract_day , IF(EXTRACT(dayofweek FROM bookings_source_src_28000.ds) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_28000.ds) - 1) AS ds__extract_dow , EXTRACT(dayofyear FROM bookings_source_src_28000.ds) AS ds__extract_doy - , DATE_TRUNC(bookings_source_src_28000.ds_partitioned, day) AS ds_partitioned__day - , DATE_TRUNC(bookings_source_src_28000.ds_partitioned, isoweek) AS ds_partitioned__week - , DATE_TRUNC(bookings_source_src_28000.ds_partitioned, month) AS ds_partitioned__month - , DATE_TRUNC(bookings_source_src_28000.ds_partitioned, quarter) AS ds_partitioned__quarter - , DATE_TRUNC(bookings_source_src_28000.ds_partitioned, year) AS ds_partitioned__year + , DATETIME_TRUNC(bookings_source_src_28000.ds_partitioned, day) AS ds_partitioned__day + , DATETIME_TRUNC(bookings_source_src_28000.ds_partitioned, isoweek) AS ds_partitioned__week + , DATETIME_TRUNC(bookings_source_src_28000.ds_partitioned, month) AS ds_partitioned__month + , DATETIME_TRUNC(bookings_source_src_28000.ds_partitioned, quarter) AS ds_partitioned__quarter + , DATETIME_TRUNC(bookings_source_src_28000.ds_partitioned, year) AS ds_partitioned__year , EXTRACT(year FROM bookings_source_src_28000.ds_partitioned) AS ds_partitioned__extract_year , EXTRACT(quarter FROM bookings_source_src_28000.ds_partitioned) AS ds_partitioned__extract_quarter , EXTRACT(month FROM bookings_source_src_28000.ds_partitioned) AS ds_partitioned__extract_month , EXTRACT(day FROM bookings_source_src_28000.ds_partitioned) AS ds_partitioned__extract_day , IF(EXTRACT(dayofweek FROM bookings_source_src_28000.ds_partitioned) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_28000.ds_partitioned) - 1) AS ds_partitioned__extract_dow , EXTRACT(dayofyear FROM bookings_source_src_28000.ds_partitioned) AS ds_partitioned__extract_doy - , DATE_TRUNC(bookings_source_src_28000.paid_at, day) AS paid_at__day - , DATE_TRUNC(bookings_source_src_28000.paid_at, isoweek) AS paid_at__week - , DATE_TRUNC(bookings_source_src_28000.paid_at, month) AS paid_at__month - , DATE_TRUNC(bookings_source_src_28000.paid_at, quarter) AS paid_at__quarter - , DATE_TRUNC(bookings_source_src_28000.paid_at, year) AS paid_at__year + , DATETIME_TRUNC(bookings_source_src_28000.paid_at, day) AS paid_at__day + , DATETIME_TRUNC(bookings_source_src_28000.paid_at, isoweek) AS paid_at__week + , DATETIME_TRUNC(bookings_source_src_28000.paid_at, month) AS paid_at__month + , DATETIME_TRUNC(bookings_source_src_28000.paid_at, quarter) AS paid_at__quarter + , DATETIME_TRUNC(bookings_source_src_28000.paid_at, year) AS paid_at__year , EXTRACT(year FROM bookings_source_src_28000.paid_at) AS paid_at__extract_year , EXTRACT(quarter FROM bookings_source_src_28000.paid_at) AS paid_at__extract_quarter , EXTRACT(month FROM bookings_source_src_28000.paid_at) AS paid_at__extract_month @@ -949,33 +949,33 @@ FROM ( , IF(EXTRACT(dayofweek FROM bookings_source_src_28000.paid_at) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_28000.paid_at) - 1) AS paid_at__extract_dow , EXTRACT(dayofyear FROM bookings_source_src_28000.paid_at) AS paid_at__extract_doy , bookings_source_src_28000.is_instant AS booking__is_instant - , DATE_TRUNC(bookings_source_src_28000.ds, day) AS booking__ds__day - , DATE_TRUNC(bookings_source_src_28000.ds, isoweek) AS booking__ds__week - , DATE_TRUNC(bookings_source_src_28000.ds, month) AS booking__ds__month - , DATE_TRUNC(bookings_source_src_28000.ds, quarter) AS booking__ds__quarter - , DATE_TRUNC(bookings_source_src_28000.ds, year) AS booking__ds__year + , DATETIME_TRUNC(bookings_source_src_28000.ds, day) AS booking__ds__day + , DATETIME_TRUNC(bookings_source_src_28000.ds, isoweek) AS booking__ds__week + , DATETIME_TRUNC(bookings_source_src_28000.ds, month) AS booking__ds__month + , DATETIME_TRUNC(bookings_source_src_28000.ds, quarter) AS booking__ds__quarter + , DATETIME_TRUNC(bookings_source_src_28000.ds, year) AS booking__ds__year , EXTRACT(year FROM bookings_source_src_28000.ds) AS booking__ds__extract_year , EXTRACT(quarter FROM bookings_source_src_28000.ds) AS booking__ds__extract_quarter , EXTRACT(month FROM bookings_source_src_28000.ds) AS booking__ds__extract_month , EXTRACT(day FROM bookings_source_src_28000.ds) AS booking__ds__extract_day , IF(EXTRACT(dayofweek FROM bookings_source_src_28000.ds) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_28000.ds) - 1) AS booking__ds__extract_dow , EXTRACT(dayofyear FROM bookings_source_src_28000.ds) AS booking__ds__extract_doy - , DATE_TRUNC(bookings_source_src_28000.ds_partitioned, day) AS booking__ds_partitioned__day - , DATE_TRUNC(bookings_source_src_28000.ds_partitioned, isoweek) AS booking__ds_partitioned__week - , DATE_TRUNC(bookings_source_src_28000.ds_partitioned, month) AS booking__ds_partitioned__month - , DATE_TRUNC(bookings_source_src_28000.ds_partitioned, quarter) AS booking__ds_partitioned__quarter - , DATE_TRUNC(bookings_source_src_28000.ds_partitioned, year) AS booking__ds_partitioned__year + , DATETIME_TRUNC(bookings_source_src_28000.ds_partitioned, day) AS booking__ds_partitioned__day + , DATETIME_TRUNC(bookings_source_src_28000.ds_partitioned, isoweek) AS booking__ds_partitioned__week + , DATETIME_TRUNC(bookings_source_src_28000.ds_partitioned, month) AS booking__ds_partitioned__month + , DATETIME_TRUNC(bookings_source_src_28000.ds_partitioned, quarter) AS booking__ds_partitioned__quarter + , DATETIME_TRUNC(bookings_source_src_28000.ds_partitioned, year) AS booking__ds_partitioned__year , EXTRACT(year FROM bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__extract_year , EXTRACT(quarter FROM bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__extract_quarter , EXTRACT(month FROM bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__extract_month , EXTRACT(day FROM bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__extract_day , IF(EXTRACT(dayofweek FROM bookings_source_src_28000.ds_partitioned) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_28000.ds_partitioned) - 1) AS booking__ds_partitioned__extract_dow , EXTRACT(dayofyear FROM bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__extract_doy - , DATE_TRUNC(bookings_source_src_28000.paid_at, day) AS booking__paid_at__day - , DATE_TRUNC(bookings_source_src_28000.paid_at, isoweek) AS booking__paid_at__week - , DATE_TRUNC(bookings_source_src_28000.paid_at, month) AS booking__paid_at__month - , DATE_TRUNC(bookings_source_src_28000.paid_at, quarter) AS booking__paid_at__quarter - , DATE_TRUNC(bookings_source_src_28000.paid_at, year) AS booking__paid_at__year + , DATETIME_TRUNC(bookings_source_src_28000.paid_at, day) AS booking__paid_at__day + , DATETIME_TRUNC(bookings_source_src_28000.paid_at, isoweek) AS booking__paid_at__week + , DATETIME_TRUNC(bookings_source_src_28000.paid_at, month) AS booking__paid_at__month + , DATETIME_TRUNC(bookings_source_src_28000.paid_at, quarter) AS booking__paid_at__quarter + , DATETIME_TRUNC(bookings_source_src_28000.paid_at, year) AS booking__paid_at__year , EXTRACT(year FROM bookings_source_src_28000.paid_at) AS booking__paid_at__extract_year , EXTRACT(quarter FROM bookings_source_src_28000.paid_at) AS booking__paid_at__extract_quarter , EXTRACT(month FROM bookings_source_src_28000.paid_at) AS booking__paid_at__extract_month diff --git a/tests_metricflow/snapshots/test_query_rendering.py/SqlQueryPlan/BigQuery/test_measure_constraint__plan0_optimized.sql b/tests_metricflow/snapshots/test_query_rendering.py/SqlQueryPlan/BigQuery/test_measure_constraint__plan0_optimized.sql index aa1d748f6c..e205f2a72b 100644 --- a/tests_metricflow/snapshots/test_query_rendering.py/SqlQueryPlan/BigQuery/test_measure_constraint__plan0_optimized.sql +++ b/tests_metricflow/snapshots/test_query_rendering.py/SqlQueryPlan/BigQuery/test_measure_constraint__plan0_optimized.sql @@ -21,7 +21,7 @@ FROM ( -- Join Standard Outputs -- Pass Only Elements: ['average_booking_value', 'listing__is_lux_latest', 'metric_time__day'] SELECT - DATE_TRUNC(bookings_source_src_28000.ds, day) AS metric_time__day + DATETIME_TRUNC(bookings_source_src_28000.ds, day) AS metric_time__day , listings_latest_src_28000.is_lux AS listing__is_lux_latest , bookings_source_src_28000.booking_value AS average_booking_value FROM ***************************.fct_bookings bookings_source_src_28000 @@ -54,7 +54,7 @@ FROM ( -- Metric Time Dimension 'ds' -- Pass Only Elements: ['bookings', 'metric_time__day', 'listing'] SELECT - DATE_TRUNC(ds, day) AS metric_time__day + DATETIME_TRUNC(ds, day) AS metric_time__day , listing_id AS listing , 1 AS bookings FROM ***************************.fct_bookings bookings_source_src_28000 @@ -77,7 +77,7 @@ FROM ( -- Aggregate Measures -- Compute Metrics via Expressions SELECT - DATE_TRUNC(ds, day) AS metric_time__day + DATETIME_TRUNC(ds, day) AS metric_time__day , SUM(booking_value) AS booking_value FROM ***************************.fct_bookings bookings_source_src_28000 GROUP BY diff --git a/tests_metricflow/snapshots/test_query_rendering.py/SqlQueryPlan/BigQuery/test_measure_constraint_with_reused_measure__plan0.sql b/tests_metricflow/snapshots/test_query_rendering.py/SqlQueryPlan/BigQuery/test_measure_constraint_with_reused_measure__plan0.sql index 548a1b6a4b..813a04508b 100644 --- a/tests_metricflow/snapshots/test_query_rendering.py/SqlQueryPlan/BigQuery/test_measure_constraint_with_reused_measure__plan0.sql +++ b/tests_metricflow/snapshots/test_query_rendering.py/SqlQueryPlan/BigQuery/test_measure_constraint_with_reused_measure__plan0.sql @@ -154,33 +154,33 @@ FROM ( , bookings_source_src_28000.booking_value AS approximate_continuous_booking_value_p99 , bookings_source_src_28000.booking_value AS approximate_discrete_booking_value_p99 , bookings_source_src_28000.is_instant - , DATE_TRUNC(bookings_source_src_28000.ds, day) AS ds__day - , DATE_TRUNC(bookings_source_src_28000.ds, isoweek) AS ds__week - , DATE_TRUNC(bookings_source_src_28000.ds, month) AS ds__month - , DATE_TRUNC(bookings_source_src_28000.ds, quarter) AS ds__quarter - , DATE_TRUNC(bookings_source_src_28000.ds, year) AS ds__year + , DATETIME_TRUNC(bookings_source_src_28000.ds, day) AS ds__day + , DATETIME_TRUNC(bookings_source_src_28000.ds, isoweek) AS ds__week + , DATETIME_TRUNC(bookings_source_src_28000.ds, month) AS ds__month + , DATETIME_TRUNC(bookings_source_src_28000.ds, quarter) AS ds__quarter + , DATETIME_TRUNC(bookings_source_src_28000.ds, year) AS ds__year , EXTRACT(year FROM bookings_source_src_28000.ds) AS ds__extract_year , EXTRACT(quarter FROM bookings_source_src_28000.ds) AS ds__extract_quarter , EXTRACT(month FROM bookings_source_src_28000.ds) AS ds__extract_month , EXTRACT(day FROM bookings_source_src_28000.ds) AS ds__extract_day , IF(EXTRACT(dayofweek FROM bookings_source_src_28000.ds) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_28000.ds) - 1) AS ds__extract_dow , EXTRACT(dayofyear FROM bookings_source_src_28000.ds) AS ds__extract_doy - , DATE_TRUNC(bookings_source_src_28000.ds_partitioned, day) AS ds_partitioned__day - , DATE_TRUNC(bookings_source_src_28000.ds_partitioned, isoweek) AS ds_partitioned__week - , DATE_TRUNC(bookings_source_src_28000.ds_partitioned, month) AS ds_partitioned__month - , DATE_TRUNC(bookings_source_src_28000.ds_partitioned, quarter) AS ds_partitioned__quarter - , DATE_TRUNC(bookings_source_src_28000.ds_partitioned, year) AS ds_partitioned__year + , DATETIME_TRUNC(bookings_source_src_28000.ds_partitioned, day) AS ds_partitioned__day + , DATETIME_TRUNC(bookings_source_src_28000.ds_partitioned, isoweek) AS ds_partitioned__week + , DATETIME_TRUNC(bookings_source_src_28000.ds_partitioned, month) AS ds_partitioned__month + , DATETIME_TRUNC(bookings_source_src_28000.ds_partitioned, quarter) AS ds_partitioned__quarter + , DATETIME_TRUNC(bookings_source_src_28000.ds_partitioned, year) AS ds_partitioned__year , EXTRACT(year FROM bookings_source_src_28000.ds_partitioned) AS ds_partitioned__extract_year , EXTRACT(quarter FROM bookings_source_src_28000.ds_partitioned) AS ds_partitioned__extract_quarter , EXTRACT(month FROM bookings_source_src_28000.ds_partitioned) AS ds_partitioned__extract_month , EXTRACT(day FROM bookings_source_src_28000.ds_partitioned) AS ds_partitioned__extract_day , IF(EXTRACT(dayofweek FROM bookings_source_src_28000.ds_partitioned) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_28000.ds_partitioned) - 1) AS ds_partitioned__extract_dow , EXTRACT(dayofyear FROM bookings_source_src_28000.ds_partitioned) AS ds_partitioned__extract_doy - , DATE_TRUNC(bookings_source_src_28000.paid_at, day) AS paid_at__day - , DATE_TRUNC(bookings_source_src_28000.paid_at, isoweek) AS paid_at__week - , DATE_TRUNC(bookings_source_src_28000.paid_at, month) AS paid_at__month - , DATE_TRUNC(bookings_source_src_28000.paid_at, quarter) AS paid_at__quarter - , DATE_TRUNC(bookings_source_src_28000.paid_at, year) AS paid_at__year + , DATETIME_TRUNC(bookings_source_src_28000.paid_at, day) AS paid_at__day + , DATETIME_TRUNC(bookings_source_src_28000.paid_at, isoweek) AS paid_at__week + , DATETIME_TRUNC(bookings_source_src_28000.paid_at, month) AS paid_at__month + , DATETIME_TRUNC(bookings_source_src_28000.paid_at, quarter) AS paid_at__quarter + , DATETIME_TRUNC(bookings_source_src_28000.paid_at, year) AS paid_at__year , EXTRACT(year FROM bookings_source_src_28000.paid_at) AS paid_at__extract_year , EXTRACT(quarter FROM bookings_source_src_28000.paid_at) AS paid_at__extract_quarter , EXTRACT(month FROM bookings_source_src_28000.paid_at) AS paid_at__extract_month @@ -188,33 +188,33 @@ FROM ( , IF(EXTRACT(dayofweek FROM bookings_source_src_28000.paid_at) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_28000.paid_at) - 1) AS paid_at__extract_dow , EXTRACT(dayofyear FROM bookings_source_src_28000.paid_at) AS paid_at__extract_doy , bookings_source_src_28000.is_instant AS booking__is_instant - , DATE_TRUNC(bookings_source_src_28000.ds, day) AS booking__ds__day - , DATE_TRUNC(bookings_source_src_28000.ds, isoweek) AS booking__ds__week - , DATE_TRUNC(bookings_source_src_28000.ds, month) AS booking__ds__month - , DATE_TRUNC(bookings_source_src_28000.ds, quarter) AS booking__ds__quarter - , DATE_TRUNC(bookings_source_src_28000.ds, year) AS booking__ds__year + , DATETIME_TRUNC(bookings_source_src_28000.ds, day) AS booking__ds__day + , DATETIME_TRUNC(bookings_source_src_28000.ds, isoweek) AS booking__ds__week + , DATETIME_TRUNC(bookings_source_src_28000.ds, month) AS booking__ds__month + , DATETIME_TRUNC(bookings_source_src_28000.ds, quarter) AS booking__ds__quarter + , DATETIME_TRUNC(bookings_source_src_28000.ds, year) AS booking__ds__year , EXTRACT(year FROM bookings_source_src_28000.ds) AS booking__ds__extract_year , EXTRACT(quarter FROM bookings_source_src_28000.ds) AS booking__ds__extract_quarter , EXTRACT(month FROM bookings_source_src_28000.ds) AS booking__ds__extract_month , EXTRACT(day FROM bookings_source_src_28000.ds) AS booking__ds__extract_day , IF(EXTRACT(dayofweek FROM bookings_source_src_28000.ds) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_28000.ds) - 1) AS booking__ds__extract_dow , EXTRACT(dayofyear FROM bookings_source_src_28000.ds) AS booking__ds__extract_doy - , DATE_TRUNC(bookings_source_src_28000.ds_partitioned, day) AS booking__ds_partitioned__day - , DATE_TRUNC(bookings_source_src_28000.ds_partitioned, isoweek) AS booking__ds_partitioned__week - , DATE_TRUNC(bookings_source_src_28000.ds_partitioned, month) AS booking__ds_partitioned__month - , DATE_TRUNC(bookings_source_src_28000.ds_partitioned, quarter) AS booking__ds_partitioned__quarter - , DATE_TRUNC(bookings_source_src_28000.ds_partitioned, year) AS booking__ds_partitioned__year + , DATETIME_TRUNC(bookings_source_src_28000.ds_partitioned, day) AS booking__ds_partitioned__day + , DATETIME_TRUNC(bookings_source_src_28000.ds_partitioned, isoweek) AS booking__ds_partitioned__week + , DATETIME_TRUNC(bookings_source_src_28000.ds_partitioned, month) AS booking__ds_partitioned__month + , DATETIME_TRUNC(bookings_source_src_28000.ds_partitioned, quarter) AS booking__ds_partitioned__quarter + , DATETIME_TRUNC(bookings_source_src_28000.ds_partitioned, year) AS booking__ds_partitioned__year , EXTRACT(year FROM bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__extract_year , EXTRACT(quarter FROM bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__extract_quarter , EXTRACT(month FROM bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__extract_month , EXTRACT(day FROM bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__extract_day , IF(EXTRACT(dayofweek FROM bookings_source_src_28000.ds_partitioned) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_28000.ds_partitioned) - 1) AS booking__ds_partitioned__extract_dow , EXTRACT(dayofyear FROM bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__extract_doy - , DATE_TRUNC(bookings_source_src_28000.paid_at, day) AS booking__paid_at__day - , DATE_TRUNC(bookings_source_src_28000.paid_at, isoweek) AS booking__paid_at__week - , DATE_TRUNC(bookings_source_src_28000.paid_at, month) AS booking__paid_at__month - , DATE_TRUNC(bookings_source_src_28000.paid_at, quarter) AS booking__paid_at__quarter - , DATE_TRUNC(bookings_source_src_28000.paid_at, year) AS booking__paid_at__year + , DATETIME_TRUNC(bookings_source_src_28000.paid_at, day) AS booking__paid_at__day + , DATETIME_TRUNC(bookings_source_src_28000.paid_at, isoweek) AS booking__paid_at__week + , DATETIME_TRUNC(bookings_source_src_28000.paid_at, month) AS booking__paid_at__month + , DATETIME_TRUNC(bookings_source_src_28000.paid_at, quarter) AS booking__paid_at__quarter + , DATETIME_TRUNC(bookings_source_src_28000.paid_at, year) AS booking__paid_at__year , EXTRACT(year FROM bookings_source_src_28000.paid_at) AS booking__paid_at__extract_year , EXTRACT(quarter FROM bookings_source_src_28000.paid_at) AS booking__paid_at__extract_quarter , EXTRACT(month FROM bookings_source_src_28000.paid_at) AS booking__paid_at__extract_month @@ -372,33 +372,33 @@ FROM ( , bookings_source_src_28000.booking_value AS approximate_continuous_booking_value_p99 , bookings_source_src_28000.booking_value AS approximate_discrete_booking_value_p99 , bookings_source_src_28000.is_instant - , DATE_TRUNC(bookings_source_src_28000.ds, day) AS ds__day - , DATE_TRUNC(bookings_source_src_28000.ds, isoweek) AS ds__week - , DATE_TRUNC(bookings_source_src_28000.ds, month) AS ds__month - , DATE_TRUNC(bookings_source_src_28000.ds, quarter) AS ds__quarter - , DATE_TRUNC(bookings_source_src_28000.ds, year) AS ds__year + , DATETIME_TRUNC(bookings_source_src_28000.ds, day) AS ds__day + , DATETIME_TRUNC(bookings_source_src_28000.ds, isoweek) AS ds__week + , DATETIME_TRUNC(bookings_source_src_28000.ds, month) AS ds__month + , DATETIME_TRUNC(bookings_source_src_28000.ds, quarter) AS ds__quarter + , DATETIME_TRUNC(bookings_source_src_28000.ds, year) AS ds__year , EXTRACT(year FROM bookings_source_src_28000.ds) AS ds__extract_year , EXTRACT(quarter FROM bookings_source_src_28000.ds) AS ds__extract_quarter , EXTRACT(month FROM bookings_source_src_28000.ds) AS ds__extract_month , EXTRACT(day FROM bookings_source_src_28000.ds) AS ds__extract_day , IF(EXTRACT(dayofweek FROM bookings_source_src_28000.ds) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_28000.ds) - 1) AS ds__extract_dow , EXTRACT(dayofyear FROM bookings_source_src_28000.ds) AS ds__extract_doy - , DATE_TRUNC(bookings_source_src_28000.ds_partitioned, day) AS ds_partitioned__day - , DATE_TRUNC(bookings_source_src_28000.ds_partitioned, isoweek) AS ds_partitioned__week - , DATE_TRUNC(bookings_source_src_28000.ds_partitioned, month) AS ds_partitioned__month - , DATE_TRUNC(bookings_source_src_28000.ds_partitioned, quarter) AS ds_partitioned__quarter - , DATE_TRUNC(bookings_source_src_28000.ds_partitioned, year) AS ds_partitioned__year + , DATETIME_TRUNC(bookings_source_src_28000.ds_partitioned, day) AS ds_partitioned__day + , DATETIME_TRUNC(bookings_source_src_28000.ds_partitioned, isoweek) AS ds_partitioned__week + , DATETIME_TRUNC(bookings_source_src_28000.ds_partitioned, month) AS ds_partitioned__month + , DATETIME_TRUNC(bookings_source_src_28000.ds_partitioned, quarter) AS ds_partitioned__quarter + , DATETIME_TRUNC(bookings_source_src_28000.ds_partitioned, year) AS ds_partitioned__year , EXTRACT(year FROM bookings_source_src_28000.ds_partitioned) AS ds_partitioned__extract_year , EXTRACT(quarter FROM bookings_source_src_28000.ds_partitioned) AS ds_partitioned__extract_quarter , EXTRACT(month FROM bookings_source_src_28000.ds_partitioned) AS ds_partitioned__extract_month , EXTRACT(day FROM bookings_source_src_28000.ds_partitioned) AS ds_partitioned__extract_day , IF(EXTRACT(dayofweek FROM bookings_source_src_28000.ds_partitioned) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_28000.ds_partitioned) - 1) AS ds_partitioned__extract_dow , EXTRACT(dayofyear FROM bookings_source_src_28000.ds_partitioned) AS ds_partitioned__extract_doy - , DATE_TRUNC(bookings_source_src_28000.paid_at, day) AS paid_at__day - , DATE_TRUNC(bookings_source_src_28000.paid_at, isoweek) AS paid_at__week - , DATE_TRUNC(bookings_source_src_28000.paid_at, month) AS paid_at__month - , DATE_TRUNC(bookings_source_src_28000.paid_at, quarter) AS paid_at__quarter - , DATE_TRUNC(bookings_source_src_28000.paid_at, year) AS paid_at__year + , DATETIME_TRUNC(bookings_source_src_28000.paid_at, day) AS paid_at__day + , DATETIME_TRUNC(bookings_source_src_28000.paid_at, isoweek) AS paid_at__week + , DATETIME_TRUNC(bookings_source_src_28000.paid_at, month) AS paid_at__month + , DATETIME_TRUNC(bookings_source_src_28000.paid_at, quarter) AS paid_at__quarter + , DATETIME_TRUNC(bookings_source_src_28000.paid_at, year) AS paid_at__year , EXTRACT(year FROM bookings_source_src_28000.paid_at) AS paid_at__extract_year , EXTRACT(quarter FROM bookings_source_src_28000.paid_at) AS paid_at__extract_quarter , EXTRACT(month FROM bookings_source_src_28000.paid_at) AS paid_at__extract_month @@ -406,33 +406,33 @@ FROM ( , IF(EXTRACT(dayofweek FROM bookings_source_src_28000.paid_at) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_28000.paid_at) - 1) AS paid_at__extract_dow , EXTRACT(dayofyear FROM bookings_source_src_28000.paid_at) AS paid_at__extract_doy , bookings_source_src_28000.is_instant AS booking__is_instant - , DATE_TRUNC(bookings_source_src_28000.ds, day) AS booking__ds__day - , DATE_TRUNC(bookings_source_src_28000.ds, isoweek) AS booking__ds__week - , DATE_TRUNC(bookings_source_src_28000.ds, month) AS booking__ds__month - , DATE_TRUNC(bookings_source_src_28000.ds, quarter) AS booking__ds__quarter - , DATE_TRUNC(bookings_source_src_28000.ds, year) AS booking__ds__year + , DATETIME_TRUNC(bookings_source_src_28000.ds, day) AS booking__ds__day + , DATETIME_TRUNC(bookings_source_src_28000.ds, isoweek) AS booking__ds__week + , DATETIME_TRUNC(bookings_source_src_28000.ds, month) AS booking__ds__month + , DATETIME_TRUNC(bookings_source_src_28000.ds, quarter) AS booking__ds__quarter + , DATETIME_TRUNC(bookings_source_src_28000.ds, year) AS booking__ds__year , EXTRACT(year FROM bookings_source_src_28000.ds) AS booking__ds__extract_year , EXTRACT(quarter FROM bookings_source_src_28000.ds) AS booking__ds__extract_quarter , EXTRACT(month FROM bookings_source_src_28000.ds) AS booking__ds__extract_month , EXTRACT(day FROM bookings_source_src_28000.ds) AS booking__ds__extract_day , IF(EXTRACT(dayofweek FROM bookings_source_src_28000.ds) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_28000.ds) - 1) AS booking__ds__extract_dow , EXTRACT(dayofyear FROM bookings_source_src_28000.ds) AS booking__ds__extract_doy - , DATE_TRUNC(bookings_source_src_28000.ds_partitioned, day) AS booking__ds_partitioned__day - , DATE_TRUNC(bookings_source_src_28000.ds_partitioned, isoweek) AS booking__ds_partitioned__week - , DATE_TRUNC(bookings_source_src_28000.ds_partitioned, month) AS booking__ds_partitioned__month - , DATE_TRUNC(bookings_source_src_28000.ds_partitioned, quarter) AS booking__ds_partitioned__quarter - , DATE_TRUNC(bookings_source_src_28000.ds_partitioned, year) AS booking__ds_partitioned__year + , DATETIME_TRUNC(bookings_source_src_28000.ds_partitioned, day) AS booking__ds_partitioned__day + , DATETIME_TRUNC(bookings_source_src_28000.ds_partitioned, isoweek) AS booking__ds_partitioned__week + , DATETIME_TRUNC(bookings_source_src_28000.ds_partitioned, month) AS booking__ds_partitioned__month + , DATETIME_TRUNC(bookings_source_src_28000.ds_partitioned, quarter) AS booking__ds_partitioned__quarter + , DATETIME_TRUNC(bookings_source_src_28000.ds_partitioned, year) AS booking__ds_partitioned__year , EXTRACT(year FROM bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__extract_year , EXTRACT(quarter FROM bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__extract_quarter , EXTRACT(month FROM bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__extract_month , EXTRACT(day FROM bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__extract_day , IF(EXTRACT(dayofweek FROM bookings_source_src_28000.ds_partitioned) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_28000.ds_partitioned) - 1) AS booking__ds_partitioned__extract_dow , EXTRACT(dayofyear FROM bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__extract_doy - , DATE_TRUNC(bookings_source_src_28000.paid_at, day) AS booking__paid_at__day - , DATE_TRUNC(bookings_source_src_28000.paid_at, isoweek) AS booking__paid_at__week - , DATE_TRUNC(bookings_source_src_28000.paid_at, month) AS booking__paid_at__month - , DATE_TRUNC(bookings_source_src_28000.paid_at, quarter) AS booking__paid_at__quarter - , DATE_TRUNC(bookings_source_src_28000.paid_at, year) AS booking__paid_at__year + , DATETIME_TRUNC(bookings_source_src_28000.paid_at, day) AS booking__paid_at__day + , DATETIME_TRUNC(bookings_source_src_28000.paid_at, isoweek) AS booking__paid_at__week + , DATETIME_TRUNC(bookings_source_src_28000.paid_at, month) AS booking__paid_at__month + , DATETIME_TRUNC(bookings_source_src_28000.paid_at, quarter) AS booking__paid_at__quarter + , DATETIME_TRUNC(bookings_source_src_28000.paid_at, year) AS booking__paid_at__year , EXTRACT(year FROM bookings_source_src_28000.paid_at) AS booking__paid_at__extract_year , EXTRACT(quarter FROM bookings_source_src_28000.paid_at) AS booking__paid_at__extract_quarter , EXTRACT(month FROM bookings_source_src_28000.paid_at) AS booking__paid_at__extract_month diff --git a/tests_metricflow/snapshots/test_query_rendering.py/SqlQueryPlan/BigQuery/test_measure_constraint_with_reused_measure__plan0_optimized.sql b/tests_metricflow/snapshots/test_query_rendering.py/SqlQueryPlan/BigQuery/test_measure_constraint_with_reused_measure__plan0_optimized.sql index fd149da3a6..efac34f0c1 100644 --- a/tests_metricflow/snapshots/test_query_rendering.py/SqlQueryPlan/BigQuery/test_measure_constraint_with_reused_measure__plan0_optimized.sql +++ b/tests_metricflow/snapshots/test_query_rendering.py/SqlQueryPlan/BigQuery/test_measure_constraint_with_reused_measure__plan0_optimized.sql @@ -21,7 +21,7 @@ FROM ( -- Metric Time Dimension 'ds' -- Pass Only Elements: ['booking_value', 'booking__is_instant', 'metric_time__day'] SELECT - DATE_TRUNC(ds, day) AS metric_time__day + DATETIME_TRUNC(ds, day) AS metric_time__day , is_instant AS booking__is_instant , booking_value FROM ***************************.fct_bookings bookings_source_src_28000 @@ -37,7 +37,7 @@ FROM ( -- Aggregate Measures -- Compute Metrics via Expressions SELECT - DATE_TRUNC(ds, day) AS metric_time__day + DATETIME_TRUNC(ds, day) AS metric_time__day , SUM(booking_value) AS booking_value FROM ***************************.fct_bookings bookings_source_src_28000 GROUP BY diff --git a/tests_metricflow/snapshots/test_query_rendering.py/SqlQueryPlan/BigQuery/test_measure_constraint_with_single_expr_and_alias__plan0.sql b/tests_metricflow/snapshots/test_query_rendering.py/SqlQueryPlan/BigQuery/test_measure_constraint_with_single_expr_and_alias__plan0.sql index ad8431c956..39ccdf1d7f 100644 --- a/tests_metricflow/snapshots/test_query_rendering.py/SqlQueryPlan/BigQuery/test_measure_constraint_with_single_expr_and_alias__plan0.sql +++ b/tests_metricflow/snapshots/test_query_rendering.py/SqlQueryPlan/BigQuery/test_measure_constraint_with_single_expr_and_alias__plan0.sql @@ -148,33 +148,33 @@ FROM ( , bookings_source_src_28000.booking_value AS approximate_continuous_booking_value_p99 , bookings_source_src_28000.booking_value AS approximate_discrete_booking_value_p99 , bookings_source_src_28000.is_instant - , DATE_TRUNC(bookings_source_src_28000.ds, day) AS ds__day - , DATE_TRUNC(bookings_source_src_28000.ds, isoweek) AS ds__week - , DATE_TRUNC(bookings_source_src_28000.ds, month) AS ds__month - , DATE_TRUNC(bookings_source_src_28000.ds, quarter) AS ds__quarter - , DATE_TRUNC(bookings_source_src_28000.ds, year) AS ds__year + , DATETIME_TRUNC(bookings_source_src_28000.ds, day) AS ds__day + , DATETIME_TRUNC(bookings_source_src_28000.ds, isoweek) AS ds__week + , DATETIME_TRUNC(bookings_source_src_28000.ds, month) AS ds__month + , DATETIME_TRUNC(bookings_source_src_28000.ds, quarter) AS ds__quarter + , DATETIME_TRUNC(bookings_source_src_28000.ds, year) AS ds__year , EXTRACT(year FROM bookings_source_src_28000.ds) AS ds__extract_year , EXTRACT(quarter FROM bookings_source_src_28000.ds) AS ds__extract_quarter , EXTRACT(month FROM bookings_source_src_28000.ds) AS ds__extract_month , EXTRACT(day FROM bookings_source_src_28000.ds) AS ds__extract_day , IF(EXTRACT(dayofweek FROM bookings_source_src_28000.ds) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_28000.ds) - 1) AS ds__extract_dow , EXTRACT(dayofyear FROM bookings_source_src_28000.ds) AS ds__extract_doy - , DATE_TRUNC(bookings_source_src_28000.ds_partitioned, day) AS ds_partitioned__day - , DATE_TRUNC(bookings_source_src_28000.ds_partitioned, isoweek) AS ds_partitioned__week - , DATE_TRUNC(bookings_source_src_28000.ds_partitioned, month) AS ds_partitioned__month - , DATE_TRUNC(bookings_source_src_28000.ds_partitioned, quarter) AS ds_partitioned__quarter - , DATE_TRUNC(bookings_source_src_28000.ds_partitioned, year) AS ds_partitioned__year + , DATETIME_TRUNC(bookings_source_src_28000.ds_partitioned, day) AS ds_partitioned__day + , DATETIME_TRUNC(bookings_source_src_28000.ds_partitioned, isoweek) AS ds_partitioned__week + , DATETIME_TRUNC(bookings_source_src_28000.ds_partitioned, month) AS ds_partitioned__month + , DATETIME_TRUNC(bookings_source_src_28000.ds_partitioned, quarter) AS ds_partitioned__quarter + , DATETIME_TRUNC(bookings_source_src_28000.ds_partitioned, year) AS ds_partitioned__year , EXTRACT(year FROM bookings_source_src_28000.ds_partitioned) AS ds_partitioned__extract_year , EXTRACT(quarter FROM bookings_source_src_28000.ds_partitioned) AS ds_partitioned__extract_quarter , EXTRACT(month FROM bookings_source_src_28000.ds_partitioned) AS ds_partitioned__extract_month , EXTRACT(day FROM bookings_source_src_28000.ds_partitioned) AS ds_partitioned__extract_day , IF(EXTRACT(dayofweek FROM bookings_source_src_28000.ds_partitioned) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_28000.ds_partitioned) - 1) AS ds_partitioned__extract_dow , EXTRACT(dayofyear FROM bookings_source_src_28000.ds_partitioned) AS ds_partitioned__extract_doy - , DATE_TRUNC(bookings_source_src_28000.paid_at, day) AS paid_at__day - , DATE_TRUNC(bookings_source_src_28000.paid_at, isoweek) AS paid_at__week - , DATE_TRUNC(bookings_source_src_28000.paid_at, month) AS paid_at__month - , DATE_TRUNC(bookings_source_src_28000.paid_at, quarter) AS paid_at__quarter - , DATE_TRUNC(bookings_source_src_28000.paid_at, year) AS paid_at__year + , DATETIME_TRUNC(bookings_source_src_28000.paid_at, day) AS paid_at__day + , DATETIME_TRUNC(bookings_source_src_28000.paid_at, isoweek) AS paid_at__week + , DATETIME_TRUNC(bookings_source_src_28000.paid_at, month) AS paid_at__month + , DATETIME_TRUNC(bookings_source_src_28000.paid_at, quarter) AS paid_at__quarter + , DATETIME_TRUNC(bookings_source_src_28000.paid_at, year) AS paid_at__year , EXTRACT(year FROM bookings_source_src_28000.paid_at) AS paid_at__extract_year , EXTRACT(quarter FROM bookings_source_src_28000.paid_at) AS paid_at__extract_quarter , EXTRACT(month FROM bookings_source_src_28000.paid_at) AS paid_at__extract_month @@ -182,33 +182,33 @@ FROM ( , IF(EXTRACT(dayofweek FROM bookings_source_src_28000.paid_at) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_28000.paid_at) - 1) AS paid_at__extract_dow , EXTRACT(dayofyear FROM bookings_source_src_28000.paid_at) AS paid_at__extract_doy , bookings_source_src_28000.is_instant AS booking__is_instant - , DATE_TRUNC(bookings_source_src_28000.ds, day) AS booking__ds__day - , DATE_TRUNC(bookings_source_src_28000.ds, isoweek) AS booking__ds__week - , DATE_TRUNC(bookings_source_src_28000.ds, month) AS booking__ds__month - , DATE_TRUNC(bookings_source_src_28000.ds, quarter) AS booking__ds__quarter - , DATE_TRUNC(bookings_source_src_28000.ds, year) AS booking__ds__year + , DATETIME_TRUNC(bookings_source_src_28000.ds, day) AS booking__ds__day + , DATETIME_TRUNC(bookings_source_src_28000.ds, isoweek) AS booking__ds__week + , DATETIME_TRUNC(bookings_source_src_28000.ds, month) AS booking__ds__month + , DATETIME_TRUNC(bookings_source_src_28000.ds, quarter) AS booking__ds__quarter + , DATETIME_TRUNC(bookings_source_src_28000.ds, year) AS booking__ds__year , EXTRACT(year FROM bookings_source_src_28000.ds) AS booking__ds__extract_year , EXTRACT(quarter FROM bookings_source_src_28000.ds) AS booking__ds__extract_quarter , EXTRACT(month FROM bookings_source_src_28000.ds) AS booking__ds__extract_month , EXTRACT(day FROM bookings_source_src_28000.ds) AS booking__ds__extract_day , IF(EXTRACT(dayofweek FROM bookings_source_src_28000.ds) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_28000.ds) - 1) AS booking__ds__extract_dow , EXTRACT(dayofyear FROM bookings_source_src_28000.ds) AS booking__ds__extract_doy - , DATE_TRUNC(bookings_source_src_28000.ds_partitioned, day) AS booking__ds_partitioned__day - , DATE_TRUNC(bookings_source_src_28000.ds_partitioned, isoweek) AS booking__ds_partitioned__week - , DATE_TRUNC(bookings_source_src_28000.ds_partitioned, month) AS booking__ds_partitioned__month - , DATE_TRUNC(bookings_source_src_28000.ds_partitioned, quarter) AS booking__ds_partitioned__quarter - , DATE_TRUNC(bookings_source_src_28000.ds_partitioned, year) AS booking__ds_partitioned__year + , DATETIME_TRUNC(bookings_source_src_28000.ds_partitioned, day) AS booking__ds_partitioned__day + , DATETIME_TRUNC(bookings_source_src_28000.ds_partitioned, isoweek) AS booking__ds_partitioned__week + , DATETIME_TRUNC(bookings_source_src_28000.ds_partitioned, month) AS booking__ds_partitioned__month + , DATETIME_TRUNC(bookings_source_src_28000.ds_partitioned, quarter) AS booking__ds_partitioned__quarter + , DATETIME_TRUNC(bookings_source_src_28000.ds_partitioned, year) AS booking__ds_partitioned__year , EXTRACT(year FROM bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__extract_year , EXTRACT(quarter FROM bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__extract_quarter , EXTRACT(month FROM bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__extract_month , EXTRACT(day FROM bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__extract_day , IF(EXTRACT(dayofweek FROM bookings_source_src_28000.ds_partitioned) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_28000.ds_partitioned) - 1) AS booking__ds_partitioned__extract_dow , EXTRACT(dayofyear FROM bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__extract_doy - , DATE_TRUNC(bookings_source_src_28000.paid_at, day) AS booking__paid_at__day - , DATE_TRUNC(bookings_source_src_28000.paid_at, isoweek) AS booking__paid_at__week - , DATE_TRUNC(bookings_source_src_28000.paid_at, month) AS booking__paid_at__month - , DATE_TRUNC(bookings_source_src_28000.paid_at, quarter) AS booking__paid_at__quarter - , DATE_TRUNC(bookings_source_src_28000.paid_at, year) AS booking__paid_at__year + , DATETIME_TRUNC(bookings_source_src_28000.paid_at, day) AS booking__paid_at__day + , DATETIME_TRUNC(bookings_source_src_28000.paid_at, isoweek) AS booking__paid_at__week + , DATETIME_TRUNC(bookings_source_src_28000.paid_at, month) AS booking__paid_at__month + , DATETIME_TRUNC(bookings_source_src_28000.paid_at, quarter) AS booking__paid_at__quarter + , DATETIME_TRUNC(bookings_source_src_28000.paid_at, year) AS booking__paid_at__year , EXTRACT(year FROM bookings_source_src_28000.paid_at) AS booking__paid_at__extract_year , EXTRACT(quarter FROM bookings_source_src_28000.paid_at) AS booking__paid_at__extract_quarter , EXTRACT(month FROM bookings_source_src_28000.paid_at) AS booking__paid_at__extract_month diff --git a/tests_metricflow/snapshots/test_query_rendering.py/SqlQueryPlan/BigQuery/test_measure_constraint_with_single_expr_and_alias__plan0_optimized.sql b/tests_metricflow/snapshots/test_query_rendering.py/SqlQueryPlan/BigQuery/test_measure_constraint_with_single_expr_and_alias__plan0_optimized.sql index c4d1b2bf47..13fca71a38 100644 --- a/tests_metricflow/snapshots/test_query_rendering.py/SqlQueryPlan/BigQuery/test_measure_constraint_with_single_expr_and_alias__plan0_optimized.sql +++ b/tests_metricflow/snapshots/test_query_rendering.py/SqlQueryPlan/BigQuery/test_measure_constraint_with_single_expr_and_alias__plan0_optimized.sql @@ -15,7 +15,7 @@ FROM ( -- Metric Time Dimension 'ds' -- Pass Only Elements: ['bookings', 'booking__is_instant', 'metric_time__day'] SELECT - DATE_TRUNC(ds, day) AS metric_time__day + DATETIME_TRUNC(ds, day) AS metric_time__day , is_instant AS booking__is_instant , 1 AS bookings FROM ***************************.fct_bookings bookings_source_src_28000 diff --git a/tests_metricflow/snapshots/test_query_rendering.py/SqlQueryPlan/BigQuery/test_metric_with_measures_from_multiple_sources_no_dimensions__plan0.sql b/tests_metricflow/snapshots/test_query_rendering.py/SqlQueryPlan/BigQuery/test_metric_with_measures_from_multiple_sources_no_dimensions__plan0.sql index f221b6181d..04b9d1b85a 100644 --- a/tests_metricflow/snapshots/test_query_rendering.py/SqlQueryPlan/BigQuery/test_metric_with_measures_from_multiple_sources_no_dimensions__plan0.sql +++ b/tests_metricflow/snapshots/test_query_rendering.py/SqlQueryPlan/BigQuery/test_metric_with_measures_from_multiple_sources_no_dimensions__plan0.sql @@ -137,33 +137,33 @@ FROM ( , bookings_source_src_28000.booking_value AS approximate_continuous_booking_value_p99 , bookings_source_src_28000.booking_value AS approximate_discrete_booking_value_p99 , bookings_source_src_28000.is_instant - , DATE_TRUNC(bookings_source_src_28000.ds, day) AS ds__day - , DATE_TRUNC(bookings_source_src_28000.ds, isoweek) AS ds__week - , DATE_TRUNC(bookings_source_src_28000.ds, month) AS ds__month - , DATE_TRUNC(bookings_source_src_28000.ds, quarter) AS ds__quarter - , DATE_TRUNC(bookings_source_src_28000.ds, year) AS ds__year + , DATETIME_TRUNC(bookings_source_src_28000.ds, day) AS ds__day + , DATETIME_TRUNC(bookings_source_src_28000.ds, isoweek) AS ds__week + , DATETIME_TRUNC(bookings_source_src_28000.ds, month) AS ds__month + , DATETIME_TRUNC(bookings_source_src_28000.ds, quarter) AS ds__quarter + , DATETIME_TRUNC(bookings_source_src_28000.ds, year) AS ds__year , EXTRACT(year FROM bookings_source_src_28000.ds) AS ds__extract_year , EXTRACT(quarter FROM bookings_source_src_28000.ds) AS ds__extract_quarter , EXTRACT(month FROM bookings_source_src_28000.ds) AS ds__extract_month , EXTRACT(day FROM bookings_source_src_28000.ds) AS ds__extract_day , IF(EXTRACT(dayofweek FROM bookings_source_src_28000.ds) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_28000.ds) - 1) AS ds__extract_dow , EXTRACT(dayofyear FROM bookings_source_src_28000.ds) AS ds__extract_doy - , DATE_TRUNC(bookings_source_src_28000.ds_partitioned, day) AS ds_partitioned__day - , DATE_TRUNC(bookings_source_src_28000.ds_partitioned, isoweek) AS ds_partitioned__week - , DATE_TRUNC(bookings_source_src_28000.ds_partitioned, month) AS ds_partitioned__month - , DATE_TRUNC(bookings_source_src_28000.ds_partitioned, quarter) AS ds_partitioned__quarter - , DATE_TRUNC(bookings_source_src_28000.ds_partitioned, year) AS ds_partitioned__year + , DATETIME_TRUNC(bookings_source_src_28000.ds_partitioned, day) AS ds_partitioned__day + , DATETIME_TRUNC(bookings_source_src_28000.ds_partitioned, isoweek) AS ds_partitioned__week + , DATETIME_TRUNC(bookings_source_src_28000.ds_partitioned, month) AS ds_partitioned__month + , DATETIME_TRUNC(bookings_source_src_28000.ds_partitioned, quarter) AS ds_partitioned__quarter + , DATETIME_TRUNC(bookings_source_src_28000.ds_partitioned, year) AS ds_partitioned__year , EXTRACT(year FROM bookings_source_src_28000.ds_partitioned) AS ds_partitioned__extract_year , EXTRACT(quarter FROM bookings_source_src_28000.ds_partitioned) AS ds_partitioned__extract_quarter , EXTRACT(month FROM bookings_source_src_28000.ds_partitioned) AS ds_partitioned__extract_month , EXTRACT(day FROM bookings_source_src_28000.ds_partitioned) AS ds_partitioned__extract_day , IF(EXTRACT(dayofweek FROM bookings_source_src_28000.ds_partitioned) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_28000.ds_partitioned) - 1) AS ds_partitioned__extract_dow , EXTRACT(dayofyear FROM bookings_source_src_28000.ds_partitioned) AS ds_partitioned__extract_doy - , DATE_TRUNC(bookings_source_src_28000.paid_at, day) AS paid_at__day - , DATE_TRUNC(bookings_source_src_28000.paid_at, isoweek) AS paid_at__week - , DATE_TRUNC(bookings_source_src_28000.paid_at, month) AS paid_at__month - , DATE_TRUNC(bookings_source_src_28000.paid_at, quarter) AS paid_at__quarter - , DATE_TRUNC(bookings_source_src_28000.paid_at, year) AS paid_at__year + , DATETIME_TRUNC(bookings_source_src_28000.paid_at, day) AS paid_at__day + , DATETIME_TRUNC(bookings_source_src_28000.paid_at, isoweek) AS paid_at__week + , DATETIME_TRUNC(bookings_source_src_28000.paid_at, month) AS paid_at__month + , DATETIME_TRUNC(bookings_source_src_28000.paid_at, quarter) AS paid_at__quarter + , DATETIME_TRUNC(bookings_source_src_28000.paid_at, year) AS paid_at__year , EXTRACT(year FROM bookings_source_src_28000.paid_at) AS paid_at__extract_year , EXTRACT(quarter FROM bookings_source_src_28000.paid_at) AS paid_at__extract_quarter , EXTRACT(month FROM bookings_source_src_28000.paid_at) AS paid_at__extract_month @@ -171,33 +171,33 @@ FROM ( , IF(EXTRACT(dayofweek FROM bookings_source_src_28000.paid_at) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_28000.paid_at) - 1) AS paid_at__extract_dow , EXTRACT(dayofyear FROM bookings_source_src_28000.paid_at) AS paid_at__extract_doy , bookings_source_src_28000.is_instant AS booking__is_instant - , DATE_TRUNC(bookings_source_src_28000.ds, day) AS booking__ds__day - , DATE_TRUNC(bookings_source_src_28000.ds, isoweek) AS booking__ds__week - , DATE_TRUNC(bookings_source_src_28000.ds, month) AS booking__ds__month - , DATE_TRUNC(bookings_source_src_28000.ds, quarter) AS booking__ds__quarter - , DATE_TRUNC(bookings_source_src_28000.ds, year) AS booking__ds__year + , DATETIME_TRUNC(bookings_source_src_28000.ds, day) AS booking__ds__day + , DATETIME_TRUNC(bookings_source_src_28000.ds, isoweek) AS booking__ds__week + , DATETIME_TRUNC(bookings_source_src_28000.ds, month) AS booking__ds__month + , DATETIME_TRUNC(bookings_source_src_28000.ds, quarter) AS booking__ds__quarter + , DATETIME_TRUNC(bookings_source_src_28000.ds, year) AS booking__ds__year , EXTRACT(year FROM bookings_source_src_28000.ds) AS booking__ds__extract_year , EXTRACT(quarter FROM bookings_source_src_28000.ds) AS booking__ds__extract_quarter , EXTRACT(month FROM bookings_source_src_28000.ds) AS booking__ds__extract_month , EXTRACT(day FROM bookings_source_src_28000.ds) AS booking__ds__extract_day , IF(EXTRACT(dayofweek FROM bookings_source_src_28000.ds) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_28000.ds) - 1) AS booking__ds__extract_dow , EXTRACT(dayofyear FROM bookings_source_src_28000.ds) AS booking__ds__extract_doy - , DATE_TRUNC(bookings_source_src_28000.ds_partitioned, day) AS booking__ds_partitioned__day - , DATE_TRUNC(bookings_source_src_28000.ds_partitioned, isoweek) AS booking__ds_partitioned__week - , DATE_TRUNC(bookings_source_src_28000.ds_partitioned, month) AS booking__ds_partitioned__month - , DATE_TRUNC(bookings_source_src_28000.ds_partitioned, quarter) AS booking__ds_partitioned__quarter - , DATE_TRUNC(bookings_source_src_28000.ds_partitioned, year) AS booking__ds_partitioned__year + , DATETIME_TRUNC(bookings_source_src_28000.ds_partitioned, day) AS booking__ds_partitioned__day + , DATETIME_TRUNC(bookings_source_src_28000.ds_partitioned, isoweek) AS booking__ds_partitioned__week + , DATETIME_TRUNC(bookings_source_src_28000.ds_partitioned, month) AS booking__ds_partitioned__month + , DATETIME_TRUNC(bookings_source_src_28000.ds_partitioned, quarter) AS booking__ds_partitioned__quarter + , DATETIME_TRUNC(bookings_source_src_28000.ds_partitioned, year) AS booking__ds_partitioned__year , EXTRACT(year FROM bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__extract_year , EXTRACT(quarter FROM bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__extract_quarter , EXTRACT(month FROM bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__extract_month , EXTRACT(day FROM bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__extract_day , IF(EXTRACT(dayofweek FROM bookings_source_src_28000.ds_partitioned) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_28000.ds_partitioned) - 1) AS booking__ds_partitioned__extract_dow , EXTRACT(dayofyear FROM bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__extract_doy - , DATE_TRUNC(bookings_source_src_28000.paid_at, day) AS booking__paid_at__day - , DATE_TRUNC(bookings_source_src_28000.paid_at, isoweek) AS booking__paid_at__week - , DATE_TRUNC(bookings_source_src_28000.paid_at, month) AS booking__paid_at__month - , DATE_TRUNC(bookings_source_src_28000.paid_at, quarter) AS booking__paid_at__quarter - , DATE_TRUNC(bookings_source_src_28000.paid_at, year) AS booking__paid_at__year + , DATETIME_TRUNC(bookings_source_src_28000.paid_at, day) AS booking__paid_at__day + , DATETIME_TRUNC(bookings_source_src_28000.paid_at, isoweek) AS booking__paid_at__week + , DATETIME_TRUNC(bookings_source_src_28000.paid_at, month) AS booking__paid_at__month + , DATETIME_TRUNC(bookings_source_src_28000.paid_at, quarter) AS booking__paid_at__quarter + , DATETIME_TRUNC(bookings_source_src_28000.paid_at, year) AS booking__paid_at__year , EXTRACT(year FROM bookings_source_src_28000.paid_at) AS booking__paid_at__extract_year , EXTRACT(quarter FROM bookings_source_src_28000.paid_at) AS booking__paid_at__extract_quarter , EXTRACT(month FROM bookings_source_src_28000.paid_at) AS booking__paid_at__extract_month @@ -304,22 +304,22 @@ FROM ( 1 AS listings , listings_latest_src_28000.capacity AS largest_listing , listings_latest_src_28000.capacity AS smallest_listing - , DATE_TRUNC(listings_latest_src_28000.created_at, day) AS ds__day - , DATE_TRUNC(listings_latest_src_28000.created_at, isoweek) AS ds__week - , DATE_TRUNC(listings_latest_src_28000.created_at, month) AS ds__month - , DATE_TRUNC(listings_latest_src_28000.created_at, quarter) AS ds__quarter - , DATE_TRUNC(listings_latest_src_28000.created_at, year) AS ds__year + , DATETIME_TRUNC(listings_latest_src_28000.created_at, day) AS ds__day + , DATETIME_TRUNC(listings_latest_src_28000.created_at, isoweek) AS ds__week + , DATETIME_TRUNC(listings_latest_src_28000.created_at, month) AS ds__month + , DATETIME_TRUNC(listings_latest_src_28000.created_at, quarter) AS ds__quarter + , DATETIME_TRUNC(listings_latest_src_28000.created_at, year) AS ds__year , EXTRACT(year FROM listings_latest_src_28000.created_at) AS ds__extract_year , EXTRACT(quarter FROM listings_latest_src_28000.created_at) AS ds__extract_quarter , EXTRACT(month FROM listings_latest_src_28000.created_at) AS ds__extract_month , EXTRACT(day FROM listings_latest_src_28000.created_at) AS ds__extract_day , IF(EXTRACT(dayofweek FROM listings_latest_src_28000.created_at) = 1, 7, EXTRACT(dayofweek FROM listings_latest_src_28000.created_at) - 1) AS ds__extract_dow , EXTRACT(dayofyear FROM listings_latest_src_28000.created_at) AS ds__extract_doy - , DATE_TRUNC(listings_latest_src_28000.created_at, day) AS created_at__day - , DATE_TRUNC(listings_latest_src_28000.created_at, isoweek) AS created_at__week - , DATE_TRUNC(listings_latest_src_28000.created_at, month) AS created_at__month - , DATE_TRUNC(listings_latest_src_28000.created_at, quarter) AS created_at__quarter - , DATE_TRUNC(listings_latest_src_28000.created_at, year) AS created_at__year + , DATETIME_TRUNC(listings_latest_src_28000.created_at, day) AS created_at__day + , DATETIME_TRUNC(listings_latest_src_28000.created_at, isoweek) AS created_at__week + , DATETIME_TRUNC(listings_latest_src_28000.created_at, month) AS created_at__month + , DATETIME_TRUNC(listings_latest_src_28000.created_at, quarter) AS created_at__quarter + , DATETIME_TRUNC(listings_latest_src_28000.created_at, year) AS created_at__year , EXTRACT(year FROM listings_latest_src_28000.created_at) AS created_at__extract_year , EXTRACT(quarter FROM listings_latest_src_28000.created_at) AS created_at__extract_quarter , EXTRACT(month FROM listings_latest_src_28000.created_at) AS created_at__extract_month @@ -329,22 +329,22 @@ FROM ( , listings_latest_src_28000.country AS country_latest , listings_latest_src_28000.is_lux AS is_lux_latest , listings_latest_src_28000.capacity AS capacity_latest - , DATE_TRUNC(listings_latest_src_28000.created_at, day) AS listing__ds__day - , DATE_TRUNC(listings_latest_src_28000.created_at, isoweek) AS listing__ds__week - , DATE_TRUNC(listings_latest_src_28000.created_at, month) AS listing__ds__month - , DATE_TRUNC(listings_latest_src_28000.created_at, quarter) AS listing__ds__quarter - , DATE_TRUNC(listings_latest_src_28000.created_at, year) AS listing__ds__year + , DATETIME_TRUNC(listings_latest_src_28000.created_at, day) AS listing__ds__day + , DATETIME_TRUNC(listings_latest_src_28000.created_at, isoweek) AS listing__ds__week + , DATETIME_TRUNC(listings_latest_src_28000.created_at, month) AS listing__ds__month + , DATETIME_TRUNC(listings_latest_src_28000.created_at, quarter) AS listing__ds__quarter + , DATETIME_TRUNC(listings_latest_src_28000.created_at, year) AS listing__ds__year , EXTRACT(year FROM listings_latest_src_28000.created_at) AS listing__ds__extract_year , EXTRACT(quarter FROM listings_latest_src_28000.created_at) AS listing__ds__extract_quarter , EXTRACT(month FROM listings_latest_src_28000.created_at) AS listing__ds__extract_month , EXTRACT(day FROM listings_latest_src_28000.created_at) AS listing__ds__extract_day , IF(EXTRACT(dayofweek FROM listings_latest_src_28000.created_at) = 1, 7, EXTRACT(dayofweek FROM listings_latest_src_28000.created_at) - 1) AS listing__ds__extract_dow , EXTRACT(dayofyear FROM listings_latest_src_28000.created_at) AS listing__ds__extract_doy - , DATE_TRUNC(listings_latest_src_28000.created_at, day) AS listing__created_at__day - , DATE_TRUNC(listings_latest_src_28000.created_at, isoweek) AS listing__created_at__week - , DATE_TRUNC(listings_latest_src_28000.created_at, month) AS listing__created_at__month - , DATE_TRUNC(listings_latest_src_28000.created_at, quarter) AS listing__created_at__quarter - , DATE_TRUNC(listings_latest_src_28000.created_at, year) AS listing__created_at__year + , DATETIME_TRUNC(listings_latest_src_28000.created_at, day) AS listing__created_at__day + , DATETIME_TRUNC(listings_latest_src_28000.created_at, isoweek) AS listing__created_at__week + , DATETIME_TRUNC(listings_latest_src_28000.created_at, month) AS listing__created_at__month + , DATETIME_TRUNC(listings_latest_src_28000.created_at, quarter) AS listing__created_at__quarter + , DATETIME_TRUNC(listings_latest_src_28000.created_at, year) AS listing__created_at__year , EXTRACT(year FROM listings_latest_src_28000.created_at) AS listing__created_at__extract_year , EXTRACT(quarter FROM listings_latest_src_28000.created_at) AS listing__created_at__extract_quarter , EXTRACT(month FROM listings_latest_src_28000.created_at) AS listing__created_at__extract_month diff --git a/tests_metricflow/snapshots/test_query_rendering.py/SqlQueryPlan/BigQuery/test_min_max_metric_time__plan0.sql b/tests_metricflow/snapshots/test_query_rendering.py/SqlQueryPlan/BigQuery/test_min_max_metric_time__plan0.sql index 357dcc1c04..43cd6f32e3 100644 --- a/tests_metricflow/snapshots/test_query_rendering.py/SqlQueryPlan/BigQuery/test_min_max_metric_time__plan0.sql +++ b/tests_metricflow/snapshots/test_query_rendering.py/SqlQueryPlan/BigQuery/test_min_max_metric_time__plan0.sql @@ -34,11 +34,11 @@ FROM ( FROM ( -- Time Spine SELECT - DATE_TRUNC(time_spine_src_28000.ds, day) AS ds__day - , DATE_TRUNC(time_spine_src_28000.ds, isoweek) AS ds__week - , DATE_TRUNC(time_spine_src_28000.ds, month) AS ds__month - , DATE_TRUNC(time_spine_src_28000.ds, quarter) AS ds__quarter - , DATE_TRUNC(time_spine_src_28000.ds, year) AS ds__year + DATETIME_TRUNC(time_spine_src_28000.ds, day) AS ds__day + , DATETIME_TRUNC(time_spine_src_28000.ds, isoweek) AS ds__week + , DATETIME_TRUNC(time_spine_src_28000.ds, month) AS ds__month + , DATETIME_TRUNC(time_spine_src_28000.ds, quarter) AS ds__quarter + , DATETIME_TRUNC(time_spine_src_28000.ds, year) AS ds__year , EXTRACT(year FROM time_spine_src_28000.ds) AS ds__extract_year , EXTRACT(quarter FROM time_spine_src_28000.ds) AS ds__extract_quarter , EXTRACT(month FROM time_spine_src_28000.ds) AS ds__extract_month diff --git a/tests_metricflow/snapshots/test_query_rendering.py/SqlQueryPlan/BigQuery/test_min_max_metric_time__plan0_optimized.sql b/tests_metricflow/snapshots/test_query_rendering.py/SqlQueryPlan/BigQuery/test_min_max_metric_time__plan0_optimized.sql index 8ec08740c5..21b0a95fc4 100644 --- a/tests_metricflow/snapshots/test_query_rendering.py/SqlQueryPlan/BigQuery/test_min_max_metric_time__plan0_optimized.sql +++ b/tests_metricflow/snapshots/test_query_rendering.py/SqlQueryPlan/BigQuery/test_min_max_metric_time__plan0_optimized.sql @@ -7,7 +7,7 @@ FROM ( -- Metric Time Dimension 'ds' -- Pass Only Elements: ['metric_time__day',] SELECT - DATE_TRUNC(ds, day) AS metric_time__day + DATETIME_TRUNC(ds, day) AS metric_time__day FROM ***************************.mf_time_spine time_spine_src_28000 GROUP BY metric_time__day diff --git a/tests_metricflow/snapshots/test_query_rendering.py/SqlQueryPlan/BigQuery/test_min_max_metric_time_week__plan0.sql b/tests_metricflow/snapshots/test_query_rendering.py/SqlQueryPlan/BigQuery/test_min_max_metric_time_week__plan0.sql index 69fd6e094e..f43945c4af 100644 --- a/tests_metricflow/snapshots/test_query_rendering.py/SqlQueryPlan/BigQuery/test_min_max_metric_time_week__plan0.sql +++ b/tests_metricflow/snapshots/test_query_rendering.py/SqlQueryPlan/BigQuery/test_min_max_metric_time_week__plan0.sql @@ -34,11 +34,11 @@ FROM ( FROM ( -- Time Spine SELECT - DATE_TRUNC(time_spine_src_28000.ds, day) AS ds__day - , DATE_TRUNC(time_spine_src_28000.ds, isoweek) AS ds__week - , DATE_TRUNC(time_spine_src_28000.ds, month) AS ds__month - , DATE_TRUNC(time_spine_src_28000.ds, quarter) AS ds__quarter - , DATE_TRUNC(time_spine_src_28000.ds, year) AS ds__year + DATETIME_TRUNC(time_spine_src_28000.ds, day) AS ds__day + , DATETIME_TRUNC(time_spine_src_28000.ds, isoweek) AS ds__week + , DATETIME_TRUNC(time_spine_src_28000.ds, month) AS ds__month + , DATETIME_TRUNC(time_spine_src_28000.ds, quarter) AS ds__quarter + , DATETIME_TRUNC(time_spine_src_28000.ds, year) AS ds__year , EXTRACT(year FROM time_spine_src_28000.ds) AS ds__extract_year , EXTRACT(quarter FROM time_spine_src_28000.ds) AS ds__extract_quarter , EXTRACT(month FROM time_spine_src_28000.ds) AS ds__extract_month diff --git a/tests_metricflow/snapshots/test_query_rendering.py/SqlQueryPlan/BigQuery/test_min_max_metric_time_week__plan0_optimized.sql b/tests_metricflow/snapshots/test_query_rendering.py/SqlQueryPlan/BigQuery/test_min_max_metric_time_week__plan0_optimized.sql index f9f7f17bbd..68ca95b0d3 100644 --- a/tests_metricflow/snapshots/test_query_rendering.py/SqlQueryPlan/BigQuery/test_min_max_metric_time_week__plan0_optimized.sql +++ b/tests_metricflow/snapshots/test_query_rendering.py/SqlQueryPlan/BigQuery/test_min_max_metric_time_week__plan0_optimized.sql @@ -7,7 +7,7 @@ FROM ( -- Metric Time Dimension 'ds' -- Pass Only Elements: ['metric_time__week',] SELECT - DATE_TRUNC(ds, isoweek) AS metric_time__week + DATETIME_TRUNC(ds, isoweek) AS metric_time__week FROM ***************************.mf_time_spine time_spine_src_28000 GROUP BY metric_time__week diff --git a/tests_metricflow/snapshots/test_query_rendering.py/SqlQueryPlan/BigQuery/test_min_max_only_categorical__plan0.sql b/tests_metricflow/snapshots/test_query_rendering.py/SqlQueryPlan/BigQuery/test_min_max_only_categorical__plan0.sql index 0435a81912..38c505143e 100644 --- a/tests_metricflow/snapshots/test_query_rendering.py/SqlQueryPlan/BigQuery/test_min_max_only_categorical__plan0.sql +++ b/tests_metricflow/snapshots/test_query_rendering.py/SqlQueryPlan/BigQuery/test_min_max_only_categorical__plan0.sql @@ -12,22 +12,22 @@ FROM ( 1 AS listings , listings_latest_src_28000.capacity AS largest_listing , listings_latest_src_28000.capacity AS smallest_listing - , DATE_TRUNC(listings_latest_src_28000.created_at, day) AS ds__day - , DATE_TRUNC(listings_latest_src_28000.created_at, isoweek) AS ds__week - , DATE_TRUNC(listings_latest_src_28000.created_at, month) AS ds__month - , DATE_TRUNC(listings_latest_src_28000.created_at, quarter) AS ds__quarter - , DATE_TRUNC(listings_latest_src_28000.created_at, year) AS ds__year + , DATETIME_TRUNC(listings_latest_src_28000.created_at, day) AS ds__day + , DATETIME_TRUNC(listings_latest_src_28000.created_at, isoweek) AS ds__week + , DATETIME_TRUNC(listings_latest_src_28000.created_at, month) AS ds__month + , DATETIME_TRUNC(listings_latest_src_28000.created_at, quarter) AS ds__quarter + , DATETIME_TRUNC(listings_latest_src_28000.created_at, year) AS ds__year , EXTRACT(year FROM listings_latest_src_28000.created_at) AS ds__extract_year , EXTRACT(quarter FROM listings_latest_src_28000.created_at) AS ds__extract_quarter , EXTRACT(month FROM listings_latest_src_28000.created_at) AS ds__extract_month , EXTRACT(day FROM listings_latest_src_28000.created_at) AS ds__extract_day , IF(EXTRACT(dayofweek FROM listings_latest_src_28000.created_at) = 1, 7, EXTRACT(dayofweek FROM listings_latest_src_28000.created_at) - 1) AS ds__extract_dow , EXTRACT(dayofyear FROM listings_latest_src_28000.created_at) AS ds__extract_doy - , DATE_TRUNC(listings_latest_src_28000.created_at, day) AS created_at__day - , DATE_TRUNC(listings_latest_src_28000.created_at, isoweek) AS created_at__week - , DATE_TRUNC(listings_latest_src_28000.created_at, month) AS created_at__month - , DATE_TRUNC(listings_latest_src_28000.created_at, quarter) AS created_at__quarter - , DATE_TRUNC(listings_latest_src_28000.created_at, year) AS created_at__year + , DATETIME_TRUNC(listings_latest_src_28000.created_at, day) AS created_at__day + , DATETIME_TRUNC(listings_latest_src_28000.created_at, isoweek) AS created_at__week + , DATETIME_TRUNC(listings_latest_src_28000.created_at, month) AS created_at__month + , DATETIME_TRUNC(listings_latest_src_28000.created_at, quarter) AS created_at__quarter + , DATETIME_TRUNC(listings_latest_src_28000.created_at, year) AS created_at__year , EXTRACT(year FROM listings_latest_src_28000.created_at) AS created_at__extract_year , EXTRACT(quarter FROM listings_latest_src_28000.created_at) AS created_at__extract_quarter , EXTRACT(month FROM listings_latest_src_28000.created_at) AS created_at__extract_month @@ -37,22 +37,22 @@ FROM ( , listings_latest_src_28000.country AS country_latest , listings_latest_src_28000.is_lux AS is_lux_latest , listings_latest_src_28000.capacity AS capacity_latest - , DATE_TRUNC(listings_latest_src_28000.created_at, day) AS listing__ds__day - , DATE_TRUNC(listings_latest_src_28000.created_at, isoweek) AS listing__ds__week - , DATE_TRUNC(listings_latest_src_28000.created_at, month) AS listing__ds__month - , DATE_TRUNC(listings_latest_src_28000.created_at, quarter) AS listing__ds__quarter - , DATE_TRUNC(listings_latest_src_28000.created_at, year) AS listing__ds__year + , DATETIME_TRUNC(listings_latest_src_28000.created_at, day) AS listing__ds__day + , DATETIME_TRUNC(listings_latest_src_28000.created_at, isoweek) AS listing__ds__week + , DATETIME_TRUNC(listings_latest_src_28000.created_at, month) AS listing__ds__month + , DATETIME_TRUNC(listings_latest_src_28000.created_at, quarter) AS listing__ds__quarter + , DATETIME_TRUNC(listings_latest_src_28000.created_at, year) AS listing__ds__year , EXTRACT(year FROM listings_latest_src_28000.created_at) AS listing__ds__extract_year , EXTRACT(quarter FROM listings_latest_src_28000.created_at) AS listing__ds__extract_quarter , EXTRACT(month FROM listings_latest_src_28000.created_at) AS listing__ds__extract_month , EXTRACT(day FROM listings_latest_src_28000.created_at) AS listing__ds__extract_day , IF(EXTRACT(dayofweek FROM listings_latest_src_28000.created_at) = 1, 7, EXTRACT(dayofweek FROM listings_latest_src_28000.created_at) - 1) AS listing__ds__extract_dow , EXTRACT(dayofyear FROM listings_latest_src_28000.created_at) AS listing__ds__extract_doy - , DATE_TRUNC(listings_latest_src_28000.created_at, day) AS listing__created_at__day - , DATE_TRUNC(listings_latest_src_28000.created_at, isoweek) AS listing__created_at__week - , DATE_TRUNC(listings_latest_src_28000.created_at, month) AS listing__created_at__month - , DATE_TRUNC(listings_latest_src_28000.created_at, quarter) AS listing__created_at__quarter - , DATE_TRUNC(listings_latest_src_28000.created_at, year) AS listing__created_at__year + , DATETIME_TRUNC(listings_latest_src_28000.created_at, day) AS listing__created_at__day + , DATETIME_TRUNC(listings_latest_src_28000.created_at, isoweek) AS listing__created_at__week + , DATETIME_TRUNC(listings_latest_src_28000.created_at, month) AS listing__created_at__month + , DATETIME_TRUNC(listings_latest_src_28000.created_at, quarter) AS listing__created_at__quarter + , DATETIME_TRUNC(listings_latest_src_28000.created_at, year) AS listing__created_at__year , EXTRACT(year FROM listings_latest_src_28000.created_at) AS listing__created_at__extract_year , EXTRACT(quarter FROM listings_latest_src_28000.created_at) AS listing__created_at__extract_quarter , EXTRACT(month FROM listings_latest_src_28000.created_at) AS listing__created_at__extract_month diff --git a/tests_metricflow/snapshots/test_query_rendering.py/SqlQueryPlan/BigQuery/test_min_max_only_time__plan0.sql b/tests_metricflow/snapshots/test_query_rendering.py/SqlQueryPlan/BigQuery/test_min_max_only_time__plan0.sql index bc8a2057e4..bc54ab0bf5 100644 --- a/tests_metricflow/snapshots/test_query_rendering.py/SqlQueryPlan/BigQuery/test_min_max_only_time__plan0.sql +++ b/tests_metricflow/snapshots/test_query_rendering.py/SqlQueryPlan/BigQuery/test_min_max_only_time__plan0.sql @@ -24,33 +24,33 @@ FROM ( , bookings_source_src_28000.booking_value AS approximate_continuous_booking_value_p99 , bookings_source_src_28000.booking_value AS approximate_discrete_booking_value_p99 , bookings_source_src_28000.is_instant - , DATE_TRUNC(bookings_source_src_28000.ds, day) AS ds__day - , DATE_TRUNC(bookings_source_src_28000.ds, isoweek) AS ds__week - , DATE_TRUNC(bookings_source_src_28000.ds, month) AS ds__month - , DATE_TRUNC(bookings_source_src_28000.ds, quarter) AS ds__quarter - , DATE_TRUNC(bookings_source_src_28000.ds, year) AS ds__year + , DATETIME_TRUNC(bookings_source_src_28000.ds, day) AS ds__day + , DATETIME_TRUNC(bookings_source_src_28000.ds, isoweek) AS ds__week + , DATETIME_TRUNC(bookings_source_src_28000.ds, month) AS ds__month + , DATETIME_TRUNC(bookings_source_src_28000.ds, quarter) AS ds__quarter + , DATETIME_TRUNC(bookings_source_src_28000.ds, year) AS ds__year , EXTRACT(year FROM bookings_source_src_28000.ds) AS ds__extract_year , EXTRACT(quarter FROM bookings_source_src_28000.ds) AS ds__extract_quarter , EXTRACT(month FROM bookings_source_src_28000.ds) AS ds__extract_month , EXTRACT(day FROM bookings_source_src_28000.ds) AS ds__extract_day , IF(EXTRACT(dayofweek FROM bookings_source_src_28000.ds) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_28000.ds) - 1) AS ds__extract_dow , EXTRACT(dayofyear FROM bookings_source_src_28000.ds) AS ds__extract_doy - , DATE_TRUNC(bookings_source_src_28000.ds_partitioned, day) AS ds_partitioned__day - , DATE_TRUNC(bookings_source_src_28000.ds_partitioned, isoweek) AS ds_partitioned__week - , DATE_TRUNC(bookings_source_src_28000.ds_partitioned, month) AS ds_partitioned__month - , DATE_TRUNC(bookings_source_src_28000.ds_partitioned, quarter) AS ds_partitioned__quarter - , DATE_TRUNC(bookings_source_src_28000.ds_partitioned, year) AS ds_partitioned__year + , DATETIME_TRUNC(bookings_source_src_28000.ds_partitioned, day) AS ds_partitioned__day + , DATETIME_TRUNC(bookings_source_src_28000.ds_partitioned, isoweek) AS ds_partitioned__week + , DATETIME_TRUNC(bookings_source_src_28000.ds_partitioned, month) AS ds_partitioned__month + , DATETIME_TRUNC(bookings_source_src_28000.ds_partitioned, quarter) AS ds_partitioned__quarter + , DATETIME_TRUNC(bookings_source_src_28000.ds_partitioned, year) AS ds_partitioned__year , EXTRACT(year FROM bookings_source_src_28000.ds_partitioned) AS ds_partitioned__extract_year , EXTRACT(quarter FROM bookings_source_src_28000.ds_partitioned) AS ds_partitioned__extract_quarter , EXTRACT(month FROM bookings_source_src_28000.ds_partitioned) AS ds_partitioned__extract_month , EXTRACT(day FROM bookings_source_src_28000.ds_partitioned) AS ds_partitioned__extract_day , IF(EXTRACT(dayofweek FROM bookings_source_src_28000.ds_partitioned) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_28000.ds_partitioned) - 1) AS ds_partitioned__extract_dow , EXTRACT(dayofyear FROM bookings_source_src_28000.ds_partitioned) AS ds_partitioned__extract_doy - , DATE_TRUNC(bookings_source_src_28000.paid_at, day) AS paid_at__day - , DATE_TRUNC(bookings_source_src_28000.paid_at, isoweek) AS paid_at__week - , DATE_TRUNC(bookings_source_src_28000.paid_at, month) AS paid_at__month - , DATE_TRUNC(bookings_source_src_28000.paid_at, quarter) AS paid_at__quarter - , DATE_TRUNC(bookings_source_src_28000.paid_at, year) AS paid_at__year + , DATETIME_TRUNC(bookings_source_src_28000.paid_at, day) AS paid_at__day + , DATETIME_TRUNC(bookings_source_src_28000.paid_at, isoweek) AS paid_at__week + , DATETIME_TRUNC(bookings_source_src_28000.paid_at, month) AS paid_at__month + , DATETIME_TRUNC(bookings_source_src_28000.paid_at, quarter) AS paid_at__quarter + , DATETIME_TRUNC(bookings_source_src_28000.paid_at, year) AS paid_at__year , EXTRACT(year FROM bookings_source_src_28000.paid_at) AS paid_at__extract_year , EXTRACT(quarter FROM bookings_source_src_28000.paid_at) AS paid_at__extract_quarter , EXTRACT(month FROM bookings_source_src_28000.paid_at) AS paid_at__extract_month @@ -58,33 +58,33 @@ FROM ( , IF(EXTRACT(dayofweek FROM bookings_source_src_28000.paid_at) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_28000.paid_at) - 1) AS paid_at__extract_dow , EXTRACT(dayofyear FROM bookings_source_src_28000.paid_at) AS paid_at__extract_doy , bookings_source_src_28000.is_instant AS booking__is_instant - , DATE_TRUNC(bookings_source_src_28000.ds, day) AS booking__ds__day - , DATE_TRUNC(bookings_source_src_28000.ds, isoweek) AS booking__ds__week - , DATE_TRUNC(bookings_source_src_28000.ds, month) AS booking__ds__month - , DATE_TRUNC(bookings_source_src_28000.ds, quarter) AS booking__ds__quarter - , DATE_TRUNC(bookings_source_src_28000.ds, year) AS booking__ds__year + , DATETIME_TRUNC(bookings_source_src_28000.ds, day) AS booking__ds__day + , DATETIME_TRUNC(bookings_source_src_28000.ds, isoweek) AS booking__ds__week + , DATETIME_TRUNC(bookings_source_src_28000.ds, month) AS booking__ds__month + , DATETIME_TRUNC(bookings_source_src_28000.ds, quarter) AS booking__ds__quarter + , DATETIME_TRUNC(bookings_source_src_28000.ds, year) AS booking__ds__year , EXTRACT(year FROM bookings_source_src_28000.ds) AS booking__ds__extract_year , EXTRACT(quarter FROM bookings_source_src_28000.ds) AS booking__ds__extract_quarter , EXTRACT(month FROM bookings_source_src_28000.ds) AS booking__ds__extract_month , EXTRACT(day FROM bookings_source_src_28000.ds) AS booking__ds__extract_day , IF(EXTRACT(dayofweek FROM bookings_source_src_28000.ds) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_28000.ds) - 1) AS booking__ds__extract_dow , EXTRACT(dayofyear FROM bookings_source_src_28000.ds) AS booking__ds__extract_doy - , DATE_TRUNC(bookings_source_src_28000.ds_partitioned, day) AS booking__ds_partitioned__day - , DATE_TRUNC(bookings_source_src_28000.ds_partitioned, isoweek) AS booking__ds_partitioned__week - , DATE_TRUNC(bookings_source_src_28000.ds_partitioned, month) AS booking__ds_partitioned__month - , DATE_TRUNC(bookings_source_src_28000.ds_partitioned, quarter) AS booking__ds_partitioned__quarter - , DATE_TRUNC(bookings_source_src_28000.ds_partitioned, year) AS booking__ds_partitioned__year + , DATETIME_TRUNC(bookings_source_src_28000.ds_partitioned, day) AS booking__ds_partitioned__day + , DATETIME_TRUNC(bookings_source_src_28000.ds_partitioned, isoweek) AS booking__ds_partitioned__week + , DATETIME_TRUNC(bookings_source_src_28000.ds_partitioned, month) AS booking__ds_partitioned__month + , DATETIME_TRUNC(bookings_source_src_28000.ds_partitioned, quarter) AS booking__ds_partitioned__quarter + , DATETIME_TRUNC(bookings_source_src_28000.ds_partitioned, year) AS booking__ds_partitioned__year , EXTRACT(year FROM bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__extract_year , EXTRACT(quarter FROM bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__extract_quarter , EXTRACT(month FROM bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__extract_month , EXTRACT(day FROM bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__extract_day , IF(EXTRACT(dayofweek FROM bookings_source_src_28000.ds_partitioned) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_28000.ds_partitioned) - 1) AS booking__ds_partitioned__extract_dow , EXTRACT(dayofyear FROM bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__extract_doy - , DATE_TRUNC(bookings_source_src_28000.paid_at, day) AS booking__paid_at__day - , DATE_TRUNC(bookings_source_src_28000.paid_at, isoweek) AS booking__paid_at__week - , DATE_TRUNC(bookings_source_src_28000.paid_at, month) AS booking__paid_at__month - , DATE_TRUNC(bookings_source_src_28000.paid_at, quarter) AS booking__paid_at__quarter - , DATE_TRUNC(bookings_source_src_28000.paid_at, year) AS booking__paid_at__year + , DATETIME_TRUNC(bookings_source_src_28000.paid_at, day) AS booking__paid_at__day + , DATETIME_TRUNC(bookings_source_src_28000.paid_at, isoweek) AS booking__paid_at__week + , DATETIME_TRUNC(bookings_source_src_28000.paid_at, month) AS booking__paid_at__month + , DATETIME_TRUNC(bookings_source_src_28000.paid_at, quarter) AS booking__paid_at__quarter + , DATETIME_TRUNC(bookings_source_src_28000.paid_at, year) AS booking__paid_at__year , EXTRACT(year FROM bookings_source_src_28000.paid_at) AS booking__paid_at__extract_year , EXTRACT(quarter FROM bookings_source_src_28000.paid_at) AS booking__paid_at__extract_quarter , EXTRACT(month FROM bookings_source_src_28000.paid_at) AS booking__paid_at__extract_month diff --git a/tests_metricflow/snapshots/test_query_rendering.py/SqlQueryPlan/BigQuery/test_min_max_only_time__plan0_optimized.sql b/tests_metricflow/snapshots/test_query_rendering.py/SqlQueryPlan/BigQuery/test_min_max_only_time__plan0_optimized.sql index 06b4483f39..5910729ad7 100644 --- a/tests_metricflow/snapshots/test_query_rendering.py/SqlQueryPlan/BigQuery/test_min_max_only_time__plan0_optimized.sql +++ b/tests_metricflow/snapshots/test_query_rendering.py/SqlQueryPlan/BigQuery/test_min_max_only_time__plan0_optimized.sql @@ -6,7 +6,7 @@ FROM ( -- Read Elements From Semantic Model 'bookings_source' -- Pass Only Elements: ['booking__paid_at__day',] SELECT - DATE_TRUNC(paid_at, day) AS booking__paid_at__day + DATETIME_TRUNC(paid_at, day) AS booking__paid_at__day FROM ***************************.fct_bookings bookings_source_src_28000 GROUP BY booking__paid_at__day diff --git a/tests_metricflow/snapshots/test_query_rendering.py/SqlQueryPlan/BigQuery/test_min_max_only_time_quarter__plan0.sql b/tests_metricflow/snapshots/test_query_rendering.py/SqlQueryPlan/BigQuery/test_min_max_only_time_quarter__plan0.sql index b7db3c2043..4375037c0d 100644 --- a/tests_metricflow/snapshots/test_query_rendering.py/SqlQueryPlan/BigQuery/test_min_max_only_time_quarter__plan0.sql +++ b/tests_metricflow/snapshots/test_query_rendering.py/SqlQueryPlan/BigQuery/test_min_max_only_time_quarter__plan0.sql @@ -24,33 +24,33 @@ FROM ( , bookings_source_src_28000.booking_value AS approximate_continuous_booking_value_p99 , bookings_source_src_28000.booking_value AS approximate_discrete_booking_value_p99 , bookings_source_src_28000.is_instant - , DATE_TRUNC(bookings_source_src_28000.ds, day) AS ds__day - , DATE_TRUNC(bookings_source_src_28000.ds, isoweek) AS ds__week - , DATE_TRUNC(bookings_source_src_28000.ds, month) AS ds__month - , DATE_TRUNC(bookings_source_src_28000.ds, quarter) AS ds__quarter - , DATE_TRUNC(bookings_source_src_28000.ds, year) AS ds__year + , DATETIME_TRUNC(bookings_source_src_28000.ds, day) AS ds__day + , DATETIME_TRUNC(bookings_source_src_28000.ds, isoweek) AS ds__week + , DATETIME_TRUNC(bookings_source_src_28000.ds, month) AS ds__month + , DATETIME_TRUNC(bookings_source_src_28000.ds, quarter) AS ds__quarter + , DATETIME_TRUNC(bookings_source_src_28000.ds, year) AS ds__year , EXTRACT(year FROM bookings_source_src_28000.ds) AS ds__extract_year , EXTRACT(quarter FROM bookings_source_src_28000.ds) AS ds__extract_quarter , EXTRACT(month FROM bookings_source_src_28000.ds) AS ds__extract_month , EXTRACT(day FROM bookings_source_src_28000.ds) AS ds__extract_day , IF(EXTRACT(dayofweek FROM bookings_source_src_28000.ds) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_28000.ds) - 1) AS ds__extract_dow , EXTRACT(dayofyear FROM bookings_source_src_28000.ds) AS ds__extract_doy - , DATE_TRUNC(bookings_source_src_28000.ds_partitioned, day) AS ds_partitioned__day - , DATE_TRUNC(bookings_source_src_28000.ds_partitioned, isoweek) AS ds_partitioned__week - , DATE_TRUNC(bookings_source_src_28000.ds_partitioned, month) AS ds_partitioned__month - , DATE_TRUNC(bookings_source_src_28000.ds_partitioned, quarter) AS ds_partitioned__quarter - , DATE_TRUNC(bookings_source_src_28000.ds_partitioned, year) AS ds_partitioned__year + , DATETIME_TRUNC(bookings_source_src_28000.ds_partitioned, day) AS ds_partitioned__day + , DATETIME_TRUNC(bookings_source_src_28000.ds_partitioned, isoweek) AS ds_partitioned__week + , DATETIME_TRUNC(bookings_source_src_28000.ds_partitioned, month) AS ds_partitioned__month + , DATETIME_TRUNC(bookings_source_src_28000.ds_partitioned, quarter) AS ds_partitioned__quarter + , DATETIME_TRUNC(bookings_source_src_28000.ds_partitioned, year) AS ds_partitioned__year , EXTRACT(year FROM bookings_source_src_28000.ds_partitioned) AS ds_partitioned__extract_year , EXTRACT(quarter FROM bookings_source_src_28000.ds_partitioned) AS ds_partitioned__extract_quarter , EXTRACT(month FROM bookings_source_src_28000.ds_partitioned) AS ds_partitioned__extract_month , EXTRACT(day FROM bookings_source_src_28000.ds_partitioned) AS ds_partitioned__extract_day , IF(EXTRACT(dayofweek FROM bookings_source_src_28000.ds_partitioned) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_28000.ds_partitioned) - 1) AS ds_partitioned__extract_dow , EXTRACT(dayofyear FROM bookings_source_src_28000.ds_partitioned) AS ds_partitioned__extract_doy - , DATE_TRUNC(bookings_source_src_28000.paid_at, day) AS paid_at__day - , DATE_TRUNC(bookings_source_src_28000.paid_at, isoweek) AS paid_at__week - , DATE_TRUNC(bookings_source_src_28000.paid_at, month) AS paid_at__month - , DATE_TRUNC(bookings_source_src_28000.paid_at, quarter) AS paid_at__quarter - , DATE_TRUNC(bookings_source_src_28000.paid_at, year) AS paid_at__year + , DATETIME_TRUNC(bookings_source_src_28000.paid_at, day) AS paid_at__day + , DATETIME_TRUNC(bookings_source_src_28000.paid_at, isoweek) AS paid_at__week + , DATETIME_TRUNC(bookings_source_src_28000.paid_at, month) AS paid_at__month + , DATETIME_TRUNC(bookings_source_src_28000.paid_at, quarter) AS paid_at__quarter + , DATETIME_TRUNC(bookings_source_src_28000.paid_at, year) AS paid_at__year , EXTRACT(year FROM bookings_source_src_28000.paid_at) AS paid_at__extract_year , EXTRACT(quarter FROM bookings_source_src_28000.paid_at) AS paid_at__extract_quarter , EXTRACT(month FROM bookings_source_src_28000.paid_at) AS paid_at__extract_month @@ -58,33 +58,33 @@ FROM ( , IF(EXTRACT(dayofweek FROM bookings_source_src_28000.paid_at) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_28000.paid_at) - 1) AS paid_at__extract_dow , EXTRACT(dayofyear FROM bookings_source_src_28000.paid_at) AS paid_at__extract_doy , bookings_source_src_28000.is_instant AS booking__is_instant - , DATE_TRUNC(bookings_source_src_28000.ds, day) AS booking__ds__day - , DATE_TRUNC(bookings_source_src_28000.ds, isoweek) AS booking__ds__week - , DATE_TRUNC(bookings_source_src_28000.ds, month) AS booking__ds__month - , DATE_TRUNC(bookings_source_src_28000.ds, quarter) AS booking__ds__quarter - , DATE_TRUNC(bookings_source_src_28000.ds, year) AS booking__ds__year + , DATETIME_TRUNC(bookings_source_src_28000.ds, day) AS booking__ds__day + , DATETIME_TRUNC(bookings_source_src_28000.ds, isoweek) AS booking__ds__week + , DATETIME_TRUNC(bookings_source_src_28000.ds, month) AS booking__ds__month + , DATETIME_TRUNC(bookings_source_src_28000.ds, quarter) AS booking__ds__quarter + , DATETIME_TRUNC(bookings_source_src_28000.ds, year) AS booking__ds__year , EXTRACT(year FROM bookings_source_src_28000.ds) AS booking__ds__extract_year , EXTRACT(quarter FROM bookings_source_src_28000.ds) AS booking__ds__extract_quarter , EXTRACT(month FROM bookings_source_src_28000.ds) AS booking__ds__extract_month , EXTRACT(day FROM bookings_source_src_28000.ds) AS booking__ds__extract_day , IF(EXTRACT(dayofweek FROM bookings_source_src_28000.ds) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_28000.ds) - 1) AS booking__ds__extract_dow , EXTRACT(dayofyear FROM bookings_source_src_28000.ds) AS booking__ds__extract_doy - , DATE_TRUNC(bookings_source_src_28000.ds_partitioned, day) AS booking__ds_partitioned__day - , DATE_TRUNC(bookings_source_src_28000.ds_partitioned, isoweek) AS booking__ds_partitioned__week - , DATE_TRUNC(bookings_source_src_28000.ds_partitioned, month) AS booking__ds_partitioned__month - , DATE_TRUNC(bookings_source_src_28000.ds_partitioned, quarter) AS booking__ds_partitioned__quarter - , DATE_TRUNC(bookings_source_src_28000.ds_partitioned, year) AS booking__ds_partitioned__year + , DATETIME_TRUNC(bookings_source_src_28000.ds_partitioned, day) AS booking__ds_partitioned__day + , DATETIME_TRUNC(bookings_source_src_28000.ds_partitioned, isoweek) AS booking__ds_partitioned__week + , DATETIME_TRUNC(bookings_source_src_28000.ds_partitioned, month) AS booking__ds_partitioned__month + , DATETIME_TRUNC(bookings_source_src_28000.ds_partitioned, quarter) AS booking__ds_partitioned__quarter + , DATETIME_TRUNC(bookings_source_src_28000.ds_partitioned, year) AS booking__ds_partitioned__year , EXTRACT(year FROM bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__extract_year , EXTRACT(quarter FROM bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__extract_quarter , EXTRACT(month FROM bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__extract_month , EXTRACT(day FROM bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__extract_day , IF(EXTRACT(dayofweek FROM bookings_source_src_28000.ds_partitioned) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_28000.ds_partitioned) - 1) AS booking__ds_partitioned__extract_dow , EXTRACT(dayofyear FROM bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__extract_doy - , DATE_TRUNC(bookings_source_src_28000.paid_at, day) AS booking__paid_at__day - , DATE_TRUNC(bookings_source_src_28000.paid_at, isoweek) AS booking__paid_at__week - , DATE_TRUNC(bookings_source_src_28000.paid_at, month) AS booking__paid_at__month - , DATE_TRUNC(bookings_source_src_28000.paid_at, quarter) AS booking__paid_at__quarter - , DATE_TRUNC(bookings_source_src_28000.paid_at, year) AS booking__paid_at__year + , DATETIME_TRUNC(bookings_source_src_28000.paid_at, day) AS booking__paid_at__day + , DATETIME_TRUNC(bookings_source_src_28000.paid_at, isoweek) AS booking__paid_at__week + , DATETIME_TRUNC(bookings_source_src_28000.paid_at, month) AS booking__paid_at__month + , DATETIME_TRUNC(bookings_source_src_28000.paid_at, quarter) AS booking__paid_at__quarter + , DATETIME_TRUNC(bookings_source_src_28000.paid_at, year) AS booking__paid_at__year , EXTRACT(year FROM bookings_source_src_28000.paid_at) AS booking__paid_at__extract_year , EXTRACT(quarter FROM bookings_source_src_28000.paid_at) AS booking__paid_at__extract_quarter , EXTRACT(month FROM bookings_source_src_28000.paid_at) AS booking__paid_at__extract_month diff --git a/tests_metricflow/snapshots/test_query_rendering.py/SqlQueryPlan/BigQuery/test_min_max_only_time_quarter__plan0_optimized.sql b/tests_metricflow/snapshots/test_query_rendering.py/SqlQueryPlan/BigQuery/test_min_max_only_time_quarter__plan0_optimized.sql index b2feebb321..304ed34df9 100644 --- a/tests_metricflow/snapshots/test_query_rendering.py/SqlQueryPlan/BigQuery/test_min_max_only_time_quarter__plan0_optimized.sql +++ b/tests_metricflow/snapshots/test_query_rendering.py/SqlQueryPlan/BigQuery/test_min_max_only_time_quarter__plan0_optimized.sql @@ -6,7 +6,7 @@ FROM ( -- Read Elements From Semantic Model 'bookings_source' -- Pass Only Elements: ['booking__paid_at__quarter',] SELECT - DATE_TRUNC(paid_at, quarter) AS booking__paid_at__quarter + DATETIME_TRUNC(paid_at, quarter) AS booking__paid_at__quarter FROM ***************************.fct_bookings bookings_source_src_28000 GROUP BY booking__paid_at__quarter diff --git a/tests_metricflow/snapshots/test_query_rendering.py/SqlQueryPlan/BigQuery/test_multi_hop_through_scd_dimension__plan0.sql b/tests_metricflow/snapshots/test_query_rendering.py/SqlQueryPlan/BigQuery/test_multi_hop_through_scd_dimension__plan0.sql index ec59496890..7f0864b32a 100644 --- a/tests_metricflow/snapshots/test_query_rendering.py/SqlQueryPlan/BigQuery/test_multi_hop_through_scd_dimension__plan0.sql +++ b/tests_metricflow/snapshots/test_query_rendering.py/SqlQueryPlan/BigQuery/test_multi_hop_through_scd_dimension__plan0.sql @@ -135,33 +135,33 @@ FROM ( , bookings_source_src_26000.booking_value AS average_booking_value , bookings_source_src_26000.booking_value AS booking_payments , bookings_source_src_26000.is_instant - , DATE_TRUNC(bookings_source_src_26000.ds, day) AS ds__day - , DATE_TRUNC(bookings_source_src_26000.ds, isoweek) AS ds__week - , DATE_TRUNC(bookings_source_src_26000.ds, month) AS ds__month - , DATE_TRUNC(bookings_source_src_26000.ds, quarter) AS ds__quarter - , DATE_TRUNC(bookings_source_src_26000.ds, year) AS ds__year + , DATETIME_TRUNC(bookings_source_src_26000.ds, day) AS ds__day + , DATETIME_TRUNC(bookings_source_src_26000.ds, isoweek) AS ds__week + , DATETIME_TRUNC(bookings_source_src_26000.ds, month) AS ds__month + , DATETIME_TRUNC(bookings_source_src_26000.ds, quarter) AS ds__quarter + , DATETIME_TRUNC(bookings_source_src_26000.ds, year) AS ds__year , EXTRACT(year FROM bookings_source_src_26000.ds) AS ds__extract_year , EXTRACT(quarter FROM bookings_source_src_26000.ds) AS ds__extract_quarter , EXTRACT(month FROM bookings_source_src_26000.ds) AS ds__extract_month , EXTRACT(day FROM bookings_source_src_26000.ds) AS ds__extract_day , IF(EXTRACT(dayofweek FROM bookings_source_src_26000.ds) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_26000.ds) - 1) AS ds__extract_dow , EXTRACT(dayofyear FROM bookings_source_src_26000.ds) AS ds__extract_doy - , DATE_TRUNC(bookings_source_src_26000.ds_partitioned, day) AS ds_partitioned__day - , DATE_TRUNC(bookings_source_src_26000.ds_partitioned, isoweek) AS ds_partitioned__week - , DATE_TRUNC(bookings_source_src_26000.ds_partitioned, month) AS ds_partitioned__month - , DATE_TRUNC(bookings_source_src_26000.ds_partitioned, quarter) AS ds_partitioned__quarter - , DATE_TRUNC(bookings_source_src_26000.ds_partitioned, year) AS ds_partitioned__year + , DATETIME_TRUNC(bookings_source_src_26000.ds_partitioned, day) AS ds_partitioned__day + , DATETIME_TRUNC(bookings_source_src_26000.ds_partitioned, isoweek) AS ds_partitioned__week + , DATETIME_TRUNC(bookings_source_src_26000.ds_partitioned, month) AS ds_partitioned__month + , DATETIME_TRUNC(bookings_source_src_26000.ds_partitioned, quarter) AS ds_partitioned__quarter + , DATETIME_TRUNC(bookings_source_src_26000.ds_partitioned, year) AS ds_partitioned__year , EXTRACT(year FROM bookings_source_src_26000.ds_partitioned) AS ds_partitioned__extract_year , EXTRACT(quarter FROM bookings_source_src_26000.ds_partitioned) AS ds_partitioned__extract_quarter , EXTRACT(month FROM bookings_source_src_26000.ds_partitioned) AS ds_partitioned__extract_month , EXTRACT(day FROM bookings_source_src_26000.ds_partitioned) AS ds_partitioned__extract_day , IF(EXTRACT(dayofweek FROM bookings_source_src_26000.ds_partitioned) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_26000.ds_partitioned) - 1) AS ds_partitioned__extract_dow , EXTRACT(dayofyear FROM bookings_source_src_26000.ds_partitioned) AS ds_partitioned__extract_doy - , DATE_TRUNC(bookings_source_src_26000.paid_at, day) AS paid_at__day - , DATE_TRUNC(bookings_source_src_26000.paid_at, isoweek) AS paid_at__week - , DATE_TRUNC(bookings_source_src_26000.paid_at, month) AS paid_at__month - , DATE_TRUNC(bookings_source_src_26000.paid_at, quarter) AS paid_at__quarter - , DATE_TRUNC(bookings_source_src_26000.paid_at, year) AS paid_at__year + , DATETIME_TRUNC(bookings_source_src_26000.paid_at, day) AS paid_at__day + , DATETIME_TRUNC(bookings_source_src_26000.paid_at, isoweek) AS paid_at__week + , DATETIME_TRUNC(bookings_source_src_26000.paid_at, month) AS paid_at__month + , DATETIME_TRUNC(bookings_source_src_26000.paid_at, quarter) AS paid_at__quarter + , DATETIME_TRUNC(bookings_source_src_26000.paid_at, year) AS paid_at__year , EXTRACT(year FROM bookings_source_src_26000.paid_at) AS paid_at__extract_year , EXTRACT(quarter FROM bookings_source_src_26000.paid_at) AS paid_at__extract_quarter , EXTRACT(month FROM bookings_source_src_26000.paid_at) AS paid_at__extract_month @@ -169,33 +169,33 @@ FROM ( , IF(EXTRACT(dayofweek FROM bookings_source_src_26000.paid_at) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_26000.paid_at) - 1) AS paid_at__extract_dow , EXTRACT(dayofyear FROM bookings_source_src_26000.paid_at) AS paid_at__extract_doy , bookings_source_src_26000.is_instant AS booking__is_instant - , DATE_TRUNC(bookings_source_src_26000.ds, day) AS booking__ds__day - , DATE_TRUNC(bookings_source_src_26000.ds, isoweek) AS booking__ds__week - , DATE_TRUNC(bookings_source_src_26000.ds, month) AS booking__ds__month - , DATE_TRUNC(bookings_source_src_26000.ds, quarter) AS booking__ds__quarter - , DATE_TRUNC(bookings_source_src_26000.ds, year) AS booking__ds__year + , DATETIME_TRUNC(bookings_source_src_26000.ds, day) AS booking__ds__day + , DATETIME_TRUNC(bookings_source_src_26000.ds, isoweek) AS booking__ds__week + , DATETIME_TRUNC(bookings_source_src_26000.ds, month) AS booking__ds__month + , DATETIME_TRUNC(bookings_source_src_26000.ds, quarter) AS booking__ds__quarter + , DATETIME_TRUNC(bookings_source_src_26000.ds, year) AS booking__ds__year , EXTRACT(year FROM bookings_source_src_26000.ds) AS booking__ds__extract_year , EXTRACT(quarter FROM bookings_source_src_26000.ds) AS booking__ds__extract_quarter , EXTRACT(month FROM bookings_source_src_26000.ds) AS booking__ds__extract_month , EXTRACT(day FROM bookings_source_src_26000.ds) AS booking__ds__extract_day , IF(EXTRACT(dayofweek FROM bookings_source_src_26000.ds) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_26000.ds) - 1) AS booking__ds__extract_dow , EXTRACT(dayofyear FROM bookings_source_src_26000.ds) AS booking__ds__extract_doy - , DATE_TRUNC(bookings_source_src_26000.ds_partitioned, day) AS booking__ds_partitioned__day - , DATE_TRUNC(bookings_source_src_26000.ds_partitioned, isoweek) AS booking__ds_partitioned__week - , DATE_TRUNC(bookings_source_src_26000.ds_partitioned, month) AS booking__ds_partitioned__month - , DATE_TRUNC(bookings_source_src_26000.ds_partitioned, quarter) AS booking__ds_partitioned__quarter - , DATE_TRUNC(bookings_source_src_26000.ds_partitioned, year) AS booking__ds_partitioned__year + , DATETIME_TRUNC(bookings_source_src_26000.ds_partitioned, day) AS booking__ds_partitioned__day + , DATETIME_TRUNC(bookings_source_src_26000.ds_partitioned, isoweek) AS booking__ds_partitioned__week + , DATETIME_TRUNC(bookings_source_src_26000.ds_partitioned, month) AS booking__ds_partitioned__month + , DATETIME_TRUNC(bookings_source_src_26000.ds_partitioned, quarter) AS booking__ds_partitioned__quarter + , DATETIME_TRUNC(bookings_source_src_26000.ds_partitioned, year) AS booking__ds_partitioned__year , EXTRACT(year FROM bookings_source_src_26000.ds_partitioned) AS booking__ds_partitioned__extract_year , EXTRACT(quarter FROM bookings_source_src_26000.ds_partitioned) AS booking__ds_partitioned__extract_quarter , EXTRACT(month FROM bookings_source_src_26000.ds_partitioned) AS booking__ds_partitioned__extract_month , EXTRACT(day FROM bookings_source_src_26000.ds_partitioned) AS booking__ds_partitioned__extract_day , IF(EXTRACT(dayofweek FROM bookings_source_src_26000.ds_partitioned) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_26000.ds_partitioned) - 1) AS booking__ds_partitioned__extract_dow , EXTRACT(dayofyear FROM bookings_source_src_26000.ds_partitioned) AS booking__ds_partitioned__extract_doy - , DATE_TRUNC(bookings_source_src_26000.paid_at, day) AS booking__paid_at__day - , DATE_TRUNC(bookings_source_src_26000.paid_at, isoweek) AS booking__paid_at__week - , DATE_TRUNC(bookings_source_src_26000.paid_at, month) AS booking__paid_at__month - , DATE_TRUNC(bookings_source_src_26000.paid_at, quarter) AS booking__paid_at__quarter - , DATE_TRUNC(bookings_source_src_26000.paid_at, year) AS booking__paid_at__year + , DATETIME_TRUNC(bookings_source_src_26000.paid_at, day) AS booking__paid_at__day + , DATETIME_TRUNC(bookings_source_src_26000.paid_at, isoweek) AS booking__paid_at__week + , DATETIME_TRUNC(bookings_source_src_26000.paid_at, month) AS booking__paid_at__month + , DATETIME_TRUNC(bookings_source_src_26000.paid_at, quarter) AS booking__paid_at__quarter + , DATETIME_TRUNC(bookings_source_src_26000.paid_at, year) AS booking__paid_at__year , EXTRACT(year FROM bookings_source_src_26000.paid_at) AS booking__paid_at__extract_year , EXTRACT(quarter FROM bookings_source_src_26000.paid_at) AS booking__paid_at__extract_quarter , EXTRACT(month FROM bookings_source_src_26000.paid_at) AS booking__paid_at__extract_month @@ -293,10 +293,10 @@ FROM ( -- Read Elements From Semantic Model 'listings' SELECT listings_src_26000.active_from AS window_start__day - , DATE_TRUNC(listings_src_26000.active_from, isoweek) AS window_start__week - , DATE_TRUNC(listings_src_26000.active_from, month) AS window_start__month - , DATE_TRUNC(listings_src_26000.active_from, quarter) AS window_start__quarter - , DATE_TRUNC(listings_src_26000.active_from, year) AS window_start__year + , DATETIME_TRUNC(listings_src_26000.active_from, isoweek) AS window_start__week + , DATETIME_TRUNC(listings_src_26000.active_from, month) AS window_start__month + , DATETIME_TRUNC(listings_src_26000.active_from, quarter) AS window_start__quarter + , DATETIME_TRUNC(listings_src_26000.active_from, year) AS window_start__year , EXTRACT(year FROM listings_src_26000.active_from) AS window_start__extract_year , EXTRACT(quarter FROM listings_src_26000.active_from) AS window_start__extract_quarter , EXTRACT(month FROM listings_src_26000.active_from) AS window_start__extract_month @@ -304,10 +304,10 @@ FROM ( , IF(EXTRACT(dayofweek FROM listings_src_26000.active_from) = 1, 7, EXTRACT(dayofweek FROM listings_src_26000.active_from) - 1) AS window_start__extract_dow , EXTRACT(dayofyear FROM listings_src_26000.active_from) AS window_start__extract_doy , listings_src_26000.active_to AS window_end__day - , DATE_TRUNC(listings_src_26000.active_to, isoweek) AS window_end__week - , DATE_TRUNC(listings_src_26000.active_to, month) AS window_end__month - , DATE_TRUNC(listings_src_26000.active_to, quarter) AS window_end__quarter - , DATE_TRUNC(listings_src_26000.active_to, year) AS window_end__year + , DATETIME_TRUNC(listings_src_26000.active_to, isoweek) AS window_end__week + , DATETIME_TRUNC(listings_src_26000.active_to, month) AS window_end__month + , DATETIME_TRUNC(listings_src_26000.active_to, quarter) AS window_end__quarter + , DATETIME_TRUNC(listings_src_26000.active_to, year) AS window_end__year , EXTRACT(year FROM listings_src_26000.active_to) AS window_end__extract_year , EXTRACT(quarter FROM listings_src_26000.active_to) AS window_end__extract_quarter , EXTRACT(month FROM listings_src_26000.active_to) AS window_end__extract_month @@ -318,10 +318,10 @@ FROM ( , listings_src_26000.is_lux , listings_src_26000.capacity , listings_src_26000.active_from AS listing__window_start__day - , DATE_TRUNC(listings_src_26000.active_from, isoweek) AS listing__window_start__week - , DATE_TRUNC(listings_src_26000.active_from, month) AS listing__window_start__month - , DATE_TRUNC(listings_src_26000.active_from, quarter) AS listing__window_start__quarter - , DATE_TRUNC(listings_src_26000.active_from, year) AS listing__window_start__year + , DATETIME_TRUNC(listings_src_26000.active_from, isoweek) AS listing__window_start__week + , DATETIME_TRUNC(listings_src_26000.active_from, month) AS listing__window_start__month + , DATETIME_TRUNC(listings_src_26000.active_from, quarter) AS listing__window_start__quarter + , DATETIME_TRUNC(listings_src_26000.active_from, year) AS listing__window_start__year , EXTRACT(year FROM listings_src_26000.active_from) AS listing__window_start__extract_year , EXTRACT(quarter FROM listings_src_26000.active_from) AS listing__window_start__extract_quarter , EXTRACT(month FROM listings_src_26000.active_from) AS listing__window_start__extract_month @@ -329,10 +329,10 @@ FROM ( , IF(EXTRACT(dayofweek FROM listings_src_26000.active_from) = 1, 7, EXTRACT(dayofweek FROM listings_src_26000.active_from) - 1) AS listing__window_start__extract_dow , EXTRACT(dayofyear FROM listings_src_26000.active_from) AS listing__window_start__extract_doy , listings_src_26000.active_to AS listing__window_end__day - , DATE_TRUNC(listings_src_26000.active_to, isoweek) AS listing__window_end__week - , DATE_TRUNC(listings_src_26000.active_to, month) AS listing__window_end__month - , DATE_TRUNC(listings_src_26000.active_to, quarter) AS listing__window_end__quarter - , DATE_TRUNC(listings_src_26000.active_to, year) AS listing__window_end__year + , DATETIME_TRUNC(listings_src_26000.active_to, isoweek) AS listing__window_end__week + , DATETIME_TRUNC(listings_src_26000.active_to, month) AS listing__window_end__month + , DATETIME_TRUNC(listings_src_26000.active_to, quarter) AS listing__window_end__quarter + , DATETIME_TRUNC(listings_src_26000.active_to, year) AS listing__window_end__year , EXTRACT(year FROM listings_src_26000.active_to) AS listing__window_end__extract_year , EXTRACT(quarter FROM listings_src_26000.active_to) AS listing__window_end__extract_quarter , EXTRACT(month FROM listings_src_26000.active_to) AS listing__window_end__extract_month @@ -404,11 +404,11 @@ FROM ( FROM ( -- Read Elements From Semantic Model 'users_latest' SELECT - DATE_TRUNC(users_latest_src_26000.ds, day) AS ds__day - , DATE_TRUNC(users_latest_src_26000.ds, isoweek) AS ds__week - , DATE_TRUNC(users_latest_src_26000.ds, month) AS ds__month - , DATE_TRUNC(users_latest_src_26000.ds, quarter) AS ds__quarter - , DATE_TRUNC(users_latest_src_26000.ds, year) AS ds__year + DATETIME_TRUNC(users_latest_src_26000.ds, day) AS ds__day + , DATETIME_TRUNC(users_latest_src_26000.ds, isoweek) AS ds__week + , DATETIME_TRUNC(users_latest_src_26000.ds, month) AS ds__month + , DATETIME_TRUNC(users_latest_src_26000.ds, quarter) AS ds__quarter + , DATETIME_TRUNC(users_latest_src_26000.ds, year) AS ds__year , EXTRACT(year FROM users_latest_src_26000.ds) AS ds__extract_year , EXTRACT(quarter FROM users_latest_src_26000.ds) AS ds__extract_quarter , EXTRACT(month FROM users_latest_src_26000.ds) AS ds__extract_month @@ -416,11 +416,11 @@ FROM ( , IF(EXTRACT(dayofweek FROM users_latest_src_26000.ds) = 1, 7, EXTRACT(dayofweek FROM users_latest_src_26000.ds) - 1) AS ds__extract_dow , EXTRACT(dayofyear FROM users_latest_src_26000.ds) AS ds__extract_doy , users_latest_src_26000.home_state_latest - , DATE_TRUNC(users_latest_src_26000.ds, day) AS user__ds__day - , DATE_TRUNC(users_latest_src_26000.ds, isoweek) AS user__ds__week - , DATE_TRUNC(users_latest_src_26000.ds, month) AS user__ds__month - , DATE_TRUNC(users_latest_src_26000.ds, quarter) AS user__ds__quarter - , DATE_TRUNC(users_latest_src_26000.ds, year) AS user__ds__year + , DATETIME_TRUNC(users_latest_src_26000.ds, day) AS user__ds__day + , DATETIME_TRUNC(users_latest_src_26000.ds, isoweek) AS user__ds__week + , DATETIME_TRUNC(users_latest_src_26000.ds, month) AS user__ds__month + , DATETIME_TRUNC(users_latest_src_26000.ds, quarter) AS user__ds__quarter + , DATETIME_TRUNC(users_latest_src_26000.ds, year) AS user__ds__year , EXTRACT(year FROM users_latest_src_26000.ds) AS user__ds__extract_year , EXTRACT(quarter FROM users_latest_src_26000.ds) AS user__ds__extract_quarter , EXTRACT(month FROM users_latest_src_26000.ds) AS user__ds__extract_month diff --git a/tests_metricflow/snapshots/test_query_rendering.py/SqlQueryPlan/BigQuery/test_multi_hop_through_scd_dimension__plan0_optimized.sql b/tests_metricflow/snapshots/test_query_rendering.py/SqlQueryPlan/BigQuery/test_multi_hop_through_scd_dimension__plan0_optimized.sql index 248c18b4b9..67bcab18a7 100644 --- a/tests_metricflow/snapshots/test_query_rendering.py/SqlQueryPlan/BigQuery/test_multi_hop_through_scd_dimension__plan0_optimized.sql +++ b/tests_metricflow/snapshots/test_query_rendering.py/SqlQueryPlan/BigQuery/test_multi_hop_through_scd_dimension__plan0_optimized.sql @@ -11,7 +11,7 @@ FROM ( -- Metric Time Dimension 'ds' -- Pass Only Elements: ['bookings', 'metric_time__day', 'listing'] SELECT - DATE_TRUNC(ds, day) AS metric_time__day + DATETIME_TRUNC(ds, day) AS metric_time__day , listing_id AS listing , 1 AS bookings FROM ***************************.fct_bookings bookings_source_src_26000 diff --git a/tests_metricflow/snapshots/test_query_rendering.py/SqlQueryPlan/BigQuery/test_multi_hop_to_scd_dimension__plan0.sql b/tests_metricflow/snapshots/test_query_rendering.py/SqlQueryPlan/BigQuery/test_multi_hop_to_scd_dimension__plan0.sql index be997a21c5..226137f009 100644 --- a/tests_metricflow/snapshots/test_query_rendering.py/SqlQueryPlan/BigQuery/test_multi_hop_to_scd_dimension__plan0.sql +++ b/tests_metricflow/snapshots/test_query_rendering.py/SqlQueryPlan/BigQuery/test_multi_hop_to_scd_dimension__plan0.sql @@ -135,33 +135,33 @@ FROM ( , bookings_source_src_26000.booking_value AS average_booking_value , bookings_source_src_26000.booking_value AS booking_payments , bookings_source_src_26000.is_instant - , DATE_TRUNC(bookings_source_src_26000.ds, day) AS ds__day - , DATE_TRUNC(bookings_source_src_26000.ds, isoweek) AS ds__week - , DATE_TRUNC(bookings_source_src_26000.ds, month) AS ds__month - , DATE_TRUNC(bookings_source_src_26000.ds, quarter) AS ds__quarter - , DATE_TRUNC(bookings_source_src_26000.ds, year) AS ds__year + , DATETIME_TRUNC(bookings_source_src_26000.ds, day) AS ds__day + , DATETIME_TRUNC(bookings_source_src_26000.ds, isoweek) AS ds__week + , DATETIME_TRUNC(bookings_source_src_26000.ds, month) AS ds__month + , DATETIME_TRUNC(bookings_source_src_26000.ds, quarter) AS ds__quarter + , DATETIME_TRUNC(bookings_source_src_26000.ds, year) AS ds__year , EXTRACT(year FROM bookings_source_src_26000.ds) AS ds__extract_year , EXTRACT(quarter FROM bookings_source_src_26000.ds) AS ds__extract_quarter , EXTRACT(month FROM bookings_source_src_26000.ds) AS ds__extract_month , EXTRACT(day FROM bookings_source_src_26000.ds) AS ds__extract_day , IF(EXTRACT(dayofweek FROM bookings_source_src_26000.ds) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_26000.ds) - 1) AS ds__extract_dow , EXTRACT(dayofyear FROM bookings_source_src_26000.ds) AS ds__extract_doy - , DATE_TRUNC(bookings_source_src_26000.ds_partitioned, day) AS ds_partitioned__day - , DATE_TRUNC(bookings_source_src_26000.ds_partitioned, isoweek) AS ds_partitioned__week - , DATE_TRUNC(bookings_source_src_26000.ds_partitioned, month) AS ds_partitioned__month - , DATE_TRUNC(bookings_source_src_26000.ds_partitioned, quarter) AS ds_partitioned__quarter - , DATE_TRUNC(bookings_source_src_26000.ds_partitioned, year) AS ds_partitioned__year + , DATETIME_TRUNC(bookings_source_src_26000.ds_partitioned, day) AS ds_partitioned__day + , DATETIME_TRUNC(bookings_source_src_26000.ds_partitioned, isoweek) AS ds_partitioned__week + , DATETIME_TRUNC(bookings_source_src_26000.ds_partitioned, month) AS ds_partitioned__month + , DATETIME_TRUNC(bookings_source_src_26000.ds_partitioned, quarter) AS ds_partitioned__quarter + , DATETIME_TRUNC(bookings_source_src_26000.ds_partitioned, year) AS ds_partitioned__year , EXTRACT(year FROM bookings_source_src_26000.ds_partitioned) AS ds_partitioned__extract_year , EXTRACT(quarter FROM bookings_source_src_26000.ds_partitioned) AS ds_partitioned__extract_quarter , EXTRACT(month FROM bookings_source_src_26000.ds_partitioned) AS ds_partitioned__extract_month , EXTRACT(day FROM bookings_source_src_26000.ds_partitioned) AS ds_partitioned__extract_day , IF(EXTRACT(dayofweek FROM bookings_source_src_26000.ds_partitioned) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_26000.ds_partitioned) - 1) AS ds_partitioned__extract_dow , EXTRACT(dayofyear FROM bookings_source_src_26000.ds_partitioned) AS ds_partitioned__extract_doy - , DATE_TRUNC(bookings_source_src_26000.paid_at, day) AS paid_at__day - , DATE_TRUNC(bookings_source_src_26000.paid_at, isoweek) AS paid_at__week - , DATE_TRUNC(bookings_source_src_26000.paid_at, month) AS paid_at__month - , DATE_TRUNC(bookings_source_src_26000.paid_at, quarter) AS paid_at__quarter - , DATE_TRUNC(bookings_source_src_26000.paid_at, year) AS paid_at__year + , DATETIME_TRUNC(bookings_source_src_26000.paid_at, day) AS paid_at__day + , DATETIME_TRUNC(bookings_source_src_26000.paid_at, isoweek) AS paid_at__week + , DATETIME_TRUNC(bookings_source_src_26000.paid_at, month) AS paid_at__month + , DATETIME_TRUNC(bookings_source_src_26000.paid_at, quarter) AS paid_at__quarter + , DATETIME_TRUNC(bookings_source_src_26000.paid_at, year) AS paid_at__year , EXTRACT(year FROM bookings_source_src_26000.paid_at) AS paid_at__extract_year , EXTRACT(quarter FROM bookings_source_src_26000.paid_at) AS paid_at__extract_quarter , EXTRACT(month FROM bookings_source_src_26000.paid_at) AS paid_at__extract_month @@ -169,33 +169,33 @@ FROM ( , IF(EXTRACT(dayofweek FROM bookings_source_src_26000.paid_at) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_26000.paid_at) - 1) AS paid_at__extract_dow , EXTRACT(dayofyear FROM bookings_source_src_26000.paid_at) AS paid_at__extract_doy , bookings_source_src_26000.is_instant AS booking__is_instant - , DATE_TRUNC(bookings_source_src_26000.ds, day) AS booking__ds__day - , DATE_TRUNC(bookings_source_src_26000.ds, isoweek) AS booking__ds__week - , DATE_TRUNC(bookings_source_src_26000.ds, month) AS booking__ds__month - , DATE_TRUNC(bookings_source_src_26000.ds, quarter) AS booking__ds__quarter - , DATE_TRUNC(bookings_source_src_26000.ds, year) AS booking__ds__year + , DATETIME_TRUNC(bookings_source_src_26000.ds, day) AS booking__ds__day + , DATETIME_TRUNC(bookings_source_src_26000.ds, isoweek) AS booking__ds__week + , DATETIME_TRUNC(bookings_source_src_26000.ds, month) AS booking__ds__month + , DATETIME_TRUNC(bookings_source_src_26000.ds, quarter) AS booking__ds__quarter + , DATETIME_TRUNC(bookings_source_src_26000.ds, year) AS booking__ds__year , EXTRACT(year FROM bookings_source_src_26000.ds) AS booking__ds__extract_year , EXTRACT(quarter FROM bookings_source_src_26000.ds) AS booking__ds__extract_quarter , EXTRACT(month FROM bookings_source_src_26000.ds) AS booking__ds__extract_month , EXTRACT(day FROM bookings_source_src_26000.ds) AS booking__ds__extract_day , IF(EXTRACT(dayofweek FROM bookings_source_src_26000.ds) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_26000.ds) - 1) AS booking__ds__extract_dow , EXTRACT(dayofyear FROM bookings_source_src_26000.ds) AS booking__ds__extract_doy - , DATE_TRUNC(bookings_source_src_26000.ds_partitioned, day) AS booking__ds_partitioned__day - , DATE_TRUNC(bookings_source_src_26000.ds_partitioned, isoweek) AS booking__ds_partitioned__week - , DATE_TRUNC(bookings_source_src_26000.ds_partitioned, month) AS booking__ds_partitioned__month - , DATE_TRUNC(bookings_source_src_26000.ds_partitioned, quarter) AS booking__ds_partitioned__quarter - , DATE_TRUNC(bookings_source_src_26000.ds_partitioned, year) AS booking__ds_partitioned__year + , DATETIME_TRUNC(bookings_source_src_26000.ds_partitioned, day) AS booking__ds_partitioned__day + , DATETIME_TRUNC(bookings_source_src_26000.ds_partitioned, isoweek) AS booking__ds_partitioned__week + , DATETIME_TRUNC(bookings_source_src_26000.ds_partitioned, month) AS booking__ds_partitioned__month + , DATETIME_TRUNC(bookings_source_src_26000.ds_partitioned, quarter) AS booking__ds_partitioned__quarter + , DATETIME_TRUNC(bookings_source_src_26000.ds_partitioned, year) AS booking__ds_partitioned__year , EXTRACT(year FROM bookings_source_src_26000.ds_partitioned) AS booking__ds_partitioned__extract_year , EXTRACT(quarter FROM bookings_source_src_26000.ds_partitioned) AS booking__ds_partitioned__extract_quarter , EXTRACT(month FROM bookings_source_src_26000.ds_partitioned) AS booking__ds_partitioned__extract_month , EXTRACT(day FROM bookings_source_src_26000.ds_partitioned) AS booking__ds_partitioned__extract_day , IF(EXTRACT(dayofweek FROM bookings_source_src_26000.ds_partitioned) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_26000.ds_partitioned) - 1) AS booking__ds_partitioned__extract_dow , EXTRACT(dayofyear FROM bookings_source_src_26000.ds_partitioned) AS booking__ds_partitioned__extract_doy - , DATE_TRUNC(bookings_source_src_26000.paid_at, day) AS booking__paid_at__day - , DATE_TRUNC(bookings_source_src_26000.paid_at, isoweek) AS booking__paid_at__week - , DATE_TRUNC(bookings_source_src_26000.paid_at, month) AS booking__paid_at__month - , DATE_TRUNC(bookings_source_src_26000.paid_at, quarter) AS booking__paid_at__quarter - , DATE_TRUNC(bookings_source_src_26000.paid_at, year) AS booking__paid_at__year + , DATETIME_TRUNC(bookings_source_src_26000.paid_at, day) AS booking__paid_at__day + , DATETIME_TRUNC(bookings_source_src_26000.paid_at, isoweek) AS booking__paid_at__week + , DATETIME_TRUNC(bookings_source_src_26000.paid_at, month) AS booking__paid_at__month + , DATETIME_TRUNC(bookings_source_src_26000.paid_at, quarter) AS booking__paid_at__quarter + , DATETIME_TRUNC(bookings_source_src_26000.paid_at, year) AS booking__paid_at__year , EXTRACT(year FROM bookings_source_src_26000.paid_at) AS booking__paid_at__extract_year , EXTRACT(quarter FROM bookings_source_src_26000.paid_at) AS booking__paid_at__extract_quarter , EXTRACT(month FROM bookings_source_src_26000.paid_at) AS booking__paid_at__extract_month @@ -360,10 +360,10 @@ FROM ( -- Read Elements From Semantic Model 'lux_listings' SELECT lux_listings_src_26000.valid_from AS window_start__day - , DATE_TRUNC(lux_listings_src_26000.valid_from, isoweek) AS window_start__week - , DATE_TRUNC(lux_listings_src_26000.valid_from, month) AS window_start__month - , DATE_TRUNC(lux_listings_src_26000.valid_from, quarter) AS window_start__quarter - , DATE_TRUNC(lux_listings_src_26000.valid_from, year) AS window_start__year + , DATETIME_TRUNC(lux_listings_src_26000.valid_from, isoweek) AS window_start__week + , DATETIME_TRUNC(lux_listings_src_26000.valid_from, month) AS window_start__month + , DATETIME_TRUNC(lux_listings_src_26000.valid_from, quarter) AS window_start__quarter + , DATETIME_TRUNC(lux_listings_src_26000.valid_from, year) AS window_start__year , EXTRACT(year FROM lux_listings_src_26000.valid_from) AS window_start__extract_year , EXTRACT(quarter FROM lux_listings_src_26000.valid_from) AS window_start__extract_quarter , EXTRACT(month FROM lux_listings_src_26000.valid_from) AS window_start__extract_month @@ -371,10 +371,10 @@ FROM ( , IF(EXTRACT(dayofweek FROM lux_listings_src_26000.valid_from) = 1, 7, EXTRACT(dayofweek FROM lux_listings_src_26000.valid_from) - 1) AS window_start__extract_dow , EXTRACT(dayofyear FROM lux_listings_src_26000.valid_from) AS window_start__extract_doy , lux_listings_src_26000.valid_to AS window_end__day - , DATE_TRUNC(lux_listings_src_26000.valid_to, isoweek) AS window_end__week - , DATE_TRUNC(lux_listings_src_26000.valid_to, month) AS window_end__month - , DATE_TRUNC(lux_listings_src_26000.valid_to, quarter) AS window_end__quarter - , DATE_TRUNC(lux_listings_src_26000.valid_to, year) AS window_end__year + , DATETIME_TRUNC(lux_listings_src_26000.valid_to, isoweek) AS window_end__week + , DATETIME_TRUNC(lux_listings_src_26000.valid_to, month) AS window_end__month + , DATETIME_TRUNC(lux_listings_src_26000.valid_to, quarter) AS window_end__quarter + , DATETIME_TRUNC(lux_listings_src_26000.valid_to, year) AS window_end__year , EXTRACT(year FROM lux_listings_src_26000.valid_to) AS window_end__extract_year , EXTRACT(quarter FROM lux_listings_src_26000.valid_to) AS window_end__extract_quarter , EXTRACT(month FROM lux_listings_src_26000.valid_to) AS window_end__extract_month @@ -383,10 +383,10 @@ FROM ( , EXTRACT(dayofyear FROM lux_listings_src_26000.valid_to) AS window_end__extract_doy , lux_listings_src_26000.is_confirmed_lux , lux_listings_src_26000.valid_from AS lux_listing__window_start__day - , DATE_TRUNC(lux_listings_src_26000.valid_from, isoweek) AS lux_listing__window_start__week - , DATE_TRUNC(lux_listings_src_26000.valid_from, month) AS lux_listing__window_start__month - , DATE_TRUNC(lux_listings_src_26000.valid_from, quarter) AS lux_listing__window_start__quarter - , DATE_TRUNC(lux_listings_src_26000.valid_from, year) AS lux_listing__window_start__year + , DATETIME_TRUNC(lux_listings_src_26000.valid_from, isoweek) AS lux_listing__window_start__week + , DATETIME_TRUNC(lux_listings_src_26000.valid_from, month) AS lux_listing__window_start__month + , DATETIME_TRUNC(lux_listings_src_26000.valid_from, quarter) AS lux_listing__window_start__quarter + , DATETIME_TRUNC(lux_listings_src_26000.valid_from, year) AS lux_listing__window_start__year , EXTRACT(year FROM lux_listings_src_26000.valid_from) AS lux_listing__window_start__extract_year , EXTRACT(quarter FROM lux_listings_src_26000.valid_from) AS lux_listing__window_start__extract_quarter , EXTRACT(month FROM lux_listings_src_26000.valid_from) AS lux_listing__window_start__extract_month @@ -394,10 +394,10 @@ FROM ( , IF(EXTRACT(dayofweek FROM lux_listings_src_26000.valid_from) = 1, 7, EXTRACT(dayofweek FROM lux_listings_src_26000.valid_from) - 1) AS lux_listing__window_start__extract_dow , EXTRACT(dayofyear FROM lux_listings_src_26000.valid_from) AS lux_listing__window_start__extract_doy , lux_listings_src_26000.valid_to AS lux_listing__window_end__day - , DATE_TRUNC(lux_listings_src_26000.valid_to, isoweek) AS lux_listing__window_end__week - , DATE_TRUNC(lux_listings_src_26000.valid_to, month) AS lux_listing__window_end__month - , DATE_TRUNC(lux_listings_src_26000.valid_to, quarter) AS lux_listing__window_end__quarter - , DATE_TRUNC(lux_listings_src_26000.valid_to, year) AS lux_listing__window_end__year + , DATETIME_TRUNC(lux_listings_src_26000.valid_to, isoweek) AS lux_listing__window_end__week + , DATETIME_TRUNC(lux_listings_src_26000.valid_to, month) AS lux_listing__window_end__month + , DATETIME_TRUNC(lux_listings_src_26000.valid_to, quarter) AS lux_listing__window_end__quarter + , DATETIME_TRUNC(lux_listings_src_26000.valid_to, year) AS lux_listing__window_end__year , EXTRACT(year FROM lux_listings_src_26000.valid_to) AS lux_listing__window_end__extract_year , EXTRACT(quarter FROM lux_listings_src_26000.valid_to) AS lux_listing__window_end__extract_quarter , EXTRACT(month FROM lux_listings_src_26000.valid_to) AS lux_listing__window_end__extract_month diff --git a/tests_metricflow/snapshots/test_query_rendering.py/SqlQueryPlan/BigQuery/test_multi_hop_to_scd_dimension__plan0_optimized.sql b/tests_metricflow/snapshots/test_query_rendering.py/SqlQueryPlan/BigQuery/test_multi_hop_to_scd_dimension__plan0_optimized.sql index b88923cacf..21466bbf9f 100644 --- a/tests_metricflow/snapshots/test_query_rendering.py/SqlQueryPlan/BigQuery/test_multi_hop_to_scd_dimension__plan0_optimized.sql +++ b/tests_metricflow/snapshots/test_query_rendering.py/SqlQueryPlan/BigQuery/test_multi_hop_to_scd_dimension__plan0_optimized.sql @@ -11,7 +11,7 @@ FROM ( -- Metric Time Dimension 'ds' -- Pass Only Elements: ['bookings', 'metric_time__day', 'listing'] SELECT - DATE_TRUNC(ds, day) AS metric_time__day + DATETIME_TRUNC(ds, day) AS metric_time__day , listing_id AS listing , 1 AS bookings FROM ***************************.fct_bookings bookings_source_src_26000 diff --git a/tests_metricflow/snapshots/test_query_rendering.py/SqlQueryPlan/BigQuery/test_multihop_node__plan0.sql b/tests_metricflow/snapshots/test_query_rendering.py/SqlQueryPlan/BigQuery/test_multihop_node__plan0.sql index 7ba2ceaf5f..f5dab65f4f 100644 --- a/tests_metricflow/snapshots/test_query_rendering.py/SqlQueryPlan/BigQuery/test_multihop_node__plan0.sql +++ b/tests_metricflow/snapshots/test_query_rendering.py/SqlQueryPlan/BigQuery/test_multihop_node__plan0.sql @@ -92,22 +92,22 @@ FROM ( -- Read Elements From Semantic Model 'account_month_txns' SELECT account_month_txns_src_22000.txn_count - , DATE_TRUNC(account_month_txns_src_22000.ds_partitioned, day) AS ds_partitioned__day - , DATE_TRUNC(account_month_txns_src_22000.ds_partitioned, isoweek) AS ds_partitioned__week - , DATE_TRUNC(account_month_txns_src_22000.ds_partitioned, month) AS ds_partitioned__month - , DATE_TRUNC(account_month_txns_src_22000.ds_partitioned, quarter) AS ds_partitioned__quarter - , DATE_TRUNC(account_month_txns_src_22000.ds_partitioned, year) AS ds_partitioned__year + , DATETIME_TRUNC(account_month_txns_src_22000.ds_partitioned, day) AS ds_partitioned__day + , DATETIME_TRUNC(account_month_txns_src_22000.ds_partitioned, isoweek) AS ds_partitioned__week + , DATETIME_TRUNC(account_month_txns_src_22000.ds_partitioned, month) AS ds_partitioned__month + , DATETIME_TRUNC(account_month_txns_src_22000.ds_partitioned, quarter) AS ds_partitioned__quarter + , DATETIME_TRUNC(account_month_txns_src_22000.ds_partitioned, year) AS ds_partitioned__year , EXTRACT(year FROM account_month_txns_src_22000.ds_partitioned) AS ds_partitioned__extract_year , EXTRACT(quarter FROM account_month_txns_src_22000.ds_partitioned) AS ds_partitioned__extract_quarter , EXTRACT(month FROM account_month_txns_src_22000.ds_partitioned) AS ds_partitioned__extract_month , EXTRACT(day FROM account_month_txns_src_22000.ds_partitioned) AS ds_partitioned__extract_day , IF(EXTRACT(dayofweek FROM account_month_txns_src_22000.ds_partitioned) = 1, 7, EXTRACT(dayofweek FROM account_month_txns_src_22000.ds_partitioned) - 1) AS ds_partitioned__extract_dow , EXTRACT(dayofyear FROM account_month_txns_src_22000.ds_partitioned) AS ds_partitioned__extract_doy - , DATE_TRUNC(account_month_txns_src_22000.ds, day) AS ds__day - , DATE_TRUNC(account_month_txns_src_22000.ds, isoweek) AS ds__week - , DATE_TRUNC(account_month_txns_src_22000.ds, month) AS ds__month - , DATE_TRUNC(account_month_txns_src_22000.ds, quarter) AS ds__quarter - , DATE_TRUNC(account_month_txns_src_22000.ds, year) AS ds__year + , DATETIME_TRUNC(account_month_txns_src_22000.ds, day) AS ds__day + , DATETIME_TRUNC(account_month_txns_src_22000.ds, isoweek) AS ds__week + , DATETIME_TRUNC(account_month_txns_src_22000.ds, month) AS ds__month + , DATETIME_TRUNC(account_month_txns_src_22000.ds, quarter) AS ds__quarter + , DATETIME_TRUNC(account_month_txns_src_22000.ds, year) AS ds__year , EXTRACT(year FROM account_month_txns_src_22000.ds) AS ds__extract_year , EXTRACT(quarter FROM account_month_txns_src_22000.ds) AS ds__extract_quarter , EXTRACT(month FROM account_month_txns_src_22000.ds) AS ds__extract_month @@ -115,22 +115,22 @@ FROM ( , IF(EXTRACT(dayofweek FROM account_month_txns_src_22000.ds) = 1, 7, EXTRACT(dayofweek FROM account_month_txns_src_22000.ds) - 1) AS ds__extract_dow , EXTRACT(dayofyear FROM account_month_txns_src_22000.ds) AS ds__extract_doy , account_month_txns_src_22000.account_month - , DATE_TRUNC(account_month_txns_src_22000.ds_partitioned, day) AS account_id__ds_partitioned__day - , DATE_TRUNC(account_month_txns_src_22000.ds_partitioned, isoweek) AS account_id__ds_partitioned__week - , DATE_TRUNC(account_month_txns_src_22000.ds_partitioned, month) AS account_id__ds_partitioned__month - , DATE_TRUNC(account_month_txns_src_22000.ds_partitioned, quarter) AS account_id__ds_partitioned__quarter - , DATE_TRUNC(account_month_txns_src_22000.ds_partitioned, year) AS account_id__ds_partitioned__year + , DATETIME_TRUNC(account_month_txns_src_22000.ds_partitioned, day) AS account_id__ds_partitioned__day + , DATETIME_TRUNC(account_month_txns_src_22000.ds_partitioned, isoweek) AS account_id__ds_partitioned__week + , DATETIME_TRUNC(account_month_txns_src_22000.ds_partitioned, month) AS account_id__ds_partitioned__month + , DATETIME_TRUNC(account_month_txns_src_22000.ds_partitioned, quarter) AS account_id__ds_partitioned__quarter + , DATETIME_TRUNC(account_month_txns_src_22000.ds_partitioned, year) AS account_id__ds_partitioned__year , EXTRACT(year FROM account_month_txns_src_22000.ds_partitioned) AS account_id__ds_partitioned__extract_year , EXTRACT(quarter FROM account_month_txns_src_22000.ds_partitioned) AS account_id__ds_partitioned__extract_quarter , EXTRACT(month FROM account_month_txns_src_22000.ds_partitioned) AS account_id__ds_partitioned__extract_month , EXTRACT(day FROM account_month_txns_src_22000.ds_partitioned) AS account_id__ds_partitioned__extract_day , IF(EXTRACT(dayofweek FROM account_month_txns_src_22000.ds_partitioned) = 1, 7, EXTRACT(dayofweek FROM account_month_txns_src_22000.ds_partitioned) - 1) AS account_id__ds_partitioned__extract_dow , EXTRACT(dayofyear FROM account_month_txns_src_22000.ds_partitioned) AS account_id__ds_partitioned__extract_doy - , DATE_TRUNC(account_month_txns_src_22000.ds, day) AS account_id__ds__day - , DATE_TRUNC(account_month_txns_src_22000.ds, isoweek) AS account_id__ds__week - , DATE_TRUNC(account_month_txns_src_22000.ds, month) AS account_id__ds__month - , DATE_TRUNC(account_month_txns_src_22000.ds, quarter) AS account_id__ds__quarter - , DATE_TRUNC(account_month_txns_src_22000.ds, year) AS account_id__ds__year + , DATETIME_TRUNC(account_month_txns_src_22000.ds, day) AS account_id__ds__day + , DATETIME_TRUNC(account_month_txns_src_22000.ds, isoweek) AS account_id__ds__week + , DATETIME_TRUNC(account_month_txns_src_22000.ds, month) AS account_id__ds__month + , DATETIME_TRUNC(account_month_txns_src_22000.ds, quarter) AS account_id__ds__quarter + , DATETIME_TRUNC(account_month_txns_src_22000.ds, year) AS account_id__ds__year , EXTRACT(year FROM account_month_txns_src_22000.ds) AS account_id__ds__extract_year , EXTRACT(quarter FROM account_month_txns_src_22000.ds) AS account_id__ds__extract_quarter , EXTRACT(month FROM account_month_txns_src_22000.ds) AS account_id__ds__extract_month @@ -290,11 +290,11 @@ FROM ( SELECT account_id || customer_id AS account_customer_combos , bridge_table_src_22000.extra_dim - , DATE_TRUNC(bridge_table_src_22000.ds_partitioned, day) AS ds_partitioned__day - , DATE_TRUNC(bridge_table_src_22000.ds_partitioned, isoweek) AS ds_partitioned__week - , DATE_TRUNC(bridge_table_src_22000.ds_partitioned, month) AS ds_partitioned__month - , DATE_TRUNC(bridge_table_src_22000.ds_partitioned, quarter) AS ds_partitioned__quarter - , DATE_TRUNC(bridge_table_src_22000.ds_partitioned, year) AS ds_partitioned__year + , DATETIME_TRUNC(bridge_table_src_22000.ds_partitioned, day) AS ds_partitioned__day + , DATETIME_TRUNC(bridge_table_src_22000.ds_partitioned, isoweek) AS ds_partitioned__week + , DATETIME_TRUNC(bridge_table_src_22000.ds_partitioned, month) AS ds_partitioned__month + , DATETIME_TRUNC(bridge_table_src_22000.ds_partitioned, quarter) AS ds_partitioned__quarter + , DATETIME_TRUNC(bridge_table_src_22000.ds_partitioned, year) AS ds_partitioned__year , EXTRACT(year FROM bridge_table_src_22000.ds_partitioned) AS ds_partitioned__extract_year , EXTRACT(quarter FROM bridge_table_src_22000.ds_partitioned) AS ds_partitioned__extract_quarter , EXTRACT(month FROM bridge_table_src_22000.ds_partitioned) AS ds_partitioned__extract_month @@ -302,11 +302,11 @@ FROM ( , IF(EXTRACT(dayofweek FROM bridge_table_src_22000.ds_partitioned) = 1, 7, EXTRACT(dayofweek FROM bridge_table_src_22000.ds_partitioned) - 1) AS ds_partitioned__extract_dow , EXTRACT(dayofyear FROM bridge_table_src_22000.ds_partitioned) AS ds_partitioned__extract_doy , bridge_table_src_22000.extra_dim AS account_id__extra_dim - , DATE_TRUNC(bridge_table_src_22000.ds_partitioned, day) AS account_id__ds_partitioned__day - , DATE_TRUNC(bridge_table_src_22000.ds_partitioned, isoweek) AS account_id__ds_partitioned__week - , DATE_TRUNC(bridge_table_src_22000.ds_partitioned, month) AS account_id__ds_partitioned__month - , DATE_TRUNC(bridge_table_src_22000.ds_partitioned, quarter) AS account_id__ds_partitioned__quarter - , DATE_TRUNC(bridge_table_src_22000.ds_partitioned, year) AS account_id__ds_partitioned__year + , DATETIME_TRUNC(bridge_table_src_22000.ds_partitioned, day) AS account_id__ds_partitioned__day + , DATETIME_TRUNC(bridge_table_src_22000.ds_partitioned, isoweek) AS account_id__ds_partitioned__week + , DATETIME_TRUNC(bridge_table_src_22000.ds_partitioned, month) AS account_id__ds_partitioned__month + , DATETIME_TRUNC(bridge_table_src_22000.ds_partitioned, quarter) AS account_id__ds_partitioned__quarter + , DATETIME_TRUNC(bridge_table_src_22000.ds_partitioned, year) AS account_id__ds_partitioned__year , EXTRACT(year FROM bridge_table_src_22000.ds_partitioned) AS account_id__ds_partitioned__extract_year , EXTRACT(quarter FROM bridge_table_src_22000.ds_partitioned) AS account_id__ds_partitioned__extract_quarter , EXTRACT(month FROM bridge_table_src_22000.ds_partitioned) AS account_id__ds_partitioned__extract_month @@ -314,11 +314,11 @@ FROM ( , IF(EXTRACT(dayofweek FROM bridge_table_src_22000.ds_partitioned) = 1, 7, EXTRACT(dayofweek FROM bridge_table_src_22000.ds_partitioned) - 1) AS account_id__ds_partitioned__extract_dow , EXTRACT(dayofyear FROM bridge_table_src_22000.ds_partitioned) AS account_id__ds_partitioned__extract_doy , bridge_table_src_22000.extra_dim AS bridge_account__extra_dim - , DATE_TRUNC(bridge_table_src_22000.ds_partitioned, day) AS bridge_account__ds_partitioned__day - , DATE_TRUNC(bridge_table_src_22000.ds_partitioned, isoweek) AS bridge_account__ds_partitioned__week - , DATE_TRUNC(bridge_table_src_22000.ds_partitioned, month) AS bridge_account__ds_partitioned__month - , DATE_TRUNC(bridge_table_src_22000.ds_partitioned, quarter) AS bridge_account__ds_partitioned__quarter - , DATE_TRUNC(bridge_table_src_22000.ds_partitioned, year) AS bridge_account__ds_partitioned__year + , DATETIME_TRUNC(bridge_table_src_22000.ds_partitioned, day) AS bridge_account__ds_partitioned__day + , DATETIME_TRUNC(bridge_table_src_22000.ds_partitioned, isoweek) AS bridge_account__ds_partitioned__week + , DATETIME_TRUNC(bridge_table_src_22000.ds_partitioned, month) AS bridge_account__ds_partitioned__month + , DATETIME_TRUNC(bridge_table_src_22000.ds_partitioned, quarter) AS bridge_account__ds_partitioned__quarter + , DATETIME_TRUNC(bridge_table_src_22000.ds_partitioned, year) AS bridge_account__ds_partitioned__year , EXTRACT(year FROM bridge_table_src_22000.ds_partitioned) AS bridge_account__ds_partitioned__extract_year , EXTRACT(quarter FROM bridge_table_src_22000.ds_partitioned) AS bridge_account__ds_partitioned__extract_quarter , EXTRACT(month FROM bridge_table_src_22000.ds_partitioned) AS bridge_account__ds_partitioned__extract_month @@ -461,11 +461,11 @@ FROM ( 1 AS customers , customer_table_src_22000.customer_name , customer_table_src_22000.customer_atomic_weight - , DATE_TRUNC(customer_table_src_22000.ds_partitioned, day) AS ds_partitioned__day - , DATE_TRUNC(customer_table_src_22000.ds_partitioned, isoweek) AS ds_partitioned__week - , DATE_TRUNC(customer_table_src_22000.ds_partitioned, month) AS ds_partitioned__month - , DATE_TRUNC(customer_table_src_22000.ds_partitioned, quarter) AS ds_partitioned__quarter - , DATE_TRUNC(customer_table_src_22000.ds_partitioned, year) AS ds_partitioned__year + , DATETIME_TRUNC(customer_table_src_22000.ds_partitioned, day) AS ds_partitioned__day + , DATETIME_TRUNC(customer_table_src_22000.ds_partitioned, isoweek) AS ds_partitioned__week + , DATETIME_TRUNC(customer_table_src_22000.ds_partitioned, month) AS ds_partitioned__month + , DATETIME_TRUNC(customer_table_src_22000.ds_partitioned, quarter) AS ds_partitioned__quarter + , DATETIME_TRUNC(customer_table_src_22000.ds_partitioned, year) AS ds_partitioned__year , EXTRACT(year FROM customer_table_src_22000.ds_partitioned) AS ds_partitioned__extract_year , EXTRACT(quarter FROM customer_table_src_22000.ds_partitioned) AS ds_partitioned__extract_quarter , EXTRACT(month FROM customer_table_src_22000.ds_partitioned) AS ds_partitioned__extract_month @@ -474,11 +474,11 @@ FROM ( , EXTRACT(dayofyear FROM customer_table_src_22000.ds_partitioned) AS ds_partitioned__extract_doy , customer_table_src_22000.customer_name AS customer_id__customer_name , customer_table_src_22000.customer_atomic_weight AS customer_id__customer_atomic_weight - , DATE_TRUNC(customer_table_src_22000.ds_partitioned, day) AS customer_id__ds_partitioned__day - , DATE_TRUNC(customer_table_src_22000.ds_partitioned, isoweek) AS customer_id__ds_partitioned__week - , DATE_TRUNC(customer_table_src_22000.ds_partitioned, month) AS customer_id__ds_partitioned__month - , DATE_TRUNC(customer_table_src_22000.ds_partitioned, quarter) AS customer_id__ds_partitioned__quarter - , DATE_TRUNC(customer_table_src_22000.ds_partitioned, year) AS customer_id__ds_partitioned__year + , DATETIME_TRUNC(customer_table_src_22000.ds_partitioned, day) AS customer_id__ds_partitioned__day + , DATETIME_TRUNC(customer_table_src_22000.ds_partitioned, isoweek) AS customer_id__ds_partitioned__week + , DATETIME_TRUNC(customer_table_src_22000.ds_partitioned, month) AS customer_id__ds_partitioned__month + , DATETIME_TRUNC(customer_table_src_22000.ds_partitioned, quarter) AS customer_id__ds_partitioned__quarter + , DATETIME_TRUNC(customer_table_src_22000.ds_partitioned, year) AS customer_id__ds_partitioned__year , EXTRACT(year FROM customer_table_src_22000.ds_partitioned) AS customer_id__ds_partitioned__extract_year , EXTRACT(quarter FROM customer_table_src_22000.ds_partitioned) AS customer_id__ds_partitioned__extract_quarter , EXTRACT(month FROM customer_table_src_22000.ds_partitioned) AS customer_id__ds_partitioned__extract_month diff --git a/tests_metricflow/snapshots/test_query_rendering.py/SqlQueryPlan/BigQuery/test_multihop_node__plan0_optimized.sql b/tests_metricflow/snapshots/test_query_rendering.py/SqlQueryPlan/BigQuery/test_multihop_node__plan0_optimized.sql index c7ff024aa7..0127e7cc74 100644 --- a/tests_metricflow/snapshots/test_query_rendering.py/SqlQueryPlan/BigQuery/test_multihop_node__plan0_optimized.sql +++ b/tests_metricflow/snapshots/test_query_rendering.py/SqlQueryPlan/BigQuery/test_multihop_node__plan0_optimized.sql @@ -10,7 +10,7 @@ LEFT OUTER JOIN ( -- Join Standard Outputs -- Pass Only Elements: ['customer_id__customer_name', 'ds_partitioned__day', 'account_id'] SELECT - DATE_TRUNC(bridge_table_src_22000.ds_partitioned, day) AS ds_partitioned__day + DATETIME_TRUNC(bridge_table_src_22000.ds_partitioned, day) AS ds_partitioned__day , bridge_table_src_22000.account_id AS account_id , customer_table_src_22000.customer_name AS customer_id__customer_name FROM ***************************.bridge_table bridge_table_src_22000 @@ -20,14 +20,14 @@ LEFT OUTER JOIN ( ( bridge_table_src_22000.customer_id = customer_table_src_22000.customer_id ) AND ( - DATE_TRUNC(bridge_table_src_22000.ds_partitioned, day) = DATE_TRUNC(customer_table_src_22000.ds_partitioned, day) + DATETIME_TRUNC(bridge_table_src_22000.ds_partitioned, day) = DATETIME_TRUNC(customer_table_src_22000.ds_partitioned, day) ) ) subq_27 ON ( account_month_txns_src_22000.account_id = subq_27.account_id ) AND ( - DATE_TRUNC(account_month_txns_src_22000.ds_partitioned, day) = subq_27.ds_partitioned__day + DATETIME_TRUNC(account_month_txns_src_22000.ds_partitioned, day) = subq_27.ds_partitioned__day ) GROUP BY account_id__customer_id__customer_name diff --git a/tests_metricflow/snapshots/test_query_rendering.py/SqlQueryPlan/BigQuery/test_multiple_metrics_no_dimensions__plan0.sql b/tests_metricflow/snapshots/test_query_rendering.py/SqlQueryPlan/BigQuery/test_multiple_metrics_no_dimensions__plan0.sql index 2b45ad5314..5745eb82cc 100644 --- a/tests_metricflow/snapshots/test_query_rendering.py/SqlQueryPlan/BigQuery/test_multiple_metrics_no_dimensions__plan0.sql +++ b/tests_metricflow/snapshots/test_query_rendering.py/SqlQueryPlan/BigQuery/test_multiple_metrics_no_dimensions__plan0.sql @@ -234,33 +234,33 @@ FROM ( , bookings_source_src_28000.booking_value AS approximate_continuous_booking_value_p99 , bookings_source_src_28000.booking_value AS approximate_discrete_booking_value_p99 , bookings_source_src_28000.is_instant - , DATE_TRUNC(bookings_source_src_28000.ds, day) AS ds__day - , DATE_TRUNC(bookings_source_src_28000.ds, isoweek) AS ds__week - , DATE_TRUNC(bookings_source_src_28000.ds, month) AS ds__month - , DATE_TRUNC(bookings_source_src_28000.ds, quarter) AS ds__quarter - , DATE_TRUNC(bookings_source_src_28000.ds, year) AS ds__year + , DATETIME_TRUNC(bookings_source_src_28000.ds, day) AS ds__day + , DATETIME_TRUNC(bookings_source_src_28000.ds, isoweek) AS ds__week + , DATETIME_TRUNC(bookings_source_src_28000.ds, month) AS ds__month + , DATETIME_TRUNC(bookings_source_src_28000.ds, quarter) AS ds__quarter + , DATETIME_TRUNC(bookings_source_src_28000.ds, year) AS ds__year , EXTRACT(year FROM bookings_source_src_28000.ds) AS ds__extract_year , EXTRACT(quarter FROM bookings_source_src_28000.ds) AS ds__extract_quarter , EXTRACT(month FROM bookings_source_src_28000.ds) AS ds__extract_month , EXTRACT(day FROM bookings_source_src_28000.ds) AS ds__extract_day , IF(EXTRACT(dayofweek FROM bookings_source_src_28000.ds) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_28000.ds) - 1) AS ds__extract_dow , EXTRACT(dayofyear FROM bookings_source_src_28000.ds) AS ds__extract_doy - , DATE_TRUNC(bookings_source_src_28000.ds_partitioned, day) AS ds_partitioned__day - , DATE_TRUNC(bookings_source_src_28000.ds_partitioned, isoweek) AS ds_partitioned__week - , DATE_TRUNC(bookings_source_src_28000.ds_partitioned, month) AS ds_partitioned__month - , DATE_TRUNC(bookings_source_src_28000.ds_partitioned, quarter) AS ds_partitioned__quarter - , DATE_TRUNC(bookings_source_src_28000.ds_partitioned, year) AS ds_partitioned__year + , DATETIME_TRUNC(bookings_source_src_28000.ds_partitioned, day) AS ds_partitioned__day + , DATETIME_TRUNC(bookings_source_src_28000.ds_partitioned, isoweek) AS ds_partitioned__week + , DATETIME_TRUNC(bookings_source_src_28000.ds_partitioned, month) AS ds_partitioned__month + , DATETIME_TRUNC(bookings_source_src_28000.ds_partitioned, quarter) AS ds_partitioned__quarter + , DATETIME_TRUNC(bookings_source_src_28000.ds_partitioned, year) AS ds_partitioned__year , EXTRACT(year FROM bookings_source_src_28000.ds_partitioned) AS ds_partitioned__extract_year , EXTRACT(quarter FROM bookings_source_src_28000.ds_partitioned) AS ds_partitioned__extract_quarter , EXTRACT(month FROM bookings_source_src_28000.ds_partitioned) AS ds_partitioned__extract_month , EXTRACT(day FROM bookings_source_src_28000.ds_partitioned) AS ds_partitioned__extract_day , IF(EXTRACT(dayofweek FROM bookings_source_src_28000.ds_partitioned) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_28000.ds_partitioned) - 1) AS ds_partitioned__extract_dow , EXTRACT(dayofyear FROM bookings_source_src_28000.ds_partitioned) AS ds_partitioned__extract_doy - , DATE_TRUNC(bookings_source_src_28000.paid_at, day) AS paid_at__day - , DATE_TRUNC(bookings_source_src_28000.paid_at, isoweek) AS paid_at__week - , DATE_TRUNC(bookings_source_src_28000.paid_at, month) AS paid_at__month - , DATE_TRUNC(bookings_source_src_28000.paid_at, quarter) AS paid_at__quarter - , DATE_TRUNC(bookings_source_src_28000.paid_at, year) AS paid_at__year + , DATETIME_TRUNC(bookings_source_src_28000.paid_at, day) AS paid_at__day + , DATETIME_TRUNC(bookings_source_src_28000.paid_at, isoweek) AS paid_at__week + , DATETIME_TRUNC(bookings_source_src_28000.paid_at, month) AS paid_at__month + , DATETIME_TRUNC(bookings_source_src_28000.paid_at, quarter) AS paid_at__quarter + , DATETIME_TRUNC(bookings_source_src_28000.paid_at, year) AS paid_at__year , EXTRACT(year FROM bookings_source_src_28000.paid_at) AS paid_at__extract_year , EXTRACT(quarter FROM bookings_source_src_28000.paid_at) AS paid_at__extract_quarter , EXTRACT(month FROM bookings_source_src_28000.paid_at) AS paid_at__extract_month @@ -268,33 +268,33 @@ FROM ( , IF(EXTRACT(dayofweek FROM bookings_source_src_28000.paid_at) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_28000.paid_at) - 1) AS paid_at__extract_dow , EXTRACT(dayofyear FROM bookings_source_src_28000.paid_at) AS paid_at__extract_doy , bookings_source_src_28000.is_instant AS booking__is_instant - , DATE_TRUNC(bookings_source_src_28000.ds, day) AS booking__ds__day - , DATE_TRUNC(bookings_source_src_28000.ds, isoweek) AS booking__ds__week - , DATE_TRUNC(bookings_source_src_28000.ds, month) AS booking__ds__month - , DATE_TRUNC(bookings_source_src_28000.ds, quarter) AS booking__ds__quarter - , DATE_TRUNC(bookings_source_src_28000.ds, year) AS booking__ds__year + , DATETIME_TRUNC(bookings_source_src_28000.ds, day) AS booking__ds__day + , DATETIME_TRUNC(bookings_source_src_28000.ds, isoweek) AS booking__ds__week + , DATETIME_TRUNC(bookings_source_src_28000.ds, month) AS booking__ds__month + , DATETIME_TRUNC(bookings_source_src_28000.ds, quarter) AS booking__ds__quarter + , DATETIME_TRUNC(bookings_source_src_28000.ds, year) AS booking__ds__year , EXTRACT(year FROM bookings_source_src_28000.ds) AS booking__ds__extract_year , EXTRACT(quarter FROM bookings_source_src_28000.ds) AS booking__ds__extract_quarter , EXTRACT(month FROM bookings_source_src_28000.ds) AS booking__ds__extract_month , EXTRACT(day FROM bookings_source_src_28000.ds) AS booking__ds__extract_day , IF(EXTRACT(dayofweek FROM bookings_source_src_28000.ds) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_28000.ds) - 1) AS booking__ds__extract_dow , EXTRACT(dayofyear FROM bookings_source_src_28000.ds) AS booking__ds__extract_doy - , DATE_TRUNC(bookings_source_src_28000.ds_partitioned, day) AS booking__ds_partitioned__day - , DATE_TRUNC(bookings_source_src_28000.ds_partitioned, isoweek) AS booking__ds_partitioned__week - , DATE_TRUNC(bookings_source_src_28000.ds_partitioned, month) AS booking__ds_partitioned__month - , DATE_TRUNC(bookings_source_src_28000.ds_partitioned, quarter) AS booking__ds_partitioned__quarter - , DATE_TRUNC(bookings_source_src_28000.ds_partitioned, year) AS booking__ds_partitioned__year + , DATETIME_TRUNC(bookings_source_src_28000.ds_partitioned, day) AS booking__ds_partitioned__day + , DATETIME_TRUNC(bookings_source_src_28000.ds_partitioned, isoweek) AS booking__ds_partitioned__week + , DATETIME_TRUNC(bookings_source_src_28000.ds_partitioned, month) AS booking__ds_partitioned__month + , DATETIME_TRUNC(bookings_source_src_28000.ds_partitioned, quarter) AS booking__ds_partitioned__quarter + , DATETIME_TRUNC(bookings_source_src_28000.ds_partitioned, year) AS booking__ds_partitioned__year , EXTRACT(year FROM bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__extract_year , EXTRACT(quarter FROM bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__extract_quarter , EXTRACT(month FROM bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__extract_month , EXTRACT(day FROM bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__extract_day , IF(EXTRACT(dayofweek FROM bookings_source_src_28000.ds_partitioned) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_28000.ds_partitioned) - 1) AS booking__ds_partitioned__extract_dow , EXTRACT(dayofyear FROM bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__extract_doy - , DATE_TRUNC(bookings_source_src_28000.paid_at, day) AS booking__paid_at__day - , DATE_TRUNC(bookings_source_src_28000.paid_at, isoweek) AS booking__paid_at__week - , DATE_TRUNC(bookings_source_src_28000.paid_at, month) AS booking__paid_at__month - , DATE_TRUNC(bookings_source_src_28000.paid_at, quarter) AS booking__paid_at__quarter - , DATE_TRUNC(bookings_source_src_28000.paid_at, year) AS booking__paid_at__year + , DATETIME_TRUNC(bookings_source_src_28000.paid_at, day) AS booking__paid_at__day + , DATETIME_TRUNC(bookings_source_src_28000.paid_at, isoweek) AS booking__paid_at__week + , DATETIME_TRUNC(bookings_source_src_28000.paid_at, month) AS booking__paid_at__month + , DATETIME_TRUNC(bookings_source_src_28000.paid_at, quarter) AS booking__paid_at__quarter + , DATETIME_TRUNC(bookings_source_src_28000.paid_at, year) AS booking__paid_at__year , EXTRACT(year FROM bookings_source_src_28000.paid_at) AS booking__paid_at__extract_year , EXTRACT(quarter FROM bookings_source_src_28000.paid_at) AS booking__paid_at__extract_quarter , EXTRACT(month FROM bookings_source_src_28000.paid_at) AS booking__paid_at__extract_month @@ -473,22 +473,22 @@ CROSS JOIN ( 1 AS listings , listings_latest_src_28000.capacity AS largest_listing , listings_latest_src_28000.capacity AS smallest_listing - , DATE_TRUNC(listings_latest_src_28000.created_at, day) AS ds__day - , DATE_TRUNC(listings_latest_src_28000.created_at, isoweek) AS ds__week - , DATE_TRUNC(listings_latest_src_28000.created_at, month) AS ds__month - , DATE_TRUNC(listings_latest_src_28000.created_at, quarter) AS ds__quarter - , DATE_TRUNC(listings_latest_src_28000.created_at, year) AS ds__year + , DATETIME_TRUNC(listings_latest_src_28000.created_at, day) AS ds__day + , DATETIME_TRUNC(listings_latest_src_28000.created_at, isoweek) AS ds__week + , DATETIME_TRUNC(listings_latest_src_28000.created_at, month) AS ds__month + , DATETIME_TRUNC(listings_latest_src_28000.created_at, quarter) AS ds__quarter + , DATETIME_TRUNC(listings_latest_src_28000.created_at, year) AS ds__year , EXTRACT(year FROM listings_latest_src_28000.created_at) AS ds__extract_year , EXTRACT(quarter FROM listings_latest_src_28000.created_at) AS ds__extract_quarter , EXTRACT(month FROM listings_latest_src_28000.created_at) AS ds__extract_month , EXTRACT(day FROM listings_latest_src_28000.created_at) AS ds__extract_day , IF(EXTRACT(dayofweek FROM listings_latest_src_28000.created_at) = 1, 7, EXTRACT(dayofweek FROM listings_latest_src_28000.created_at) - 1) AS ds__extract_dow , EXTRACT(dayofyear FROM listings_latest_src_28000.created_at) AS ds__extract_doy - , DATE_TRUNC(listings_latest_src_28000.created_at, day) AS created_at__day - , DATE_TRUNC(listings_latest_src_28000.created_at, isoweek) AS created_at__week - , DATE_TRUNC(listings_latest_src_28000.created_at, month) AS created_at__month - , DATE_TRUNC(listings_latest_src_28000.created_at, quarter) AS created_at__quarter - , DATE_TRUNC(listings_latest_src_28000.created_at, year) AS created_at__year + , DATETIME_TRUNC(listings_latest_src_28000.created_at, day) AS created_at__day + , DATETIME_TRUNC(listings_latest_src_28000.created_at, isoweek) AS created_at__week + , DATETIME_TRUNC(listings_latest_src_28000.created_at, month) AS created_at__month + , DATETIME_TRUNC(listings_latest_src_28000.created_at, quarter) AS created_at__quarter + , DATETIME_TRUNC(listings_latest_src_28000.created_at, year) AS created_at__year , EXTRACT(year FROM listings_latest_src_28000.created_at) AS created_at__extract_year , EXTRACT(quarter FROM listings_latest_src_28000.created_at) AS created_at__extract_quarter , EXTRACT(month FROM listings_latest_src_28000.created_at) AS created_at__extract_month @@ -498,22 +498,22 @@ CROSS JOIN ( , listings_latest_src_28000.country AS country_latest , listings_latest_src_28000.is_lux AS is_lux_latest , listings_latest_src_28000.capacity AS capacity_latest - , DATE_TRUNC(listings_latest_src_28000.created_at, day) AS listing__ds__day - , DATE_TRUNC(listings_latest_src_28000.created_at, isoweek) AS listing__ds__week - , DATE_TRUNC(listings_latest_src_28000.created_at, month) AS listing__ds__month - , DATE_TRUNC(listings_latest_src_28000.created_at, quarter) AS listing__ds__quarter - , DATE_TRUNC(listings_latest_src_28000.created_at, year) AS listing__ds__year + , DATETIME_TRUNC(listings_latest_src_28000.created_at, day) AS listing__ds__day + , DATETIME_TRUNC(listings_latest_src_28000.created_at, isoweek) AS listing__ds__week + , DATETIME_TRUNC(listings_latest_src_28000.created_at, month) AS listing__ds__month + , DATETIME_TRUNC(listings_latest_src_28000.created_at, quarter) AS listing__ds__quarter + , DATETIME_TRUNC(listings_latest_src_28000.created_at, year) AS listing__ds__year , EXTRACT(year FROM listings_latest_src_28000.created_at) AS listing__ds__extract_year , EXTRACT(quarter FROM listings_latest_src_28000.created_at) AS listing__ds__extract_quarter , EXTRACT(month FROM listings_latest_src_28000.created_at) AS listing__ds__extract_month , EXTRACT(day FROM listings_latest_src_28000.created_at) AS listing__ds__extract_day , IF(EXTRACT(dayofweek FROM listings_latest_src_28000.created_at) = 1, 7, EXTRACT(dayofweek FROM listings_latest_src_28000.created_at) - 1) AS listing__ds__extract_dow , EXTRACT(dayofyear FROM listings_latest_src_28000.created_at) AS listing__ds__extract_doy - , DATE_TRUNC(listings_latest_src_28000.created_at, day) AS listing__created_at__day - , DATE_TRUNC(listings_latest_src_28000.created_at, isoweek) AS listing__created_at__week - , DATE_TRUNC(listings_latest_src_28000.created_at, month) AS listing__created_at__month - , DATE_TRUNC(listings_latest_src_28000.created_at, quarter) AS listing__created_at__quarter - , DATE_TRUNC(listings_latest_src_28000.created_at, year) AS listing__created_at__year + , DATETIME_TRUNC(listings_latest_src_28000.created_at, day) AS listing__created_at__day + , DATETIME_TRUNC(listings_latest_src_28000.created_at, isoweek) AS listing__created_at__week + , DATETIME_TRUNC(listings_latest_src_28000.created_at, month) AS listing__created_at__month + , DATETIME_TRUNC(listings_latest_src_28000.created_at, quarter) AS listing__created_at__quarter + , DATETIME_TRUNC(listings_latest_src_28000.created_at, year) AS listing__created_at__year , EXTRACT(year FROM listings_latest_src_28000.created_at) AS listing__created_at__extract_year , EXTRACT(quarter FROM listings_latest_src_28000.created_at) AS listing__created_at__extract_quarter , EXTRACT(month FROM listings_latest_src_28000.created_at) AS listing__created_at__extract_month diff --git a/tests_metricflow/snapshots/test_query_rendering.py/SqlQueryPlan/BigQuery/test_multiple_metrics_no_dimensions__plan0_optimized.sql b/tests_metricflow/snapshots/test_query_rendering.py/SqlQueryPlan/BigQuery/test_multiple_metrics_no_dimensions__plan0_optimized.sql index 99fc769d87..3e5b869717 100644 --- a/tests_metricflow/snapshots/test_query_rendering.py/SqlQueryPlan/BigQuery/test_multiple_metrics_no_dimensions__plan0_optimized.sql +++ b/tests_metricflow/snapshots/test_query_rendering.py/SqlQueryPlan/BigQuery/test_multiple_metrics_no_dimensions__plan0_optimized.sql @@ -12,7 +12,7 @@ FROM ( SELECT SUM(1) AS bookings FROM ***************************.fct_bookings bookings_source_src_28000 - WHERE DATE_TRUNC(ds, day) BETWEEN '2020-01-01' AND '2020-01-01' + WHERE DATETIME_TRUNC(ds, day) BETWEEN '2020-01-01' AND '2020-01-01' ) subq_21 CROSS JOIN ( -- Read Elements From Semantic Model 'listings_latest' @@ -24,5 +24,5 @@ CROSS JOIN ( SELECT SUM(1) AS listings FROM ***************************.dim_listings_latest listings_latest_src_28000 - WHERE DATE_TRUNC(created_at, day) BETWEEN '2020-01-01' AND '2020-01-01' + WHERE DATETIME_TRUNC(created_at, day) BETWEEN '2020-01-01' AND '2020-01-01' ) subq_27 diff --git a/tests_metricflow/snapshots/test_query_rendering.py/SqlQueryPlan/BigQuery/test_partitioned_join__plan0.sql b/tests_metricflow/snapshots/test_query_rendering.py/SqlQueryPlan/BigQuery/test_partitioned_join__plan0.sql index 798a5bb663..d846170f03 100644 --- a/tests_metricflow/snapshots/test_query_rendering.py/SqlQueryPlan/BigQuery/test_partitioned_join__plan0.sql +++ b/tests_metricflow/snapshots/test_query_rendering.py/SqlQueryPlan/BigQuery/test_partitioned_join__plan0.sql @@ -94,22 +94,22 @@ FROM ( -- Read Elements From Semantic Model 'id_verifications' SELECT 1 AS identity_verifications - , DATE_TRUNC(id_verifications_src_28000.ds, day) AS ds__day - , DATE_TRUNC(id_verifications_src_28000.ds, isoweek) AS ds__week - , DATE_TRUNC(id_verifications_src_28000.ds, month) AS ds__month - , DATE_TRUNC(id_verifications_src_28000.ds, quarter) AS ds__quarter - , DATE_TRUNC(id_verifications_src_28000.ds, year) AS ds__year + , DATETIME_TRUNC(id_verifications_src_28000.ds, day) AS ds__day + , DATETIME_TRUNC(id_verifications_src_28000.ds, isoweek) AS ds__week + , DATETIME_TRUNC(id_verifications_src_28000.ds, month) AS ds__month + , DATETIME_TRUNC(id_verifications_src_28000.ds, quarter) AS ds__quarter + , DATETIME_TRUNC(id_verifications_src_28000.ds, year) AS ds__year , EXTRACT(year FROM id_verifications_src_28000.ds) AS ds__extract_year , EXTRACT(quarter FROM id_verifications_src_28000.ds) AS ds__extract_quarter , EXTRACT(month FROM id_verifications_src_28000.ds) AS ds__extract_month , EXTRACT(day FROM id_verifications_src_28000.ds) AS ds__extract_day , IF(EXTRACT(dayofweek FROM id_verifications_src_28000.ds) = 1, 7, EXTRACT(dayofweek FROM id_verifications_src_28000.ds) - 1) AS ds__extract_dow , EXTRACT(dayofyear FROM id_verifications_src_28000.ds) AS ds__extract_doy - , DATE_TRUNC(id_verifications_src_28000.ds_partitioned, day) AS ds_partitioned__day - , DATE_TRUNC(id_verifications_src_28000.ds_partitioned, isoweek) AS ds_partitioned__week - , DATE_TRUNC(id_verifications_src_28000.ds_partitioned, month) AS ds_partitioned__month - , DATE_TRUNC(id_verifications_src_28000.ds_partitioned, quarter) AS ds_partitioned__quarter - , DATE_TRUNC(id_verifications_src_28000.ds_partitioned, year) AS ds_partitioned__year + , DATETIME_TRUNC(id_verifications_src_28000.ds_partitioned, day) AS ds_partitioned__day + , DATETIME_TRUNC(id_verifications_src_28000.ds_partitioned, isoweek) AS ds_partitioned__week + , DATETIME_TRUNC(id_verifications_src_28000.ds_partitioned, month) AS ds_partitioned__month + , DATETIME_TRUNC(id_verifications_src_28000.ds_partitioned, quarter) AS ds_partitioned__quarter + , DATETIME_TRUNC(id_verifications_src_28000.ds_partitioned, year) AS ds_partitioned__year , EXTRACT(year FROM id_verifications_src_28000.ds_partitioned) AS ds_partitioned__extract_year , EXTRACT(quarter FROM id_verifications_src_28000.ds_partitioned) AS ds_partitioned__extract_quarter , EXTRACT(month FROM id_verifications_src_28000.ds_partitioned) AS ds_partitioned__extract_month @@ -117,22 +117,22 @@ FROM ( , IF(EXTRACT(dayofweek FROM id_verifications_src_28000.ds_partitioned) = 1, 7, EXTRACT(dayofweek FROM id_verifications_src_28000.ds_partitioned) - 1) AS ds_partitioned__extract_dow , EXTRACT(dayofyear FROM id_verifications_src_28000.ds_partitioned) AS ds_partitioned__extract_doy , id_verifications_src_28000.verification_type - , DATE_TRUNC(id_verifications_src_28000.ds, day) AS verification__ds__day - , DATE_TRUNC(id_verifications_src_28000.ds, isoweek) AS verification__ds__week - , DATE_TRUNC(id_verifications_src_28000.ds, month) AS verification__ds__month - , DATE_TRUNC(id_verifications_src_28000.ds, quarter) AS verification__ds__quarter - , DATE_TRUNC(id_verifications_src_28000.ds, year) AS verification__ds__year + , DATETIME_TRUNC(id_verifications_src_28000.ds, day) AS verification__ds__day + , DATETIME_TRUNC(id_verifications_src_28000.ds, isoweek) AS verification__ds__week + , DATETIME_TRUNC(id_verifications_src_28000.ds, month) AS verification__ds__month + , DATETIME_TRUNC(id_verifications_src_28000.ds, quarter) AS verification__ds__quarter + , DATETIME_TRUNC(id_verifications_src_28000.ds, year) AS verification__ds__year , EXTRACT(year FROM id_verifications_src_28000.ds) AS verification__ds__extract_year , EXTRACT(quarter FROM id_verifications_src_28000.ds) AS verification__ds__extract_quarter , EXTRACT(month FROM id_verifications_src_28000.ds) AS verification__ds__extract_month , EXTRACT(day FROM id_verifications_src_28000.ds) AS verification__ds__extract_day , IF(EXTRACT(dayofweek FROM id_verifications_src_28000.ds) = 1, 7, EXTRACT(dayofweek FROM id_verifications_src_28000.ds) - 1) AS verification__ds__extract_dow , EXTRACT(dayofyear FROM id_verifications_src_28000.ds) AS verification__ds__extract_doy - , DATE_TRUNC(id_verifications_src_28000.ds_partitioned, day) AS verification__ds_partitioned__day - , DATE_TRUNC(id_verifications_src_28000.ds_partitioned, isoweek) AS verification__ds_partitioned__week - , DATE_TRUNC(id_verifications_src_28000.ds_partitioned, month) AS verification__ds_partitioned__month - , DATE_TRUNC(id_verifications_src_28000.ds_partitioned, quarter) AS verification__ds_partitioned__quarter - , DATE_TRUNC(id_verifications_src_28000.ds_partitioned, year) AS verification__ds_partitioned__year + , DATETIME_TRUNC(id_verifications_src_28000.ds_partitioned, day) AS verification__ds_partitioned__day + , DATETIME_TRUNC(id_verifications_src_28000.ds_partitioned, isoweek) AS verification__ds_partitioned__week + , DATETIME_TRUNC(id_verifications_src_28000.ds_partitioned, month) AS verification__ds_partitioned__month + , DATETIME_TRUNC(id_verifications_src_28000.ds_partitioned, quarter) AS verification__ds_partitioned__quarter + , DATETIME_TRUNC(id_verifications_src_28000.ds_partitioned, year) AS verification__ds_partitioned__year , EXTRACT(year FROM id_verifications_src_28000.ds_partitioned) AS verification__ds_partitioned__extract_year , EXTRACT(quarter FROM id_verifications_src_28000.ds_partitioned) AS verification__ds_partitioned__extract_quarter , EXTRACT(month FROM id_verifications_src_28000.ds_partitioned) AS verification__ds_partitioned__extract_month @@ -156,33 +156,33 @@ FROM ( FROM ( -- Read Elements From Semantic Model 'users_ds_source' SELECT - DATE_TRUNC(users_ds_source_src_28000.ds, day) AS ds__day - , DATE_TRUNC(users_ds_source_src_28000.ds, isoweek) AS ds__week - , DATE_TRUNC(users_ds_source_src_28000.ds, month) AS ds__month - , DATE_TRUNC(users_ds_source_src_28000.ds, quarter) AS ds__quarter - , DATE_TRUNC(users_ds_source_src_28000.ds, year) AS ds__year + DATETIME_TRUNC(users_ds_source_src_28000.ds, day) AS ds__day + , DATETIME_TRUNC(users_ds_source_src_28000.ds, isoweek) AS ds__week + , DATETIME_TRUNC(users_ds_source_src_28000.ds, month) AS ds__month + , DATETIME_TRUNC(users_ds_source_src_28000.ds, quarter) AS ds__quarter + , DATETIME_TRUNC(users_ds_source_src_28000.ds, year) AS ds__year , EXTRACT(year FROM users_ds_source_src_28000.ds) AS ds__extract_year , EXTRACT(quarter FROM users_ds_source_src_28000.ds) AS ds__extract_quarter , EXTRACT(month FROM users_ds_source_src_28000.ds) AS ds__extract_month , EXTRACT(day FROM users_ds_source_src_28000.ds) AS ds__extract_day , IF(EXTRACT(dayofweek FROM users_ds_source_src_28000.ds) = 1, 7, EXTRACT(dayofweek FROM users_ds_source_src_28000.ds) - 1) AS ds__extract_dow , EXTRACT(dayofyear FROM users_ds_source_src_28000.ds) AS ds__extract_doy - , DATE_TRUNC(users_ds_source_src_28000.created_at, day) AS created_at__day - , DATE_TRUNC(users_ds_source_src_28000.created_at, isoweek) AS created_at__week - , DATE_TRUNC(users_ds_source_src_28000.created_at, month) AS created_at__month - , DATE_TRUNC(users_ds_source_src_28000.created_at, quarter) AS created_at__quarter - , DATE_TRUNC(users_ds_source_src_28000.created_at, year) AS created_at__year + , DATETIME_TRUNC(users_ds_source_src_28000.created_at, day) AS created_at__day + , DATETIME_TRUNC(users_ds_source_src_28000.created_at, isoweek) AS created_at__week + , DATETIME_TRUNC(users_ds_source_src_28000.created_at, month) AS created_at__month + , DATETIME_TRUNC(users_ds_source_src_28000.created_at, quarter) AS created_at__quarter + , DATETIME_TRUNC(users_ds_source_src_28000.created_at, year) AS created_at__year , EXTRACT(year FROM users_ds_source_src_28000.created_at) AS created_at__extract_year , EXTRACT(quarter FROM users_ds_source_src_28000.created_at) AS created_at__extract_quarter , EXTRACT(month FROM users_ds_source_src_28000.created_at) AS created_at__extract_month , EXTRACT(day FROM users_ds_source_src_28000.created_at) AS created_at__extract_day , IF(EXTRACT(dayofweek FROM users_ds_source_src_28000.created_at) = 1, 7, EXTRACT(dayofweek FROM users_ds_source_src_28000.created_at) - 1) AS created_at__extract_dow , EXTRACT(dayofyear FROM users_ds_source_src_28000.created_at) AS created_at__extract_doy - , DATE_TRUNC(users_ds_source_src_28000.ds_partitioned, day) AS ds_partitioned__day - , DATE_TRUNC(users_ds_source_src_28000.ds_partitioned, isoweek) AS ds_partitioned__week - , DATE_TRUNC(users_ds_source_src_28000.ds_partitioned, month) AS ds_partitioned__month - , DATE_TRUNC(users_ds_source_src_28000.ds_partitioned, quarter) AS ds_partitioned__quarter - , DATE_TRUNC(users_ds_source_src_28000.ds_partitioned, year) AS ds_partitioned__year + , DATETIME_TRUNC(users_ds_source_src_28000.ds_partitioned, day) AS ds_partitioned__day + , DATETIME_TRUNC(users_ds_source_src_28000.ds_partitioned, isoweek) AS ds_partitioned__week + , DATETIME_TRUNC(users_ds_source_src_28000.ds_partitioned, month) AS ds_partitioned__month + , DATETIME_TRUNC(users_ds_source_src_28000.ds_partitioned, quarter) AS ds_partitioned__quarter + , DATETIME_TRUNC(users_ds_source_src_28000.ds_partitioned, year) AS ds_partitioned__year , EXTRACT(year FROM users_ds_source_src_28000.ds_partitioned) AS ds_partitioned__extract_year , EXTRACT(quarter FROM users_ds_source_src_28000.ds_partitioned) AS ds_partitioned__extract_quarter , EXTRACT(month FROM users_ds_source_src_28000.ds_partitioned) AS ds_partitioned__extract_month @@ -190,33 +190,33 @@ FROM ( , IF(EXTRACT(dayofweek FROM users_ds_source_src_28000.ds_partitioned) = 1, 7, EXTRACT(dayofweek FROM users_ds_source_src_28000.ds_partitioned) - 1) AS ds_partitioned__extract_dow , EXTRACT(dayofyear FROM users_ds_source_src_28000.ds_partitioned) AS ds_partitioned__extract_doy , users_ds_source_src_28000.home_state - , DATE_TRUNC(users_ds_source_src_28000.ds, day) AS user__ds__day - , DATE_TRUNC(users_ds_source_src_28000.ds, isoweek) AS user__ds__week - , DATE_TRUNC(users_ds_source_src_28000.ds, month) AS user__ds__month - , DATE_TRUNC(users_ds_source_src_28000.ds, quarter) AS user__ds__quarter - , DATE_TRUNC(users_ds_source_src_28000.ds, year) AS user__ds__year + , DATETIME_TRUNC(users_ds_source_src_28000.ds, day) AS user__ds__day + , DATETIME_TRUNC(users_ds_source_src_28000.ds, isoweek) AS user__ds__week + , DATETIME_TRUNC(users_ds_source_src_28000.ds, month) AS user__ds__month + , DATETIME_TRUNC(users_ds_source_src_28000.ds, quarter) AS user__ds__quarter + , DATETIME_TRUNC(users_ds_source_src_28000.ds, year) AS user__ds__year , EXTRACT(year FROM users_ds_source_src_28000.ds) AS user__ds__extract_year , EXTRACT(quarter FROM users_ds_source_src_28000.ds) AS user__ds__extract_quarter , EXTRACT(month FROM users_ds_source_src_28000.ds) AS user__ds__extract_month , EXTRACT(day FROM users_ds_source_src_28000.ds) AS user__ds__extract_day , IF(EXTRACT(dayofweek FROM users_ds_source_src_28000.ds) = 1, 7, EXTRACT(dayofweek FROM users_ds_source_src_28000.ds) - 1) AS user__ds__extract_dow , EXTRACT(dayofyear FROM users_ds_source_src_28000.ds) AS user__ds__extract_doy - , DATE_TRUNC(users_ds_source_src_28000.created_at, day) AS user__created_at__day - , DATE_TRUNC(users_ds_source_src_28000.created_at, isoweek) AS user__created_at__week - , DATE_TRUNC(users_ds_source_src_28000.created_at, month) AS user__created_at__month - , DATE_TRUNC(users_ds_source_src_28000.created_at, quarter) AS user__created_at__quarter - , DATE_TRUNC(users_ds_source_src_28000.created_at, year) AS user__created_at__year + , DATETIME_TRUNC(users_ds_source_src_28000.created_at, day) AS user__created_at__day + , DATETIME_TRUNC(users_ds_source_src_28000.created_at, isoweek) AS user__created_at__week + , DATETIME_TRUNC(users_ds_source_src_28000.created_at, month) AS user__created_at__month + , DATETIME_TRUNC(users_ds_source_src_28000.created_at, quarter) AS user__created_at__quarter + , DATETIME_TRUNC(users_ds_source_src_28000.created_at, year) AS user__created_at__year , EXTRACT(year FROM users_ds_source_src_28000.created_at) AS user__created_at__extract_year , EXTRACT(quarter FROM users_ds_source_src_28000.created_at) AS user__created_at__extract_quarter , EXTRACT(month FROM users_ds_source_src_28000.created_at) AS user__created_at__extract_month , EXTRACT(day FROM users_ds_source_src_28000.created_at) AS user__created_at__extract_day , IF(EXTRACT(dayofweek FROM users_ds_source_src_28000.created_at) = 1, 7, EXTRACT(dayofweek FROM users_ds_source_src_28000.created_at) - 1) AS user__created_at__extract_dow , EXTRACT(dayofyear FROM users_ds_source_src_28000.created_at) AS user__created_at__extract_doy - , DATE_TRUNC(users_ds_source_src_28000.ds_partitioned, day) AS user__ds_partitioned__day - , DATE_TRUNC(users_ds_source_src_28000.ds_partitioned, isoweek) AS user__ds_partitioned__week - , DATE_TRUNC(users_ds_source_src_28000.ds_partitioned, month) AS user__ds_partitioned__month - , DATE_TRUNC(users_ds_source_src_28000.ds_partitioned, quarter) AS user__ds_partitioned__quarter - , DATE_TRUNC(users_ds_source_src_28000.ds_partitioned, year) AS user__ds_partitioned__year + , DATETIME_TRUNC(users_ds_source_src_28000.ds_partitioned, day) AS user__ds_partitioned__day + , DATETIME_TRUNC(users_ds_source_src_28000.ds_partitioned, isoweek) AS user__ds_partitioned__week + , DATETIME_TRUNC(users_ds_source_src_28000.ds_partitioned, month) AS user__ds_partitioned__month + , DATETIME_TRUNC(users_ds_source_src_28000.ds_partitioned, quarter) AS user__ds_partitioned__quarter + , DATETIME_TRUNC(users_ds_source_src_28000.ds_partitioned, year) AS user__ds_partitioned__year , EXTRACT(year FROM users_ds_source_src_28000.ds_partitioned) AS user__ds_partitioned__extract_year , EXTRACT(quarter FROM users_ds_source_src_28000.ds_partitioned) AS user__ds_partitioned__extract_quarter , EXTRACT(month FROM users_ds_source_src_28000.ds_partitioned) AS user__ds_partitioned__extract_month diff --git a/tests_metricflow/snapshots/test_query_rendering.py/SqlQueryPlan/BigQuery/test_partitioned_join__plan0_optimized.sql b/tests_metricflow/snapshots/test_query_rendering.py/SqlQueryPlan/BigQuery/test_partitioned_join__plan0_optimized.sql index 39e90edf0b..1aa07fc10f 100644 --- a/tests_metricflow/snapshots/test_query_rendering.py/SqlQueryPlan/BigQuery/test_partitioned_join__plan0_optimized.sql +++ b/tests_metricflow/snapshots/test_query_rendering.py/SqlQueryPlan/BigQuery/test_partitioned_join__plan0_optimized.sql @@ -10,7 +10,7 @@ FROM ( -- Metric Time Dimension 'ds' -- Pass Only Elements: ['identity_verifications', 'ds_partitioned__day', 'user'] SELECT - DATE_TRUNC(ds_partitioned, day) AS ds_partitioned__day + DATETIME_TRUNC(ds_partitioned, day) AS ds_partitioned__day , user_id AS user , 1 AS identity_verifications FROM ***************************.fct_id_verifications id_verifications_src_28000 @@ -21,7 +21,7 @@ ON ( subq_10.user = users_ds_source_src_28000.user_id ) AND ( - subq_10.ds_partitioned__day = DATE_TRUNC(users_ds_source_src_28000.ds_partitioned, day) + subq_10.ds_partitioned__day = DATETIME_TRUNC(users_ds_source_src_28000.ds_partitioned, day) ) GROUP BY user__home_state diff --git a/tests_metricflow/snapshots/test_rendered_query.py/str/BigQuery/test_id_enumeration__query.sql b/tests_metricflow/snapshots/test_rendered_query.py/str/BigQuery/test_id_enumeration__query.sql index b2473e6773..e69a2f285e 100644 --- a/tests_metricflow/snapshots/test_rendered_query.py/str/BigQuery/test_id_enumeration__query.sql +++ b/tests_metricflow/snapshots/test_rendered_query.py/str/BigQuery/test_id_enumeration__query.sql @@ -14,7 +14,7 @@ FROM ( -- Metric Time Dimension 'ds' -- Pass Only Elements: ['bookings', 'metric_time__day'] SELECT - DATE_TRUNC(ds, day) AS metric_time__day + DATETIME_TRUNC(ds, day) AS metric_time__day , 1 AS bookings FROM ***************************.fct_bookings bookings_source_src_10000 ) subq_2 @@ -32,7 +32,7 @@ FULL OUTER JOIN ( -- Metric Time Dimension 'ds' -- Pass Only Elements: ['listings', 'metric_time__day'] SELECT - DATE_TRUNC(created_at, day) AS metric_time__day + DATETIME_TRUNC(created_at, day) AS metric_time__day , 1 AS listings FROM ***************************.dim_listings_latest listings_latest_src_10000 ) subq_7 diff --git a/tests_metricflow/snapshots/test_rendered_query.py/str/BigQuery/test_render_query__query0.sql b/tests_metricflow/snapshots/test_rendered_query.py/str/BigQuery/test_render_query__query0.sql index 3f7f50a2d2..a015e030fa 100644 --- a/tests_metricflow/snapshots/test_rendered_query.py/str/BigQuery/test_render_query__query0.sql +++ b/tests_metricflow/snapshots/test_rendered_query.py/str/BigQuery/test_render_query__query0.sql @@ -8,7 +8,7 @@ FROM ( -- Metric Time Dimension 'ds' -- Pass Only Elements: ['bookings', 'metric_time__day'] SELECT - DATE_TRUNC(ds, day) AS metric_time__day + DATETIME_TRUNC(ds, day) AS metric_time__day , 1 AS bookings FROM ***************************.fct_bookings bookings_source_src_10000 ) subq_2 diff --git a/tests_metricflow/snapshots/test_time_spine_join_rendering.py/SqlQueryPlan/BigQuery/test_join_to_time_spine_with_queried_time_constraint__plan0.sql b/tests_metricflow/snapshots/test_time_spine_join_rendering.py/SqlQueryPlan/BigQuery/test_join_to_time_spine_with_queried_time_constraint__plan0.sql index c3ae3901cb..f87c77add1 100644 --- a/tests_metricflow/snapshots/test_time_spine_join_rendering.py/SqlQueryPlan/BigQuery/test_join_to_time_spine_with_queried_time_constraint__plan0.sql +++ b/tests_metricflow/snapshots/test_time_spine_join_rendering.py/SqlQueryPlan/BigQuery/test_join_to_time_spine_with_queried_time_constraint__plan0.sql @@ -249,33 +249,33 @@ FROM ( , bookings_source_src_28000.booking_value AS approximate_continuous_booking_value_p99 , bookings_source_src_28000.booking_value AS approximate_discrete_booking_value_p99 , bookings_source_src_28000.is_instant - , DATE_TRUNC(bookings_source_src_28000.ds, day) AS ds__day - , DATE_TRUNC(bookings_source_src_28000.ds, isoweek) AS ds__week - , DATE_TRUNC(bookings_source_src_28000.ds, month) AS ds__month - , DATE_TRUNC(bookings_source_src_28000.ds, quarter) AS ds__quarter - , DATE_TRUNC(bookings_source_src_28000.ds, year) AS ds__year + , DATETIME_TRUNC(bookings_source_src_28000.ds, day) AS ds__day + , DATETIME_TRUNC(bookings_source_src_28000.ds, isoweek) AS ds__week + , DATETIME_TRUNC(bookings_source_src_28000.ds, month) AS ds__month + , DATETIME_TRUNC(bookings_source_src_28000.ds, quarter) AS ds__quarter + , DATETIME_TRUNC(bookings_source_src_28000.ds, year) AS ds__year , EXTRACT(year FROM bookings_source_src_28000.ds) AS ds__extract_year , EXTRACT(quarter FROM bookings_source_src_28000.ds) AS ds__extract_quarter , EXTRACT(month FROM bookings_source_src_28000.ds) AS ds__extract_month , EXTRACT(day FROM bookings_source_src_28000.ds) AS ds__extract_day , IF(EXTRACT(dayofweek FROM bookings_source_src_28000.ds) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_28000.ds) - 1) AS ds__extract_dow , EXTRACT(dayofyear FROM bookings_source_src_28000.ds) AS ds__extract_doy - , DATE_TRUNC(bookings_source_src_28000.ds_partitioned, day) AS ds_partitioned__day - , DATE_TRUNC(bookings_source_src_28000.ds_partitioned, isoweek) AS ds_partitioned__week - , DATE_TRUNC(bookings_source_src_28000.ds_partitioned, month) AS ds_partitioned__month - , DATE_TRUNC(bookings_source_src_28000.ds_partitioned, quarter) AS ds_partitioned__quarter - , DATE_TRUNC(bookings_source_src_28000.ds_partitioned, year) AS ds_partitioned__year + , DATETIME_TRUNC(bookings_source_src_28000.ds_partitioned, day) AS ds_partitioned__day + , DATETIME_TRUNC(bookings_source_src_28000.ds_partitioned, isoweek) AS ds_partitioned__week + , DATETIME_TRUNC(bookings_source_src_28000.ds_partitioned, month) AS ds_partitioned__month + , DATETIME_TRUNC(bookings_source_src_28000.ds_partitioned, quarter) AS ds_partitioned__quarter + , DATETIME_TRUNC(bookings_source_src_28000.ds_partitioned, year) AS ds_partitioned__year , EXTRACT(year FROM bookings_source_src_28000.ds_partitioned) AS ds_partitioned__extract_year , EXTRACT(quarter FROM bookings_source_src_28000.ds_partitioned) AS ds_partitioned__extract_quarter , EXTRACT(month FROM bookings_source_src_28000.ds_partitioned) AS ds_partitioned__extract_month , EXTRACT(day FROM bookings_source_src_28000.ds_partitioned) AS ds_partitioned__extract_day , IF(EXTRACT(dayofweek FROM bookings_source_src_28000.ds_partitioned) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_28000.ds_partitioned) - 1) AS ds_partitioned__extract_dow , EXTRACT(dayofyear FROM bookings_source_src_28000.ds_partitioned) AS ds_partitioned__extract_doy - , DATE_TRUNC(bookings_source_src_28000.paid_at, day) AS paid_at__day - , DATE_TRUNC(bookings_source_src_28000.paid_at, isoweek) AS paid_at__week - , DATE_TRUNC(bookings_source_src_28000.paid_at, month) AS paid_at__month - , DATE_TRUNC(bookings_source_src_28000.paid_at, quarter) AS paid_at__quarter - , DATE_TRUNC(bookings_source_src_28000.paid_at, year) AS paid_at__year + , DATETIME_TRUNC(bookings_source_src_28000.paid_at, day) AS paid_at__day + , DATETIME_TRUNC(bookings_source_src_28000.paid_at, isoweek) AS paid_at__week + , DATETIME_TRUNC(bookings_source_src_28000.paid_at, month) AS paid_at__month + , DATETIME_TRUNC(bookings_source_src_28000.paid_at, quarter) AS paid_at__quarter + , DATETIME_TRUNC(bookings_source_src_28000.paid_at, year) AS paid_at__year , EXTRACT(year FROM bookings_source_src_28000.paid_at) AS paid_at__extract_year , EXTRACT(quarter FROM bookings_source_src_28000.paid_at) AS paid_at__extract_quarter , EXTRACT(month FROM bookings_source_src_28000.paid_at) AS paid_at__extract_month @@ -283,33 +283,33 @@ FROM ( , IF(EXTRACT(dayofweek FROM bookings_source_src_28000.paid_at) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_28000.paid_at) - 1) AS paid_at__extract_dow , EXTRACT(dayofyear FROM bookings_source_src_28000.paid_at) AS paid_at__extract_doy , bookings_source_src_28000.is_instant AS booking__is_instant - , DATE_TRUNC(bookings_source_src_28000.ds, day) AS booking__ds__day - , DATE_TRUNC(bookings_source_src_28000.ds, isoweek) AS booking__ds__week - , DATE_TRUNC(bookings_source_src_28000.ds, month) AS booking__ds__month - , DATE_TRUNC(bookings_source_src_28000.ds, quarter) AS booking__ds__quarter - , DATE_TRUNC(bookings_source_src_28000.ds, year) AS booking__ds__year + , DATETIME_TRUNC(bookings_source_src_28000.ds, day) AS booking__ds__day + , DATETIME_TRUNC(bookings_source_src_28000.ds, isoweek) AS booking__ds__week + , DATETIME_TRUNC(bookings_source_src_28000.ds, month) AS booking__ds__month + , DATETIME_TRUNC(bookings_source_src_28000.ds, quarter) AS booking__ds__quarter + , DATETIME_TRUNC(bookings_source_src_28000.ds, year) AS booking__ds__year , EXTRACT(year FROM bookings_source_src_28000.ds) AS booking__ds__extract_year , EXTRACT(quarter FROM bookings_source_src_28000.ds) AS booking__ds__extract_quarter , EXTRACT(month FROM bookings_source_src_28000.ds) AS booking__ds__extract_month , EXTRACT(day FROM bookings_source_src_28000.ds) AS booking__ds__extract_day , IF(EXTRACT(dayofweek FROM bookings_source_src_28000.ds) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_28000.ds) - 1) AS booking__ds__extract_dow , EXTRACT(dayofyear FROM bookings_source_src_28000.ds) AS booking__ds__extract_doy - , DATE_TRUNC(bookings_source_src_28000.ds_partitioned, day) AS booking__ds_partitioned__day - , DATE_TRUNC(bookings_source_src_28000.ds_partitioned, isoweek) AS booking__ds_partitioned__week - , DATE_TRUNC(bookings_source_src_28000.ds_partitioned, month) AS booking__ds_partitioned__month - , DATE_TRUNC(bookings_source_src_28000.ds_partitioned, quarter) AS booking__ds_partitioned__quarter - , DATE_TRUNC(bookings_source_src_28000.ds_partitioned, year) AS booking__ds_partitioned__year + , DATETIME_TRUNC(bookings_source_src_28000.ds_partitioned, day) AS booking__ds_partitioned__day + , DATETIME_TRUNC(bookings_source_src_28000.ds_partitioned, isoweek) AS booking__ds_partitioned__week + , DATETIME_TRUNC(bookings_source_src_28000.ds_partitioned, month) AS booking__ds_partitioned__month + , DATETIME_TRUNC(bookings_source_src_28000.ds_partitioned, quarter) AS booking__ds_partitioned__quarter + , DATETIME_TRUNC(bookings_source_src_28000.ds_partitioned, year) AS booking__ds_partitioned__year , EXTRACT(year FROM bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__extract_year , EXTRACT(quarter FROM bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__extract_quarter , EXTRACT(month FROM bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__extract_month , EXTRACT(day FROM bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__extract_day , IF(EXTRACT(dayofweek FROM bookings_source_src_28000.ds_partitioned) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_28000.ds_partitioned) - 1) AS booking__ds_partitioned__extract_dow , EXTRACT(dayofyear FROM bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__extract_doy - , DATE_TRUNC(bookings_source_src_28000.paid_at, day) AS booking__paid_at__day - , DATE_TRUNC(bookings_source_src_28000.paid_at, isoweek) AS booking__paid_at__week - , DATE_TRUNC(bookings_source_src_28000.paid_at, month) AS booking__paid_at__month - , DATE_TRUNC(bookings_source_src_28000.paid_at, quarter) AS booking__paid_at__quarter - , DATE_TRUNC(bookings_source_src_28000.paid_at, year) AS booking__paid_at__year + , DATETIME_TRUNC(bookings_source_src_28000.paid_at, day) AS booking__paid_at__day + , DATETIME_TRUNC(bookings_source_src_28000.paid_at, isoweek) AS booking__paid_at__week + , DATETIME_TRUNC(bookings_source_src_28000.paid_at, month) AS booking__paid_at__month + , DATETIME_TRUNC(bookings_source_src_28000.paid_at, quarter) AS booking__paid_at__quarter + , DATETIME_TRUNC(bookings_source_src_28000.paid_at, year) AS booking__paid_at__year , EXTRACT(year FROM bookings_source_src_28000.paid_at) AS booking__paid_at__extract_year , EXTRACT(quarter FROM bookings_source_src_28000.paid_at) AS booking__paid_at__extract_quarter , EXTRACT(month FROM bookings_source_src_28000.paid_at) AS booking__paid_at__extract_month diff --git a/tests_metricflow/snapshots/test_time_spine_join_rendering.py/SqlQueryPlan/BigQuery/test_join_to_time_spine_with_queried_time_constraint__plan0_optimized.sql b/tests_metricflow/snapshots/test_time_spine_join_rendering.py/SqlQueryPlan/BigQuery/test_join_to_time_spine_with_queried_time_constraint__plan0_optimized.sql index b1c03ce29e..f3b96a4197 100644 --- a/tests_metricflow/snapshots/test_time_spine_join_rendering.py/SqlQueryPlan/BigQuery/test_join_to_time_spine_with_queried_time_constraint__plan0_optimized.sql +++ b/tests_metricflow/snapshots/test_time_spine_join_rendering.py/SqlQueryPlan/BigQuery/test_join_to_time_spine_with_queried_time_constraint__plan0_optimized.sql @@ -26,10 +26,10 @@ FROM ( -- Constrain Time Range to [2020-01-03T00:00:00, 2020-01-05T00:00:00] -- Pass Only Elements: ['bookings', 'metric_time__day'] SELECT - DATE_TRUNC(ds, day) AS metric_time__day + DATETIME_TRUNC(ds, day) AS metric_time__day , 1 AS bookings FROM ***************************.fct_bookings bookings_source_src_28000 - WHERE DATE_TRUNC(ds, day) BETWEEN '2020-01-03' AND '2020-01-05' + WHERE DATETIME_TRUNC(ds, day) BETWEEN '2020-01-03' AND '2020-01-05' ) subq_14 GROUP BY metric_time__day diff --git a/tests_metricflow/snapshots/test_time_spine_join_rendering.py/SqlQueryPlan/BigQuery/test_join_to_time_spine_with_time_constraint__plan0.sql b/tests_metricflow/snapshots/test_time_spine_join_rendering.py/SqlQueryPlan/BigQuery/test_join_to_time_spine_with_time_constraint__plan0.sql index 9bb39f3477..142fcaa898 100644 --- a/tests_metricflow/snapshots/test_time_spine_join_rendering.py/SqlQueryPlan/BigQuery/test_join_to_time_spine_with_time_constraint__plan0.sql +++ b/tests_metricflow/snapshots/test_time_spine_join_rendering.py/SqlQueryPlan/BigQuery/test_join_to_time_spine_with_time_constraint__plan0.sql @@ -229,33 +229,33 @@ FROM ( , bookings_source_src_28000.booking_value AS approximate_continuous_booking_value_p99 , bookings_source_src_28000.booking_value AS approximate_discrete_booking_value_p99 , bookings_source_src_28000.is_instant - , DATE_TRUNC(bookings_source_src_28000.ds, day) AS ds__day - , DATE_TRUNC(bookings_source_src_28000.ds, isoweek) AS ds__week - , DATE_TRUNC(bookings_source_src_28000.ds, month) AS ds__month - , DATE_TRUNC(bookings_source_src_28000.ds, quarter) AS ds__quarter - , DATE_TRUNC(bookings_source_src_28000.ds, year) AS ds__year + , DATETIME_TRUNC(bookings_source_src_28000.ds, day) AS ds__day + , DATETIME_TRUNC(bookings_source_src_28000.ds, isoweek) AS ds__week + , DATETIME_TRUNC(bookings_source_src_28000.ds, month) AS ds__month + , DATETIME_TRUNC(bookings_source_src_28000.ds, quarter) AS ds__quarter + , DATETIME_TRUNC(bookings_source_src_28000.ds, year) AS ds__year , EXTRACT(year FROM bookings_source_src_28000.ds) AS ds__extract_year , EXTRACT(quarter FROM bookings_source_src_28000.ds) AS ds__extract_quarter , EXTRACT(month FROM bookings_source_src_28000.ds) AS ds__extract_month , EXTRACT(day FROM bookings_source_src_28000.ds) AS ds__extract_day , IF(EXTRACT(dayofweek FROM bookings_source_src_28000.ds) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_28000.ds) - 1) AS ds__extract_dow , EXTRACT(dayofyear FROM bookings_source_src_28000.ds) AS ds__extract_doy - , DATE_TRUNC(bookings_source_src_28000.ds_partitioned, day) AS ds_partitioned__day - , DATE_TRUNC(bookings_source_src_28000.ds_partitioned, isoweek) AS ds_partitioned__week - , DATE_TRUNC(bookings_source_src_28000.ds_partitioned, month) AS ds_partitioned__month - , DATE_TRUNC(bookings_source_src_28000.ds_partitioned, quarter) AS ds_partitioned__quarter - , DATE_TRUNC(bookings_source_src_28000.ds_partitioned, year) AS ds_partitioned__year + , DATETIME_TRUNC(bookings_source_src_28000.ds_partitioned, day) AS ds_partitioned__day + , DATETIME_TRUNC(bookings_source_src_28000.ds_partitioned, isoweek) AS ds_partitioned__week + , DATETIME_TRUNC(bookings_source_src_28000.ds_partitioned, month) AS ds_partitioned__month + , DATETIME_TRUNC(bookings_source_src_28000.ds_partitioned, quarter) AS ds_partitioned__quarter + , DATETIME_TRUNC(bookings_source_src_28000.ds_partitioned, year) AS ds_partitioned__year , EXTRACT(year FROM bookings_source_src_28000.ds_partitioned) AS ds_partitioned__extract_year , EXTRACT(quarter FROM bookings_source_src_28000.ds_partitioned) AS ds_partitioned__extract_quarter , EXTRACT(month FROM bookings_source_src_28000.ds_partitioned) AS ds_partitioned__extract_month , EXTRACT(day FROM bookings_source_src_28000.ds_partitioned) AS ds_partitioned__extract_day , IF(EXTRACT(dayofweek FROM bookings_source_src_28000.ds_partitioned) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_28000.ds_partitioned) - 1) AS ds_partitioned__extract_dow , EXTRACT(dayofyear FROM bookings_source_src_28000.ds_partitioned) AS ds_partitioned__extract_doy - , DATE_TRUNC(bookings_source_src_28000.paid_at, day) AS paid_at__day - , DATE_TRUNC(bookings_source_src_28000.paid_at, isoweek) AS paid_at__week - , DATE_TRUNC(bookings_source_src_28000.paid_at, month) AS paid_at__month - , DATE_TRUNC(bookings_source_src_28000.paid_at, quarter) AS paid_at__quarter - , DATE_TRUNC(bookings_source_src_28000.paid_at, year) AS paid_at__year + , DATETIME_TRUNC(bookings_source_src_28000.paid_at, day) AS paid_at__day + , DATETIME_TRUNC(bookings_source_src_28000.paid_at, isoweek) AS paid_at__week + , DATETIME_TRUNC(bookings_source_src_28000.paid_at, month) AS paid_at__month + , DATETIME_TRUNC(bookings_source_src_28000.paid_at, quarter) AS paid_at__quarter + , DATETIME_TRUNC(bookings_source_src_28000.paid_at, year) AS paid_at__year , EXTRACT(year FROM bookings_source_src_28000.paid_at) AS paid_at__extract_year , EXTRACT(quarter FROM bookings_source_src_28000.paid_at) AS paid_at__extract_quarter , EXTRACT(month FROM bookings_source_src_28000.paid_at) AS paid_at__extract_month @@ -263,33 +263,33 @@ FROM ( , IF(EXTRACT(dayofweek FROM bookings_source_src_28000.paid_at) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_28000.paid_at) - 1) AS paid_at__extract_dow , EXTRACT(dayofyear FROM bookings_source_src_28000.paid_at) AS paid_at__extract_doy , bookings_source_src_28000.is_instant AS booking__is_instant - , DATE_TRUNC(bookings_source_src_28000.ds, day) AS booking__ds__day - , DATE_TRUNC(bookings_source_src_28000.ds, isoweek) AS booking__ds__week - , DATE_TRUNC(bookings_source_src_28000.ds, month) AS booking__ds__month - , DATE_TRUNC(bookings_source_src_28000.ds, quarter) AS booking__ds__quarter - , DATE_TRUNC(bookings_source_src_28000.ds, year) AS booking__ds__year + , DATETIME_TRUNC(bookings_source_src_28000.ds, day) AS booking__ds__day + , DATETIME_TRUNC(bookings_source_src_28000.ds, isoweek) AS booking__ds__week + , DATETIME_TRUNC(bookings_source_src_28000.ds, month) AS booking__ds__month + , DATETIME_TRUNC(bookings_source_src_28000.ds, quarter) AS booking__ds__quarter + , DATETIME_TRUNC(bookings_source_src_28000.ds, year) AS booking__ds__year , EXTRACT(year FROM bookings_source_src_28000.ds) AS booking__ds__extract_year , EXTRACT(quarter FROM bookings_source_src_28000.ds) AS booking__ds__extract_quarter , EXTRACT(month FROM bookings_source_src_28000.ds) AS booking__ds__extract_month , EXTRACT(day FROM bookings_source_src_28000.ds) AS booking__ds__extract_day , IF(EXTRACT(dayofweek FROM bookings_source_src_28000.ds) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_28000.ds) - 1) AS booking__ds__extract_dow , EXTRACT(dayofyear FROM bookings_source_src_28000.ds) AS booking__ds__extract_doy - , DATE_TRUNC(bookings_source_src_28000.ds_partitioned, day) AS booking__ds_partitioned__day - , DATE_TRUNC(bookings_source_src_28000.ds_partitioned, isoweek) AS booking__ds_partitioned__week - , DATE_TRUNC(bookings_source_src_28000.ds_partitioned, month) AS booking__ds_partitioned__month - , DATE_TRUNC(bookings_source_src_28000.ds_partitioned, quarter) AS booking__ds_partitioned__quarter - , DATE_TRUNC(bookings_source_src_28000.ds_partitioned, year) AS booking__ds_partitioned__year + , DATETIME_TRUNC(bookings_source_src_28000.ds_partitioned, day) AS booking__ds_partitioned__day + , DATETIME_TRUNC(bookings_source_src_28000.ds_partitioned, isoweek) AS booking__ds_partitioned__week + , DATETIME_TRUNC(bookings_source_src_28000.ds_partitioned, month) AS booking__ds_partitioned__month + , DATETIME_TRUNC(bookings_source_src_28000.ds_partitioned, quarter) AS booking__ds_partitioned__quarter + , DATETIME_TRUNC(bookings_source_src_28000.ds_partitioned, year) AS booking__ds_partitioned__year , EXTRACT(year FROM bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__extract_year , EXTRACT(quarter FROM bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__extract_quarter , EXTRACT(month FROM bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__extract_month , EXTRACT(day FROM bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__extract_day , IF(EXTRACT(dayofweek FROM bookings_source_src_28000.ds_partitioned) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_28000.ds_partitioned) - 1) AS booking__ds_partitioned__extract_dow , EXTRACT(dayofyear FROM bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__extract_doy - , DATE_TRUNC(bookings_source_src_28000.paid_at, day) AS booking__paid_at__day - , DATE_TRUNC(bookings_source_src_28000.paid_at, isoweek) AS booking__paid_at__week - , DATE_TRUNC(bookings_source_src_28000.paid_at, month) AS booking__paid_at__month - , DATE_TRUNC(bookings_source_src_28000.paid_at, quarter) AS booking__paid_at__quarter - , DATE_TRUNC(bookings_source_src_28000.paid_at, year) AS booking__paid_at__year + , DATETIME_TRUNC(bookings_source_src_28000.paid_at, day) AS booking__paid_at__day + , DATETIME_TRUNC(bookings_source_src_28000.paid_at, isoweek) AS booking__paid_at__week + , DATETIME_TRUNC(bookings_source_src_28000.paid_at, month) AS booking__paid_at__month + , DATETIME_TRUNC(bookings_source_src_28000.paid_at, quarter) AS booking__paid_at__quarter + , DATETIME_TRUNC(bookings_source_src_28000.paid_at, year) AS booking__paid_at__year , EXTRACT(year FROM bookings_source_src_28000.paid_at) AS booking__paid_at__extract_year , EXTRACT(quarter FROM bookings_source_src_28000.paid_at) AS booking__paid_at__extract_quarter , EXTRACT(month FROM bookings_source_src_28000.paid_at) AS booking__paid_at__extract_month diff --git a/tests_metricflow/snapshots/test_time_spine_join_rendering.py/SqlQueryPlan/BigQuery/test_join_to_time_spine_with_time_constraint__plan0_optimized.sql b/tests_metricflow/snapshots/test_time_spine_join_rendering.py/SqlQueryPlan/BigQuery/test_join_to_time_spine_with_time_constraint__plan0_optimized.sql index 297d2acc6a..cbe63bba06 100644 --- a/tests_metricflow/snapshots/test_time_spine_join_rendering.py/SqlQueryPlan/BigQuery/test_join_to_time_spine_with_time_constraint__plan0_optimized.sql +++ b/tests_metricflow/snapshots/test_time_spine_join_rendering.py/SqlQueryPlan/BigQuery/test_join_to_time_spine_with_time_constraint__plan0_optimized.sql @@ -10,5 +10,5 @@ FROM ( SELECT SUM(1) AS bookings FROM ***************************.fct_bookings bookings_source_src_28000 - WHERE DATE_TRUNC(ds, day) BETWEEN '2020-01-03' AND '2020-01-05' + WHERE DATETIME_TRUNC(ds, day) BETWEEN '2020-01-03' AND '2020-01-05' ) subq_11 diff --git a/tests_metricflow/snapshots/test_time_spine_join_rendering.py/SqlQueryPlan/BigQuery/test_simple_join_to_time_spine__plan0.sql b/tests_metricflow/snapshots/test_time_spine_join_rendering.py/SqlQueryPlan/BigQuery/test_simple_join_to_time_spine__plan0.sql index 7d17c5a1be..91e10c5ccd 100644 --- a/tests_metricflow/snapshots/test_time_spine_join_rendering.py/SqlQueryPlan/BigQuery/test_simple_join_to_time_spine__plan0.sql +++ b/tests_metricflow/snapshots/test_time_spine_join_rendering.py/SqlQueryPlan/BigQuery/test_simple_join_to_time_spine__plan0.sql @@ -142,33 +142,33 @@ FROM ( , bookings_source_src_28000.booking_value AS approximate_continuous_booking_value_p99 , bookings_source_src_28000.booking_value AS approximate_discrete_booking_value_p99 , bookings_source_src_28000.is_instant - , DATE_TRUNC(bookings_source_src_28000.ds, day) AS ds__day - , DATE_TRUNC(bookings_source_src_28000.ds, isoweek) AS ds__week - , DATE_TRUNC(bookings_source_src_28000.ds, month) AS ds__month - , DATE_TRUNC(bookings_source_src_28000.ds, quarter) AS ds__quarter - , DATE_TRUNC(bookings_source_src_28000.ds, year) AS ds__year + , DATETIME_TRUNC(bookings_source_src_28000.ds, day) AS ds__day + , DATETIME_TRUNC(bookings_source_src_28000.ds, isoweek) AS ds__week + , DATETIME_TRUNC(bookings_source_src_28000.ds, month) AS ds__month + , DATETIME_TRUNC(bookings_source_src_28000.ds, quarter) AS ds__quarter + , DATETIME_TRUNC(bookings_source_src_28000.ds, year) AS ds__year , EXTRACT(year FROM bookings_source_src_28000.ds) AS ds__extract_year , EXTRACT(quarter FROM bookings_source_src_28000.ds) AS ds__extract_quarter , EXTRACT(month FROM bookings_source_src_28000.ds) AS ds__extract_month , EXTRACT(day FROM bookings_source_src_28000.ds) AS ds__extract_day , IF(EXTRACT(dayofweek FROM bookings_source_src_28000.ds) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_28000.ds) - 1) AS ds__extract_dow , EXTRACT(dayofyear FROM bookings_source_src_28000.ds) AS ds__extract_doy - , DATE_TRUNC(bookings_source_src_28000.ds_partitioned, day) AS ds_partitioned__day - , DATE_TRUNC(bookings_source_src_28000.ds_partitioned, isoweek) AS ds_partitioned__week - , DATE_TRUNC(bookings_source_src_28000.ds_partitioned, month) AS ds_partitioned__month - , DATE_TRUNC(bookings_source_src_28000.ds_partitioned, quarter) AS ds_partitioned__quarter - , DATE_TRUNC(bookings_source_src_28000.ds_partitioned, year) AS ds_partitioned__year + , DATETIME_TRUNC(bookings_source_src_28000.ds_partitioned, day) AS ds_partitioned__day + , DATETIME_TRUNC(bookings_source_src_28000.ds_partitioned, isoweek) AS ds_partitioned__week + , DATETIME_TRUNC(bookings_source_src_28000.ds_partitioned, month) AS ds_partitioned__month + , DATETIME_TRUNC(bookings_source_src_28000.ds_partitioned, quarter) AS ds_partitioned__quarter + , DATETIME_TRUNC(bookings_source_src_28000.ds_partitioned, year) AS ds_partitioned__year , EXTRACT(year FROM bookings_source_src_28000.ds_partitioned) AS ds_partitioned__extract_year , EXTRACT(quarter FROM bookings_source_src_28000.ds_partitioned) AS ds_partitioned__extract_quarter , EXTRACT(month FROM bookings_source_src_28000.ds_partitioned) AS ds_partitioned__extract_month , EXTRACT(day FROM bookings_source_src_28000.ds_partitioned) AS ds_partitioned__extract_day , IF(EXTRACT(dayofweek FROM bookings_source_src_28000.ds_partitioned) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_28000.ds_partitioned) - 1) AS ds_partitioned__extract_dow , EXTRACT(dayofyear FROM bookings_source_src_28000.ds_partitioned) AS ds_partitioned__extract_doy - , DATE_TRUNC(bookings_source_src_28000.paid_at, day) AS paid_at__day - , DATE_TRUNC(bookings_source_src_28000.paid_at, isoweek) AS paid_at__week - , DATE_TRUNC(bookings_source_src_28000.paid_at, month) AS paid_at__month - , DATE_TRUNC(bookings_source_src_28000.paid_at, quarter) AS paid_at__quarter - , DATE_TRUNC(bookings_source_src_28000.paid_at, year) AS paid_at__year + , DATETIME_TRUNC(bookings_source_src_28000.paid_at, day) AS paid_at__day + , DATETIME_TRUNC(bookings_source_src_28000.paid_at, isoweek) AS paid_at__week + , DATETIME_TRUNC(bookings_source_src_28000.paid_at, month) AS paid_at__month + , DATETIME_TRUNC(bookings_source_src_28000.paid_at, quarter) AS paid_at__quarter + , DATETIME_TRUNC(bookings_source_src_28000.paid_at, year) AS paid_at__year , EXTRACT(year FROM bookings_source_src_28000.paid_at) AS paid_at__extract_year , EXTRACT(quarter FROM bookings_source_src_28000.paid_at) AS paid_at__extract_quarter , EXTRACT(month FROM bookings_source_src_28000.paid_at) AS paid_at__extract_month @@ -176,33 +176,33 @@ FROM ( , IF(EXTRACT(dayofweek FROM bookings_source_src_28000.paid_at) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_28000.paid_at) - 1) AS paid_at__extract_dow , EXTRACT(dayofyear FROM bookings_source_src_28000.paid_at) AS paid_at__extract_doy , bookings_source_src_28000.is_instant AS booking__is_instant - , DATE_TRUNC(bookings_source_src_28000.ds, day) AS booking__ds__day - , DATE_TRUNC(bookings_source_src_28000.ds, isoweek) AS booking__ds__week - , DATE_TRUNC(bookings_source_src_28000.ds, month) AS booking__ds__month - , DATE_TRUNC(bookings_source_src_28000.ds, quarter) AS booking__ds__quarter - , DATE_TRUNC(bookings_source_src_28000.ds, year) AS booking__ds__year + , DATETIME_TRUNC(bookings_source_src_28000.ds, day) AS booking__ds__day + , DATETIME_TRUNC(bookings_source_src_28000.ds, isoweek) AS booking__ds__week + , DATETIME_TRUNC(bookings_source_src_28000.ds, month) AS booking__ds__month + , DATETIME_TRUNC(bookings_source_src_28000.ds, quarter) AS booking__ds__quarter + , DATETIME_TRUNC(bookings_source_src_28000.ds, year) AS booking__ds__year , EXTRACT(year FROM bookings_source_src_28000.ds) AS booking__ds__extract_year , EXTRACT(quarter FROM bookings_source_src_28000.ds) AS booking__ds__extract_quarter , EXTRACT(month FROM bookings_source_src_28000.ds) AS booking__ds__extract_month , EXTRACT(day FROM bookings_source_src_28000.ds) AS booking__ds__extract_day , IF(EXTRACT(dayofweek FROM bookings_source_src_28000.ds) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_28000.ds) - 1) AS booking__ds__extract_dow , EXTRACT(dayofyear FROM bookings_source_src_28000.ds) AS booking__ds__extract_doy - , DATE_TRUNC(bookings_source_src_28000.ds_partitioned, day) AS booking__ds_partitioned__day - , DATE_TRUNC(bookings_source_src_28000.ds_partitioned, isoweek) AS booking__ds_partitioned__week - , DATE_TRUNC(bookings_source_src_28000.ds_partitioned, month) AS booking__ds_partitioned__month - , DATE_TRUNC(bookings_source_src_28000.ds_partitioned, quarter) AS booking__ds_partitioned__quarter - , DATE_TRUNC(bookings_source_src_28000.ds_partitioned, year) AS booking__ds_partitioned__year + , DATETIME_TRUNC(bookings_source_src_28000.ds_partitioned, day) AS booking__ds_partitioned__day + , DATETIME_TRUNC(bookings_source_src_28000.ds_partitioned, isoweek) AS booking__ds_partitioned__week + , DATETIME_TRUNC(bookings_source_src_28000.ds_partitioned, month) AS booking__ds_partitioned__month + , DATETIME_TRUNC(bookings_source_src_28000.ds_partitioned, quarter) AS booking__ds_partitioned__quarter + , DATETIME_TRUNC(bookings_source_src_28000.ds_partitioned, year) AS booking__ds_partitioned__year , EXTRACT(year FROM bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__extract_year , EXTRACT(quarter FROM bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__extract_quarter , EXTRACT(month FROM bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__extract_month , EXTRACT(day FROM bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__extract_day , IF(EXTRACT(dayofweek FROM bookings_source_src_28000.ds_partitioned) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_28000.ds_partitioned) - 1) AS booking__ds_partitioned__extract_dow , EXTRACT(dayofyear FROM bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__extract_doy - , DATE_TRUNC(bookings_source_src_28000.paid_at, day) AS booking__paid_at__day - , DATE_TRUNC(bookings_source_src_28000.paid_at, isoweek) AS booking__paid_at__week - , DATE_TRUNC(bookings_source_src_28000.paid_at, month) AS booking__paid_at__month - , DATE_TRUNC(bookings_source_src_28000.paid_at, quarter) AS booking__paid_at__quarter - , DATE_TRUNC(bookings_source_src_28000.paid_at, year) AS booking__paid_at__year + , DATETIME_TRUNC(bookings_source_src_28000.paid_at, day) AS booking__paid_at__day + , DATETIME_TRUNC(bookings_source_src_28000.paid_at, isoweek) AS booking__paid_at__week + , DATETIME_TRUNC(bookings_source_src_28000.paid_at, month) AS booking__paid_at__month + , DATETIME_TRUNC(bookings_source_src_28000.paid_at, quarter) AS booking__paid_at__quarter + , DATETIME_TRUNC(bookings_source_src_28000.paid_at, year) AS booking__paid_at__year , EXTRACT(year FROM bookings_source_src_28000.paid_at) AS booking__paid_at__extract_year , EXTRACT(quarter FROM bookings_source_src_28000.paid_at) AS booking__paid_at__extract_quarter , EXTRACT(month FROM bookings_source_src_28000.paid_at) AS booking__paid_at__extract_month diff --git a/tests_metricflow/snapshots/test_time_spine_join_rendering.py/SqlQueryPlan/BigQuery/test_simple_join_to_time_spine__plan0_optimized.sql b/tests_metricflow/snapshots/test_time_spine_join_rendering.py/SqlQueryPlan/BigQuery/test_simple_join_to_time_spine__plan0_optimized.sql index 2825e395da..3da2e2fa5f 100644 --- a/tests_metricflow/snapshots/test_time_spine_join_rendering.py/SqlQueryPlan/BigQuery/test_simple_join_to_time_spine__plan0_optimized.sql +++ b/tests_metricflow/snapshots/test_time_spine_join_rendering.py/SqlQueryPlan/BigQuery/test_simple_join_to_time_spine__plan0_optimized.sql @@ -14,7 +14,7 @@ LEFT OUTER JOIN ( -- Metric Time Dimension 'ds' -- Pass Only Elements: ['bookings', 'metric_time__day'] SELECT - DATE_TRUNC(ds, day) AS metric_time__day + DATETIME_TRUNC(ds, day) AS metric_time__day , 1 AS bookings FROM ***************************.fct_bookings bookings_source_src_28000 ) subq_9 diff --git a/tests_metricflow/snapshots/test_time_spine_join_rendering.py/SqlQueryPlan/BigQuery/test_simple_join_to_time_spine_with_filter__plan0.sql b/tests_metricflow/snapshots/test_time_spine_join_rendering.py/SqlQueryPlan/BigQuery/test_simple_join_to_time_spine_with_filter__plan0.sql index b12cf70b36..75603754c5 100644 --- a/tests_metricflow/snapshots/test_time_spine_join_rendering.py/SqlQueryPlan/BigQuery/test_simple_join_to_time_spine_with_filter__plan0.sql +++ b/tests_metricflow/snapshots/test_time_spine_join_rendering.py/SqlQueryPlan/BigQuery/test_simple_join_to_time_spine_with_filter__plan0.sql @@ -154,33 +154,33 @@ FROM ( , bookings_source_src_28000.booking_value AS approximate_continuous_booking_value_p99 , bookings_source_src_28000.booking_value AS approximate_discrete_booking_value_p99 , bookings_source_src_28000.is_instant - , DATE_TRUNC(bookings_source_src_28000.ds, day) AS ds__day - , DATE_TRUNC(bookings_source_src_28000.ds, isoweek) AS ds__week - , DATE_TRUNC(bookings_source_src_28000.ds, month) AS ds__month - , DATE_TRUNC(bookings_source_src_28000.ds, quarter) AS ds__quarter - , DATE_TRUNC(bookings_source_src_28000.ds, year) AS ds__year + , DATETIME_TRUNC(bookings_source_src_28000.ds, day) AS ds__day + , DATETIME_TRUNC(bookings_source_src_28000.ds, isoweek) AS ds__week + , DATETIME_TRUNC(bookings_source_src_28000.ds, month) AS ds__month + , DATETIME_TRUNC(bookings_source_src_28000.ds, quarter) AS ds__quarter + , DATETIME_TRUNC(bookings_source_src_28000.ds, year) AS ds__year , EXTRACT(year FROM bookings_source_src_28000.ds) AS ds__extract_year , EXTRACT(quarter FROM bookings_source_src_28000.ds) AS ds__extract_quarter , EXTRACT(month FROM bookings_source_src_28000.ds) AS ds__extract_month , EXTRACT(day FROM bookings_source_src_28000.ds) AS ds__extract_day , IF(EXTRACT(dayofweek FROM bookings_source_src_28000.ds) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_28000.ds) - 1) AS ds__extract_dow , EXTRACT(dayofyear FROM bookings_source_src_28000.ds) AS ds__extract_doy - , DATE_TRUNC(bookings_source_src_28000.ds_partitioned, day) AS ds_partitioned__day - , DATE_TRUNC(bookings_source_src_28000.ds_partitioned, isoweek) AS ds_partitioned__week - , DATE_TRUNC(bookings_source_src_28000.ds_partitioned, month) AS ds_partitioned__month - , DATE_TRUNC(bookings_source_src_28000.ds_partitioned, quarter) AS ds_partitioned__quarter - , DATE_TRUNC(bookings_source_src_28000.ds_partitioned, year) AS ds_partitioned__year + , DATETIME_TRUNC(bookings_source_src_28000.ds_partitioned, day) AS ds_partitioned__day + , DATETIME_TRUNC(bookings_source_src_28000.ds_partitioned, isoweek) AS ds_partitioned__week + , DATETIME_TRUNC(bookings_source_src_28000.ds_partitioned, month) AS ds_partitioned__month + , DATETIME_TRUNC(bookings_source_src_28000.ds_partitioned, quarter) AS ds_partitioned__quarter + , DATETIME_TRUNC(bookings_source_src_28000.ds_partitioned, year) AS ds_partitioned__year , EXTRACT(year FROM bookings_source_src_28000.ds_partitioned) AS ds_partitioned__extract_year , EXTRACT(quarter FROM bookings_source_src_28000.ds_partitioned) AS ds_partitioned__extract_quarter , EXTRACT(month FROM bookings_source_src_28000.ds_partitioned) AS ds_partitioned__extract_month , EXTRACT(day FROM bookings_source_src_28000.ds_partitioned) AS ds_partitioned__extract_day , IF(EXTRACT(dayofweek FROM bookings_source_src_28000.ds_partitioned) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_28000.ds_partitioned) - 1) AS ds_partitioned__extract_dow , EXTRACT(dayofyear FROM bookings_source_src_28000.ds_partitioned) AS ds_partitioned__extract_doy - , DATE_TRUNC(bookings_source_src_28000.paid_at, day) AS paid_at__day - , DATE_TRUNC(bookings_source_src_28000.paid_at, isoweek) AS paid_at__week - , DATE_TRUNC(bookings_source_src_28000.paid_at, month) AS paid_at__month - , DATE_TRUNC(bookings_source_src_28000.paid_at, quarter) AS paid_at__quarter - , DATE_TRUNC(bookings_source_src_28000.paid_at, year) AS paid_at__year + , DATETIME_TRUNC(bookings_source_src_28000.paid_at, day) AS paid_at__day + , DATETIME_TRUNC(bookings_source_src_28000.paid_at, isoweek) AS paid_at__week + , DATETIME_TRUNC(bookings_source_src_28000.paid_at, month) AS paid_at__month + , DATETIME_TRUNC(bookings_source_src_28000.paid_at, quarter) AS paid_at__quarter + , DATETIME_TRUNC(bookings_source_src_28000.paid_at, year) AS paid_at__year , EXTRACT(year FROM bookings_source_src_28000.paid_at) AS paid_at__extract_year , EXTRACT(quarter FROM bookings_source_src_28000.paid_at) AS paid_at__extract_quarter , EXTRACT(month FROM bookings_source_src_28000.paid_at) AS paid_at__extract_month @@ -188,33 +188,33 @@ FROM ( , IF(EXTRACT(dayofweek FROM bookings_source_src_28000.paid_at) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_28000.paid_at) - 1) AS paid_at__extract_dow , EXTRACT(dayofyear FROM bookings_source_src_28000.paid_at) AS paid_at__extract_doy , bookings_source_src_28000.is_instant AS booking__is_instant - , DATE_TRUNC(bookings_source_src_28000.ds, day) AS booking__ds__day - , DATE_TRUNC(bookings_source_src_28000.ds, isoweek) AS booking__ds__week - , DATE_TRUNC(bookings_source_src_28000.ds, month) AS booking__ds__month - , DATE_TRUNC(bookings_source_src_28000.ds, quarter) AS booking__ds__quarter - , DATE_TRUNC(bookings_source_src_28000.ds, year) AS booking__ds__year + , DATETIME_TRUNC(bookings_source_src_28000.ds, day) AS booking__ds__day + , DATETIME_TRUNC(bookings_source_src_28000.ds, isoweek) AS booking__ds__week + , DATETIME_TRUNC(bookings_source_src_28000.ds, month) AS booking__ds__month + , DATETIME_TRUNC(bookings_source_src_28000.ds, quarter) AS booking__ds__quarter + , DATETIME_TRUNC(bookings_source_src_28000.ds, year) AS booking__ds__year , EXTRACT(year FROM bookings_source_src_28000.ds) AS booking__ds__extract_year , EXTRACT(quarter FROM bookings_source_src_28000.ds) AS booking__ds__extract_quarter , EXTRACT(month FROM bookings_source_src_28000.ds) AS booking__ds__extract_month , EXTRACT(day FROM bookings_source_src_28000.ds) AS booking__ds__extract_day , IF(EXTRACT(dayofweek FROM bookings_source_src_28000.ds) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_28000.ds) - 1) AS booking__ds__extract_dow , EXTRACT(dayofyear FROM bookings_source_src_28000.ds) AS booking__ds__extract_doy - , DATE_TRUNC(bookings_source_src_28000.ds_partitioned, day) AS booking__ds_partitioned__day - , DATE_TRUNC(bookings_source_src_28000.ds_partitioned, isoweek) AS booking__ds_partitioned__week - , DATE_TRUNC(bookings_source_src_28000.ds_partitioned, month) AS booking__ds_partitioned__month - , DATE_TRUNC(bookings_source_src_28000.ds_partitioned, quarter) AS booking__ds_partitioned__quarter - , DATE_TRUNC(bookings_source_src_28000.ds_partitioned, year) AS booking__ds_partitioned__year + , DATETIME_TRUNC(bookings_source_src_28000.ds_partitioned, day) AS booking__ds_partitioned__day + , DATETIME_TRUNC(bookings_source_src_28000.ds_partitioned, isoweek) AS booking__ds_partitioned__week + , DATETIME_TRUNC(bookings_source_src_28000.ds_partitioned, month) AS booking__ds_partitioned__month + , DATETIME_TRUNC(bookings_source_src_28000.ds_partitioned, quarter) AS booking__ds_partitioned__quarter + , DATETIME_TRUNC(bookings_source_src_28000.ds_partitioned, year) AS booking__ds_partitioned__year , EXTRACT(year FROM bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__extract_year , EXTRACT(quarter FROM bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__extract_quarter , EXTRACT(month FROM bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__extract_month , EXTRACT(day FROM bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__extract_day , IF(EXTRACT(dayofweek FROM bookings_source_src_28000.ds_partitioned) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_28000.ds_partitioned) - 1) AS booking__ds_partitioned__extract_dow , EXTRACT(dayofyear FROM bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__extract_doy - , DATE_TRUNC(bookings_source_src_28000.paid_at, day) AS booking__paid_at__day - , DATE_TRUNC(bookings_source_src_28000.paid_at, isoweek) AS booking__paid_at__week - , DATE_TRUNC(bookings_source_src_28000.paid_at, month) AS booking__paid_at__month - , DATE_TRUNC(bookings_source_src_28000.paid_at, quarter) AS booking__paid_at__quarter - , DATE_TRUNC(bookings_source_src_28000.paid_at, year) AS booking__paid_at__year + , DATETIME_TRUNC(bookings_source_src_28000.paid_at, day) AS booking__paid_at__day + , DATETIME_TRUNC(bookings_source_src_28000.paid_at, isoweek) AS booking__paid_at__week + , DATETIME_TRUNC(bookings_source_src_28000.paid_at, month) AS booking__paid_at__month + , DATETIME_TRUNC(bookings_source_src_28000.paid_at, quarter) AS booking__paid_at__quarter + , DATETIME_TRUNC(bookings_source_src_28000.paid_at, year) AS booking__paid_at__year , EXTRACT(year FROM bookings_source_src_28000.paid_at) AS booking__paid_at__extract_year , EXTRACT(quarter FROM bookings_source_src_28000.paid_at) AS booking__paid_at__extract_quarter , EXTRACT(month FROM bookings_source_src_28000.paid_at) AS booking__paid_at__extract_month diff --git a/tests_metricflow/snapshots/test_time_spine_join_rendering.py/SqlQueryPlan/BigQuery/test_simple_join_to_time_spine_with_filter__plan0_optimized.sql b/tests_metricflow/snapshots/test_time_spine_join_rendering.py/SqlQueryPlan/BigQuery/test_simple_join_to_time_spine_with_filter__plan0_optimized.sql index f4b3177181..4ecdfebc25 100644 --- a/tests_metricflow/snapshots/test_time_spine_join_rendering.py/SqlQueryPlan/BigQuery/test_simple_join_to_time_spine_with_filter__plan0_optimized.sql +++ b/tests_metricflow/snapshots/test_time_spine_join_rendering.py/SqlQueryPlan/BigQuery/test_simple_join_to_time_spine_with_filter__plan0_optimized.sql @@ -20,7 +20,7 @@ FROM ( -- Metric Time Dimension 'ds' -- Pass Only Elements: ['bookings', 'booking__is_instant', 'metric_time__day'] SELECT - DATE_TRUNC(ds, day) AS metric_time__day + DATETIME_TRUNC(ds, day) AS metric_time__day , is_instant AS booking__is_instant , 1 AS bookings FROM ***************************.fct_bookings bookings_source_src_28000 diff --git a/tests_metricflow/snapshots/test_time_spine_join_rendering.py/SqlQueryPlan/BigQuery/test_simple_join_to_time_spine_with_queried_filter__plan0.sql b/tests_metricflow/snapshots/test_time_spine_join_rendering.py/SqlQueryPlan/BigQuery/test_simple_join_to_time_spine_with_queried_filter__plan0.sql index b1032da28a..7945e559e4 100644 --- a/tests_metricflow/snapshots/test_time_spine_join_rendering.py/SqlQueryPlan/BigQuery/test_simple_join_to_time_spine_with_queried_filter__plan0.sql +++ b/tests_metricflow/snapshots/test_time_spine_join_rendering.py/SqlQueryPlan/BigQuery/test_simple_join_to_time_spine_with_queried_filter__plan0.sql @@ -158,33 +158,33 @@ FROM ( , bookings_source_src_28000.booking_value AS approximate_continuous_booking_value_p99 , bookings_source_src_28000.booking_value AS approximate_discrete_booking_value_p99 , bookings_source_src_28000.is_instant - , DATE_TRUNC(bookings_source_src_28000.ds, day) AS ds__day - , DATE_TRUNC(bookings_source_src_28000.ds, isoweek) AS ds__week - , DATE_TRUNC(bookings_source_src_28000.ds, month) AS ds__month - , DATE_TRUNC(bookings_source_src_28000.ds, quarter) AS ds__quarter - , DATE_TRUNC(bookings_source_src_28000.ds, year) AS ds__year + , DATETIME_TRUNC(bookings_source_src_28000.ds, day) AS ds__day + , DATETIME_TRUNC(bookings_source_src_28000.ds, isoweek) AS ds__week + , DATETIME_TRUNC(bookings_source_src_28000.ds, month) AS ds__month + , DATETIME_TRUNC(bookings_source_src_28000.ds, quarter) AS ds__quarter + , DATETIME_TRUNC(bookings_source_src_28000.ds, year) AS ds__year , EXTRACT(year FROM bookings_source_src_28000.ds) AS ds__extract_year , EXTRACT(quarter FROM bookings_source_src_28000.ds) AS ds__extract_quarter , EXTRACT(month FROM bookings_source_src_28000.ds) AS ds__extract_month , EXTRACT(day FROM bookings_source_src_28000.ds) AS ds__extract_day , IF(EXTRACT(dayofweek FROM bookings_source_src_28000.ds) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_28000.ds) - 1) AS ds__extract_dow , EXTRACT(dayofyear FROM bookings_source_src_28000.ds) AS ds__extract_doy - , DATE_TRUNC(bookings_source_src_28000.ds_partitioned, day) AS ds_partitioned__day - , DATE_TRUNC(bookings_source_src_28000.ds_partitioned, isoweek) AS ds_partitioned__week - , DATE_TRUNC(bookings_source_src_28000.ds_partitioned, month) AS ds_partitioned__month - , DATE_TRUNC(bookings_source_src_28000.ds_partitioned, quarter) AS ds_partitioned__quarter - , DATE_TRUNC(bookings_source_src_28000.ds_partitioned, year) AS ds_partitioned__year + , DATETIME_TRUNC(bookings_source_src_28000.ds_partitioned, day) AS ds_partitioned__day + , DATETIME_TRUNC(bookings_source_src_28000.ds_partitioned, isoweek) AS ds_partitioned__week + , DATETIME_TRUNC(bookings_source_src_28000.ds_partitioned, month) AS ds_partitioned__month + , DATETIME_TRUNC(bookings_source_src_28000.ds_partitioned, quarter) AS ds_partitioned__quarter + , DATETIME_TRUNC(bookings_source_src_28000.ds_partitioned, year) AS ds_partitioned__year , EXTRACT(year FROM bookings_source_src_28000.ds_partitioned) AS ds_partitioned__extract_year , EXTRACT(quarter FROM bookings_source_src_28000.ds_partitioned) AS ds_partitioned__extract_quarter , EXTRACT(month FROM bookings_source_src_28000.ds_partitioned) AS ds_partitioned__extract_month , EXTRACT(day FROM bookings_source_src_28000.ds_partitioned) AS ds_partitioned__extract_day , IF(EXTRACT(dayofweek FROM bookings_source_src_28000.ds_partitioned) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_28000.ds_partitioned) - 1) AS ds_partitioned__extract_dow , EXTRACT(dayofyear FROM bookings_source_src_28000.ds_partitioned) AS ds_partitioned__extract_doy - , DATE_TRUNC(bookings_source_src_28000.paid_at, day) AS paid_at__day - , DATE_TRUNC(bookings_source_src_28000.paid_at, isoweek) AS paid_at__week - , DATE_TRUNC(bookings_source_src_28000.paid_at, month) AS paid_at__month - , DATE_TRUNC(bookings_source_src_28000.paid_at, quarter) AS paid_at__quarter - , DATE_TRUNC(bookings_source_src_28000.paid_at, year) AS paid_at__year + , DATETIME_TRUNC(bookings_source_src_28000.paid_at, day) AS paid_at__day + , DATETIME_TRUNC(bookings_source_src_28000.paid_at, isoweek) AS paid_at__week + , DATETIME_TRUNC(bookings_source_src_28000.paid_at, month) AS paid_at__month + , DATETIME_TRUNC(bookings_source_src_28000.paid_at, quarter) AS paid_at__quarter + , DATETIME_TRUNC(bookings_source_src_28000.paid_at, year) AS paid_at__year , EXTRACT(year FROM bookings_source_src_28000.paid_at) AS paid_at__extract_year , EXTRACT(quarter FROM bookings_source_src_28000.paid_at) AS paid_at__extract_quarter , EXTRACT(month FROM bookings_source_src_28000.paid_at) AS paid_at__extract_month @@ -192,33 +192,33 @@ FROM ( , IF(EXTRACT(dayofweek FROM bookings_source_src_28000.paid_at) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_28000.paid_at) - 1) AS paid_at__extract_dow , EXTRACT(dayofyear FROM bookings_source_src_28000.paid_at) AS paid_at__extract_doy , bookings_source_src_28000.is_instant AS booking__is_instant - , DATE_TRUNC(bookings_source_src_28000.ds, day) AS booking__ds__day - , DATE_TRUNC(bookings_source_src_28000.ds, isoweek) AS booking__ds__week - , DATE_TRUNC(bookings_source_src_28000.ds, month) AS booking__ds__month - , DATE_TRUNC(bookings_source_src_28000.ds, quarter) AS booking__ds__quarter - , DATE_TRUNC(bookings_source_src_28000.ds, year) AS booking__ds__year + , DATETIME_TRUNC(bookings_source_src_28000.ds, day) AS booking__ds__day + , DATETIME_TRUNC(bookings_source_src_28000.ds, isoweek) AS booking__ds__week + , DATETIME_TRUNC(bookings_source_src_28000.ds, month) AS booking__ds__month + , DATETIME_TRUNC(bookings_source_src_28000.ds, quarter) AS booking__ds__quarter + , DATETIME_TRUNC(bookings_source_src_28000.ds, year) AS booking__ds__year , EXTRACT(year FROM bookings_source_src_28000.ds) AS booking__ds__extract_year , EXTRACT(quarter FROM bookings_source_src_28000.ds) AS booking__ds__extract_quarter , EXTRACT(month FROM bookings_source_src_28000.ds) AS booking__ds__extract_month , EXTRACT(day FROM bookings_source_src_28000.ds) AS booking__ds__extract_day , IF(EXTRACT(dayofweek FROM bookings_source_src_28000.ds) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_28000.ds) - 1) AS booking__ds__extract_dow , EXTRACT(dayofyear FROM bookings_source_src_28000.ds) AS booking__ds__extract_doy - , DATE_TRUNC(bookings_source_src_28000.ds_partitioned, day) AS booking__ds_partitioned__day - , DATE_TRUNC(bookings_source_src_28000.ds_partitioned, isoweek) AS booking__ds_partitioned__week - , DATE_TRUNC(bookings_source_src_28000.ds_partitioned, month) AS booking__ds_partitioned__month - , DATE_TRUNC(bookings_source_src_28000.ds_partitioned, quarter) AS booking__ds_partitioned__quarter - , DATE_TRUNC(bookings_source_src_28000.ds_partitioned, year) AS booking__ds_partitioned__year + , DATETIME_TRUNC(bookings_source_src_28000.ds_partitioned, day) AS booking__ds_partitioned__day + , DATETIME_TRUNC(bookings_source_src_28000.ds_partitioned, isoweek) AS booking__ds_partitioned__week + , DATETIME_TRUNC(bookings_source_src_28000.ds_partitioned, month) AS booking__ds_partitioned__month + , DATETIME_TRUNC(bookings_source_src_28000.ds_partitioned, quarter) AS booking__ds_partitioned__quarter + , DATETIME_TRUNC(bookings_source_src_28000.ds_partitioned, year) AS booking__ds_partitioned__year , EXTRACT(year FROM bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__extract_year , EXTRACT(quarter FROM bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__extract_quarter , EXTRACT(month FROM bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__extract_month , EXTRACT(day FROM bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__extract_day , IF(EXTRACT(dayofweek FROM bookings_source_src_28000.ds_partitioned) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_28000.ds_partitioned) - 1) AS booking__ds_partitioned__extract_dow , EXTRACT(dayofyear FROM bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__extract_doy - , DATE_TRUNC(bookings_source_src_28000.paid_at, day) AS booking__paid_at__day - , DATE_TRUNC(bookings_source_src_28000.paid_at, isoweek) AS booking__paid_at__week - , DATE_TRUNC(bookings_source_src_28000.paid_at, month) AS booking__paid_at__month - , DATE_TRUNC(bookings_source_src_28000.paid_at, quarter) AS booking__paid_at__quarter - , DATE_TRUNC(bookings_source_src_28000.paid_at, year) AS booking__paid_at__year + , DATETIME_TRUNC(bookings_source_src_28000.paid_at, day) AS booking__paid_at__day + , DATETIME_TRUNC(bookings_source_src_28000.paid_at, isoweek) AS booking__paid_at__week + , DATETIME_TRUNC(bookings_source_src_28000.paid_at, month) AS booking__paid_at__month + , DATETIME_TRUNC(bookings_source_src_28000.paid_at, quarter) AS booking__paid_at__quarter + , DATETIME_TRUNC(bookings_source_src_28000.paid_at, year) AS booking__paid_at__year , EXTRACT(year FROM bookings_source_src_28000.paid_at) AS booking__paid_at__extract_year , EXTRACT(quarter FROM bookings_source_src_28000.paid_at) AS booking__paid_at__extract_quarter , EXTRACT(month FROM bookings_source_src_28000.paid_at) AS booking__paid_at__extract_month diff --git a/tests_metricflow/snapshots/test_time_spine_join_rendering.py/SqlQueryPlan/BigQuery/test_simple_join_to_time_spine_with_queried_filter__plan0_optimized.sql b/tests_metricflow/snapshots/test_time_spine_join_rendering.py/SqlQueryPlan/BigQuery/test_simple_join_to_time_spine_with_queried_filter__plan0_optimized.sql index 3f69f5ae0d..2b1b12de20 100644 --- a/tests_metricflow/snapshots/test_time_spine_join_rendering.py/SqlQueryPlan/BigQuery/test_simple_join_to_time_spine_with_queried_filter__plan0_optimized.sql +++ b/tests_metricflow/snapshots/test_time_spine_join_rendering.py/SqlQueryPlan/BigQuery/test_simple_join_to_time_spine_with_queried_filter__plan0_optimized.sql @@ -28,7 +28,7 @@ FROM ( -- Metric Time Dimension 'ds' -- Pass Only Elements: ['bookings', 'booking__is_instant', 'metric_time__day'] SELECT - DATE_TRUNC(ds, day) AS metric_time__day + DATETIME_TRUNC(ds, day) AS metric_time__day , is_instant AS booking__is_instant , 1 AS bookings FROM ***************************.fct_bookings bookings_source_src_28000